rustworkx.graph_all_simple_paths#

graph_all_simple_paths(graph, origin, to, /, min_depth=None, cutoff=None)#

Return all simple paths between 2 nodes in a PyGraph object

A simple path is a path with no repeated nodes.

Parameters:
  • graph (PyGraph) – The graph to find the path in

  • origin (int) – The node index to find the paths from

  • to (int) – The node index to find the paths to

  • min_depth (int) – The minimum depth of the path to include in the output list of paths. By default all paths are included regardless of depth, setting to 0 will behave like the default.

  • cutoff (int) – The maximum depth of path to include in the output list of paths. By default includes all paths regardless of depth, setting to 0 will behave like default.

Returns:

A list of lists where each inner list is a path of node indices

Return type:

list