input: a directed graph G=(V,E) with edge costs c, a source vertex s, and a destination vertex t
goal: find the minimum-cost path from s to t
primal: ("embedding on a line")
Use a variable d(v) for each vertex v ∈ E.
prove: the cost of any feasible solution is a lower bound on the cost of the shortest path.
prove: the solution given by d(v) = shortest path distance from s to v is feasible, and therefore optimal.
dual: (min-cost flow of one unit from s to t)
Use a variable f(e) for each edge e in E.
A "flow on a path" is a feasible solution that sends 1 unit of flow on a single path.
prove: any feasible solution is a weighted combination of flows on paths, where the sum of the weights is 1.
prove: for any feasible solution f, there is a path of cost at most cost(f) = ∑u,v c(u,v) f(u,v).
Caution: the constraints in the dual above are equality constraints rather than inequalities because the corresponding variable in the primal is not restricted to be non-negative. This is true in general: if, in the primal linear program, a constraint is an equality constraint, then the corresponding variable in the primal will not be constrained to be non-negative. Likewise, if a variable in the primal is not constrained to be non-negative, then the corresponding constraint in the dual will be an equality constraint. One way to understand this is to work carefully through the reasoning behind weak duality, and consider what role the non-negativivity of the variables plays.