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.all_simple_paths#

all_simple_paths(graph, from_, to, min_depth=None, cutoff=None)[source]#

Return all simple paths between 2 nodes in a PyGraph object

A simple path is a path with no repeated nodes.

Parameters:
  • graph – The graph to find the path in. Can either be a class:~rustworkx.PyGraph or PyDiGraph

  • from (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