Function retworkx::cycle_basis [−][src]
pub fn cycle_basis(graph: &PyGraph, root: Option<usize>) -> Vec<Vec<usize>>
Return a list of cycles which form a basis for cycles of a given PyGraph
A basis for cycles of a graph is a minimal collection of cycles such that any cycle in the graph can be written as a sum of cycles in the basis. Here summation of cycles is defined as the exclusive or of the edges.
This is adapted from algorithm CACM 491 [1]_.
:param PyGraph graph: The graph to find the cycle basis in :param int root: Optional index for starting node for basis
:returns: A list of cycle lists. Each list is a list of node ids which forms a cycle (loop) in the input graph :rtype: list
.. [1] Paton, K. An algorithm for finding a fundamental set of cycles of a graph. Comm. ACM 12, 9 (Sept 1969), 514-518.