Successive Shortest Paths for Min-Cost Flow
The Successive Shortest Paths (SSP) algorithm solves the min-cost flow problem by repeatedly finding the cheapest augmenting path in the residual graph (using Bellman-Ford, since residual costs can be negative), pushing as much flow as possible along it, and updating the residual graph until the demand is met.
Tutorial
The Successive Shortest Paths Algorithm
The min-cost flow problem: given a network with edge capacities and edge costs , ship units of flow from a source to a sink at minimum total cost.
The Successive Shortest Paths (SSP) algorithm builds the optimal flow one path at a time:
- Initialize on every edge.
- While
- Find a minimum-cost - path in the residual graph
- Let where is the residual capacity of edge
- Push units along the total cost increases by where
- Update
If at some iteration no - path exists in the demand is infeasible.
Residual graphs can contain negative-cost edges (introduced when previously-pushed flow is reversed), so shortest paths are computed with Bellman-Ford rather than Dijkstra.
On the first iteration the residual graph equals the original network, so we just enumerate the directed - paths and pick the cheapest. The maximum amount we can push along it is the smallest capacity on the path -- the bottleneck.
For instance, in the network with edges
there are two - paths:
- cost bottleneck
- cost bottleneck
The cheapest is along which we can push at most units.