number_strongly_connected_components#
- number_strongly_connected_components(G)[source]#
Returns number of strongly connected components in graph.
- Parameters:
- GNetworkX graph
A directed graph.
- Returns:
- ninteger
Number of strongly connected components
- Raises:
- NetworkXNotImplemented
If G is undirected.
See also
Notes
For directed graphs only.
Examples
>>> G = nx.DiGraph([(0, 1), (1, 2), (2, 0), (2, 3), (4, 5), (3, 4), (5, 6), (6, 3), (6, 7)]) >>> nx.number_strongly_connected_components(G) 3