Warning
The documentation for retworkx has migrated to:
https://qiskit.org/documentation/retworkx
These docs will no longer be updated.
retworkx.dag_longest_path_length¶
- dag_longest_path_length(graph, /)¶
Find the length of 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 longest path length on the DAG
- Return type
int
- Raises
Exception – If an unexpected error occurs or a path can’t be found
DAGHasCycle – If the input PyDiGraph has a cycle