NetworkX

Previous topic

networkx.algorithms.components.connected.is_connected

Next topic

networkx.algorithms.components.connected.connected_components

networkx.algorithms.components.connected.number_connected_components

number_connected_components(G)

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.