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_strongly_connected#

is_strongly_connected(graph, /)#

Check if a directed graph is strongly connected

A strongly connected component (SCC) is a maximal subset of vertices such that every vertex is reachable from every other vertex within that subset.

>>> G = rx.PyDiGraph()
>>> G.extend_from_edge_list([(0, 1), (1, 2), (3, 4)])
>>> rx.is_strongly_connected(G)
False

See also [is_weakly_connected] and [is_semi_connected].

If rx.is_strongly_connected(G) is True then rx.number_strongly_connected_components(G) == 1`.

For undirected graphs see [is_connected].

Parameters:

graph (PyGraph) – An undirected graph to check for strong connectivity

Returns:

Whether the graph is strongly connected or not

Return type:

bool

Raises:

NullGraph – If an empty graph is passed in