Quiz
DP on Graphs and DAG Ordering
Understand why dynamic programming on graphs requires an acyclic dependency structure and topological ordering.
You want to compute the longest path (by edge count) between any two nodes using dynamic programming with memoization: dp[v] = 1 + max(dp[u]) over edges v→u. For which class of graphs is this DP formulation guaranteed to be both correct and polynomial-time?