NetworkX

Previous topic

is_connected

Next topic

connected_components

number_connected_components

number_connected_components(G)[source]

Return number of connected components in graph.

Parameters :

G : NetworkX Graph

An undirected graph.

Returns :

n : integer

Number of connected components

Notes

For undirected graphs only.