Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
rustworkx.simple_cycles#
- simple_cycles(graph, /)#
Find all simple cycles of a
PyDiGraph
A “simple cycle” (called an elementary circuit in [1]) is a cycle (or closed path) where no node appears more than once.
This function is a an implementation of Johnson’s algorithm [1] also based on the non-recursive implementation found in NetworkX. [2][3]
[1] https://doi.org/10.1137/0204007 [2] https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.cycles.simple_cycles.html [3] https://github.com/networkx/networkx/blob/networkx-2.8.4/networkx/algorithms/cycles.py#L98-L222