Warning
The documentation for retworkx has migrated to:
https://qiskit.org/documentation/retworkx
These docs will no longer be updated.
retworkx.dag_longest_path¶
- dag_longest_path(graph, /)¶
Find the longest path in a DAG
- Parameters
graph (PyDiGraph) – The graph to find the longest path on. The input object must be a DAG without a cycle.
- Returns
The node indices of the longest path on the DAG
- Return type
- Raises
Exception – If an unexpected error occurs or a path can’t be found
DAGHasCycle – If the input PyDiGraph has a cycle