networkx.algorithms.components.number_connected_components¶
-
number_connected_components
(G)[source]¶ Returns the number of connected components.
- Parameters
G (NetworkX graph) – An undirected graph.
- Returns
n – Number of connected components
- Return type
integer
See also
connected_components()
,number_weakly_connected_components()
,number_strongly_connected_components()
Notes
For undirected graphs only.