Function petgraph::algo::scc [] [src]

pub fn scc<G>(g: G) -> Vec<Vec<G::NodeId>> where G: IntoNeighborsDirected + Visitable + IntoNodeIdentifiers

[Generic] Compute the strongly connected components using Kosaraju's algorithm.

Return a vector where each element is a strongly connected component (scc).

The order of NodeId within each scc is arbitrary, but the order of the sccs is their postorder (reverse topological sort).

This implementation is iterative and does two passes over the nodes.

For an undirected graph, the sccs are simply the connected components.