Algorithm Search⌘K

Proofs: Successive shortest path algorithm

These are the human proofs of Successive shortest path algorithm, at full length.

The successive shortest path algorithm returns a cheapest flow of the requested value full

This proof shows: correctness, termination.

Setting. G=(V,E)G = (V, E) is a directed graph with integer capacities u(e)≥0u(e) \ge 0, real costs c(e)c(e), a source ss, a sink t≠st \ne s, and a target d∈Z≥0∪{∞}d \in \mathbb{Z}_{\ge 0} \cup \{\infty\}. The edges of positive capacity contain no cycle of negative cost. For a flow xx, the residual graph GxG_x has, for each edge e=(v,w)e = (v, w), a forward edge (v,w)(v, w) with capacity u(e)−x(e)u(e) - x(e) and cost c(e)c(e), and a backward edge (w,v)(w, v) with capacity x(e)x(e) and cost −c(e)-c(e); only edges of positive capacity are present. For potentials π\pi, the reduced cost of a residual edge r=(v,w)r = (v, w) is cπ(r)=c(r)+π(v)−π(w)c^{\pi}(r) = c(r) + \pi(v) - \pi(w). Let R(x)R(x) be the set of vertices that ss reaches in GxG_x.

Lemma 1 (potentials cancel on cycles). For every directed cycle CC, ∑r∈Ccπ(r)=∑r∈Cc(r)\sum_{r \in C} c^{\pi}(r) = \sum_{r \in C} c(r).

Proof. Each vertex of CC is the tail of one edge of CC and the head of one, so the terms π(v)−π(w)\pi(v) - \pi(w) sum to 0. □\square

Lemma 2 (negative cycle optimality). A flow xx of value kk is a cheapest flow of value kk if GxG_x has no cycle of negative cost.

Proof. Let x′x' be a flow of value kk. For each edge put x′(e)−x(e)x'(e) - x(e) on its forward residual edge if this is positive, and x(e)−x′(e)x(e) - x'(e) on its backward residual edge otherwise. The result hh respects the residual capacities. Both flows have value kk and satisfy conservation, so hh is conserved at every vertex, including ss and tt: it is a circulation in GxG_x, with cost c(x′)−c(x)c(x') - c(x). A circulation is a nonnegative sum of flows around directed cycles of its support, which are cycles of GxG_x. Each has cost at least 0, so c(x′)≥c(x)c(x') \ge c(x). □\square

Lemma 3 (the start). After line L2, cπ(e)≥0c^{\pi}(e) \ge 0 for every edge ee of positive capacity, and the zero flow is a cheapest flow of value 0.

Proof. With no negative cycle, Bellman-Ford from the root returns shortest distances π\pi, and π(w)≤π(v)+c(v,w)\pi(w) \le \pi(v) + c(v, w) for each edge (v,w)(v, w) that it uses, which is cπ(v,w)≥0c^{\pi}(v, w) \ge 0. At x=0x = 0 the residual graph has exactly these edges, so by Lemma 1 it has no negative cycle, and Lemma 2 applies. □\square

Invariant. Before each round: (a) cπ(r)≥0c^{\pi}(r) \ge 0 for each residual edge rr of GxG_x whose tail is in R(x)R(x); (b) GxG_x has no cycle of negative cost; (c) xx is a cheapest flow of its value.

It holds at the start by Lemma 3; (a) holds for all edges then.

It is preserved. Let dist\mathrm{dist} be the distances of line L4, which are correct because Dijkstra only scans edges with tails in R(x)R(x), whose lengths are nonnegative by (a). Let π′=π+dist\pi' = \pi + \mathrm{dist} on R(x)R(x) and π′=π\pi' = \pi elsewhere. For a residual edge r=(v,w)r = (v, w) with v∈R(x)v \in R(x), also w∈R(x)w \in R(x), and dist(w)≤dist(v)+cπ(r)\mathrm{dist}(w) \le \mathrm{dist}(v) + c^{\pi}(r), so cπ′(r)=cπ(r)+dist(v)−dist(w)≥0c^{\pi'}(r) = c^{\pi}(r) + \mathrm{dist}(v) - \mathrm{dist}(w) \ge 0. For the edges of the shortest path PP equality holds, so cπ′(r)=0c^{\pi'}(r) = 0 on PP. Let x′x' be the flow after line L8. Each residual edge of Gx′G_{x'} is either a residual edge of GxG_x or the reverse of an edge of PP, which has reduced cost −0=0-0 = 0. The new reverse edges join vertices of R(x)R(x), and the other edges were already there, so R(x′)⊆R(x)R(x') \subseteq R(x). Hence every edge of Gx′G_{x'} with tail in R(x′)R(x') has cπ′≥0c^{\pi'} \ge 0, which is (a).

For (b), take a cycle CC of Gx′G_{x'}. Each edge of CC is either an edge of GxG_x or the reverse of an edge of PP. Case 1: CC has a vertex in R(x)R(x). An edge of GxG_x with tail in R(x)R(x) has its head in R(x)R(x), and a reversed edge has both ends in R(x)R(x); so, walking around CC, every vertex of CC is in R(x)R(x). Then every edge of CC has cπ′≥0c^{\pi'} \ge 0 by the computation above, and by Lemma 1 the cost of CC is at least 0. Case 2: CC has no vertex in R(x)R(x). Then CC uses no reversed edge, so it is a cycle of GxG_x, and its cost is at least 0 by (b) for xx.

(c) follows from (b) by Lemma 2. □\square

Lemma 4 (termination). The loop runs at most min⁡(d,f∗)\min(d, f^{*}) rounds when this is finite, and stops with value min⁡(d,f∗)\min(d, f^{*}), where f∗f^{*} is the maximum flow value.

Proof. Capacities are integers, so by induction the flow and the residual capacities stay integral and each δ\delta is a positive integer, because d−value≥1d - \mathrm{value} \ge 1 inside the loop. The value grows by at least 1 per round and never exceeds dd or f∗f^{*}. The loop stops when the value reaches dd, or when t∉R(x)t \notin R(x); in the second case GxG_x has no ss-tt path, so xx is a maximum flow by the max-flow min-cut theorem. f∗f^{*} is finite, because f∗≤∑e out of su(e)f^{*} \le \sum_{e \text{ out of } s} u(e). □\square

Theorem. The algorithm returns a flow of value min⁡(d,f∗)\min(d, f^{*}) that has the least cost among all flows of that value.

Proof. By Lemma 4 it stops with that value, and by part (c) of the invariant the flow is a cheapest one of its value. ■\blacksquare

Back to Successive shortest path algorithm