Connectivity and Cycles#

rustworkx.number_connected_components(graph, /)

Find the number of connected components in an undirected graph.

rustworkx.connected_components(graph, /)

Find the connected components in an undirected graph

rustworkx.node_connected_component(graph, ...)

Returns the set of nodes in the component of graph containing node.

rustworkx.is_connected(graph, /)

Check if the graph is connected.

rustworkx.strongly_connected_components(graph, /)

Compute the strongly connected components for a directed graph


Find the number of weakly connected components in a directed graph

rustworkx.weakly_connected_components(graph, /)

Find the weakly connected components in a directed graph

rustworkx.is_weakly_connected(graph, /)

Check if the graph is weakly connected

rustworkx.cycle_basis(graph, /[, root])

Return a list of cycles which form a basis for cycles of a given PyGraph

rustworkx.simple_cycles(graph, /)

Find all simple cycles of a PyDiGraph

rustworkx.digraph_find_cycle(graph, /[, source])

Return the first cycle encountered during DFS of a given PyDiGraph, empty list is returned if no cycle is found

rustworkx.articulation_points(graph, /)

Return the articulation points of an undirected graph.

rustworkx.bridges(graph, /)

Return the bridges of an undirected graph.

rustworkx.biconnected_components(graph, /)

Return the biconnected components of an undirected graph.

rustworkx.chain_decomposition(graph, /[, source])

Returns the chain decomposition of a graph.

rustworkx.all_simple_paths(graph, from_, to)

Return all simple paths between 2 nodes in a PyGraph object


Return all the simple paths between all pairs of nodes in the graph

rustworkx.stoer_wagner_min_cut(graph, /[, ...])

Compute a weighted minimum cut using the Stoer-Wagner algorithm.


Return a longest simple path in the graph


Determine if a given graph is bipartite


Return a list of isolates in a graph object

rustworkx.has_path(graph, source, target[, ...])

Checks if a path exists between a source and target node

rustworkx.connected_subgraphs(graph, k, /)

Return all the connected subgraphs (as a list of node indices) with exactly k nodes