Skip to main content
`Ctrl`+`K`

# node_connected_component

node_connected_component(G, n)

  Returns the set of nodes in the component of graph containing node n.

  Parameters:
    G NetworkX Graph

      An undirected graph.

    n node label

      A node in G

  Returns:
    comp set

      A set of nodes in the component of G containing node n.

  Raises:
    NetworkXNotImplemented

      If G is directed.

  See also

  `connected_components`

  Notes

  For undirected graphs only.

  Examples

      >>> G = nx.Graph([(0, 1), (1, 2), (5, 6), (3, 4)])
      >>> nx.node_connected_component(G, 0)  # nodes of component that contains node 0
      {0, 1, 2}