def node_connected_component(G,n):
    if G.is_directed():
        raise nx.NetworkXError("""Not allowed for directed graph G.
              Use UG=G.to_undirected() to create an undirected graph.""")
    return list(nx.single_source_shortest_path_length(G,n).keys())
Fix the pivot as the 1st element
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/components/connected.py/node_connected_component--crossover with--dataset/ETHPy150Open algorhythms/LintCode/Median.py/Solution.pivot