networkx.number_connected_components
networkx.connected_component_subgraphs
Return a list of lists of nodes in each connected component of G.
The list is ordered from largest connected component to smallest. For undirected graphs only.