Skip to main content
`Ctrl`+`K`

# is_connected

is_connected(G)

  Returns True if the graph is connected, False otherwise.

  Parameters:
    G NetworkX Graph

      An undirected graph.

  Returns:
    connected bool

      True if the graph is connected, false otherwise.

  Raises:
    NetworkXNotImplemented

      If G is directed.

  See also

  `is_strongly_connected`
  `is_weakly_connected`
  `is_semiconnected`
  `is_biconnected`
  `connected_components`

  Notes

  For undirected graphs only.

  Examples

      >>> G = nx.path_graph(4)
      >>> print(nx.is_connected(G))
      True