The documentation for retworkx has migrated to:
These docs will no longer be updated.
- digraph_find_cycle(graph, /, source=None)¶
Return the first cycle encountered during DFS of a given PyDiGraph, empty list is returned if no cycle is found
graph (PyDiGraph) – The graph to find the cycle in
source (int) – Optional index to find a cycle for. If not specified an arbitrary node will be selected from the graph.
A list describing the cycle. The index of node ids which forms a cycle (loop) in the input graph
- Return type