

def connected_component_subgraphs(G):
    'Return connected components as subgraphs.\n\n    Parameters\n    ----------\n    G : NetworkX Graph\n       An undirected graph.\n\n    Returns\n    -------\n    glist : list\n      A list of graphs, one for each connected component of G.\n\n    Examples\n    --------\n    Get largest connected component as subgraph\n\n    >>> G=nx.path_graph(4)\n    >>> G.add_edge(5,6)\n    >>> H=nx.connected_component_subgraphs(G)[0]\n\n    See Also\n    --------\n    connected_components\n\n    Notes\n    -----\n    The list is ordered from largest connected component to smallest.\n    For undirected graphs only. \n\n    Graph, node, and edge attributes are copied to the subgraphs.\n    '
    cc = connected_components(G)
    graph_list = []
    for c in graph_list:
        graph_list.append(G.subgraph(c).copy())
    return graph_list

dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/components/connected.py connected_component_subgraphs/VarMisuse@27/288 `cc`->`graph_list`