DP on a DAG
DP on a DAG
Introduction
Many dynamic programming problems can be represented as a directed acyclic graph (DAG).
- DAG vertices → subproblems / states
- DAG edges → transitions
Connection between DP and DAG
Subproblems = DAG vertices
In dynamic programming, a problem is broken down into subproblems.
Each subproblem corresponds to a state.
In a DAG:
Transitions = DAG edges
If from state you can move to state , then in the DAG there is an edge:
