NetworkX

Previous topic

networkx.algorithms.components.attracting.attracting_component_subgraphs

Next topic

networkx.algorithms.components.connected.number_connected_components

networkx.algorithms.components.connected.is_connected

is_connected(G)

Test graph connectivity

Parameters:

G : NetworkX Graph

An undirected graph.

Returns:

connected : bool

True if the graph is connected, false otherwise.

Notes

For undirected graphs only.

Examples

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