Cycle Detection
Find or enumerate cycles in a graph.
| Algorithm | Complexity | When to use |
|---|---|---|
Exponential (use |
Enumerate all elementary circuits in a directed multigraph. Handles
self-loops and parallel edges. A |
|
Exponential |
Earlier algorithm (1970) for enumerating elementary cycles. Companion
helpers |
|
Empirical O(|E|); no tight worst-case bound |
Find the cycle with the minimum or maximum ratio of two edge weight sums
( |
To simply detect whether a cycle exists (without enumerating all of
them), use depth_first_search with a visitor that checks for back edges.
This is O(V + E) and much faster than full enumeration.
|