Warning

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

networkx.algorithms.components.is_weakly_connected

is_weakly_connected(G)[source]

Test directed graph for weak connectivity.

A directed graph is weakly connected if and only if the graph is connected when the direction of the edge between nodes is ignored.

Note that if a graph is strongly connected (i.e. the graph is connected even when we account for directionality), it is by definition weakly connected as well.

Parameters

G (NetworkX Graph) – A directed graph.

Returns

connected – True if the graph is weakly connected, False otherwise.

Return type

bool

Raises

NetworkXNotImplemented: – If G is undirected.

Notes

For directed graphs only.