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.connected_subgraphs#
- connected_subgraphs(graph, k, /)#
Return all the connected subgraphs (as a list of node indices) with exactly k nodes
- Parameters:
graph (PyGraph) – The graph to find all connected subgraphs in
k (int) – The maximum number of nodes in a returned connected subgraph.
- Returns:
A list of connected subgraphs with k nodes, represented by their node indices
- Raises:
ValueError – If
k
is larger than the number of nodes ingraph