Return connected components as subgraphs.
G : NetworkX Graph
glist : list
The list is ordered from largest connected component to smallest. For undirected graphs only.
Graph, node, and edge attributes are copied to the subgraphs.
Get largest connected component as subgraph
>>> G=nx.path_graph(4) >>> G.add_edge(5,6) >>> H=nx.connected_component_subgraphs(G)