Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.components.node_connected_component

node_connected_component(G, n)[source]

Return 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 – A set of nodes in the component of G containing node n.

Return type:

set

Raises:

NetworkXNotImplemented: – If G is directed.

Notes

For undirected graphs only.