Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
rustworkx.is_weakly_connected#
- is_weakly_connected(graph, /)#
Check if a directed graph is weakly connected
A directed graph is considered weakly connected if there is a path between every pair of vertices when the direction of edges is ignored. This means that if you treat the directed graph as an undirected graph, all vertices in a weakly connected graph are reachable from one another.
>>> G = rx.PyDiGraph() >>> G.extend_from_edge_list([(0, 1), (1, 2), (3, 4)]) >>> rx.is_weakly_connected(G) False
See also [is_semi_connected].
If
rx.is_weakly_connected(G) is True
then rx.number_weakly_connected_components(G) == 1`.For undirected graphs see [is_connected].