Warning
The documentation for retworkx has migrated to:
https://qiskit.org/documentation/retworkx
These docs will no longer be updated.
retworkx.all_simple_paths¶
- all_simple_paths(graph, from_, to, min_depth=None, cutoff=None)[source]¶
- all_simple_paths(graph: retworkx.PyDiGraph, from_, to, min_depth=None, cutoff=None)
- all_simple_paths(graph: retworkx.PyGraph, from_, 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 – The graph to find the path in. Can either be a class:~retworkx.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