Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

# networkx.algorithms.components.kosaraju_strongly_connected_components¶

kosaraju_strongly_connected_components(G, source=None)[source]

Generate nodes in strongly connected components of graph.

Parameters: G (NetworkX Graph) – A directed graph. comp – A genrator of sets of nodes, one for each strongly connected component of G. generator of sets NetworkXNotImplemented: – If G is undirected.

Examples

Generate a sorted list of strongly connected components, largest first.

>>> G = nx.cycle_graph(4, create_using=nx.DiGraph())

>>> largest = max(nx.kosaraju_strongly_connected_components(G), key=len)