NetworkX

Previous topic

networkx.algorithms.components.connected.number_connected_components

Next topic

networkx.algorithms.components.connected.connected_component_subgraphs

networkx.algorithms.components.connected.connected_components

networkx.algorithms.components.connected.connected_components(G)

Return nodes in connected components of graph.

Parameters :

G : NetworkX Graph

An undirected graph.

Returns :

comp : list of lists

A list of nodes for each component of G.

See also

strongly_connected_components

Notes

The list is ordered from largest connected component to smallest. For undirected graphs only.