$ open source · GPL-3.0 — need a commercial license? imqueue.com →

Graph.isCycled() method

Whether any path in this graph leads back to where it started.

Signature:

isCycled(): boolean;

Returns:

boolean

true when the graph contains a cycle.

Remarks

Checks from every vertex, so a cycle in a part of the graph nothing else reaches is still found. A self-edge counts. For model associations this is the question that matters: a cycle is an include chain that can be asked to include itself.