Skip to main content

dag_longest_path

Function dag_longest_path 

Source
pub fn dag_longest_path(digraph: &DiGraph) -> Option<Vec<String>>
Expand description

Return the longest path in a DAG.

Uses dynamic programming on topological order: for each node, compute the longest path ending at that node. Matches networkx.dag_longest_path(G).

Returns None if the graph has a cycle.