rustworkx.number_connected_components#

number_connected_components(graph, /)#

Find the number of connected components in an undirected graph.

Parameters:

graph (PyGraph) – The graph to find the number of connected components on.

Returns:

The number of connected components in the graph

Return type:

int