

def node_connected_component(G, n):
    'Return nodes in connected components of graph containing node n.\n\n    Parameters\n    ----------\n    G : NetworkX Graph\n       An undirected graph.\n\n    n : node label       \n       A node in G\n\n    Returns\n    -------\n    comp : lists\n       A list of nodes in component of G containing node n.\n\n    See Also       \n    --------\n    connected_components\n\n    Notes\n    -----\n    For undirected graphs only. \n    '
    if G.is_directed():
        raise nx.NetworkXError('Not allowed for directed graph G.\n              Use UG=G.to_undirected() to create an undirected graph.')
    return list(nx.single_source_shortest_path_length(G, n).keys())

dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/components/connected.py node_connected_component/original