Running Time Assumption. All capacities are integers between and. Invariant. Every flow value f(e) and every residual capacities c f (e) remains an integer throughout the algorithm. Theorem. The algorithm terminates in at most v(f*) n iterations. Pf. Each augmentation increase value by at least. orollary. If =, Ford-Fulkerson runs in O(mn) time. Integrality theorem. If all capacities are integers, then there exists a max flow f for which every flow value f(e) is an integer. Pf. Since algorithm terminates, theorem follows from invariant.
7.3 hoosing Good Augmenting Paths
Ford-Fulkerson: Exponential Number of Augmentations Q. Is generic Ford-Fulkerson algorithm polynomial in input size? m, n, and log A. No. If max capacity is, then algorithm can take iterations. X0 0 X0 X0 s X 0 t s X0 X 0 t 0 X0 X0 X0 2 2 3
hoosing Good Augmenting Paths Use care when selecting augmenting paths. Some choices lead to exponential algorithms. lever choices lead to polynomial algorithms. If capacities are irrational, algorithm not guaranteed to terminate! Goal: choose augmenting paths so that: an find augmenting paths efficiently. Few iterations. hoose augmenting paths with: [Edmonds-Karp 972, Dinitz 970] Max bottleneck capacity. Sufficiently large bottleneck capacity. Fewest number of edges. 4
hoosing Shortest Augmenting Path Definition. d f (s,u) denotes the shortest path distance from s to u in residual graph G f. Lemma. d f (s,u) is monotonically increasing with each flow augmentation. Proof Strategy. onsider flow f which gets augmented to flow f. Assume for contradiction vertex v is the closest vertex to s for which d f (s,v) < d f (s,v). Let u precede v in the shortest path from s to t in G f. Edge (u,v) cannot be present in G f. Why? Edge (v,u) is present in a shortest path from s to t in G f. Why? d f (s,u) = d f (s,v) +. d f (s,v) = d f (s,u) +. d f (s,u) d f (s,u). The above three equations imply d f (s,v) = d f (s,u) + d f (s,u) + = d f (s,v) + 2. 5 hoose augmenting paths with: [Edmonds-Karp 972, Dinitz 970]
hoosing Shortest Augmenting Path Definition. Edge (u,v) is critical if c(u,v) in G f is the bottleneck capacity. Lemma 2. Edge (u,v) becomes critical at most V /2 times. Proof Strategy. Let edge (u,v) be a critical edge in G f. d f (s,v) = d f (s,u) +. For edge (u,v) to become critical again, there must be flow augmentation from v to u in some subsequent flow f. d f (s,u) = d f (s,v) +. d f (s,v) d f (s,v). The above three imply d f (s,u) = d f (s,v) + d f (s,v) = d f (s,u) +. 6
hoosing Good Augmenting Paths Use care when selecting augmenting paths. Some choices lead to exponential algorithms. lever choices lead to polynomial algorithms. If capacities are irrational, algorithm not guaranteed to terminate! Goal: choose augmenting paths so that: an find augmenting paths efficiently. Few iterations. hoose augmenting paths with: [Edmonds-Karp 972, Dinitz 970] Max bottleneck capacity. Sufficiently large bottleneck capacity. Fewest number of edges. 7
apacity Scaling Intuition. hoosing path with highest bottleneck capacity increases flow by max possible amount. Don't worry about finding exact highest bottleneck path. Maintain scaling parameter Δ. Let G f (Δ) be the subgraph of the residual graph consisting of only arcs with capacity at least Δ. 4 4 0 02 0 02 s t s t 22 70 22 70 2 2 G f G f (00) 8
apacity Scaling Scaling-Max-Flow(G, s, t, c) { foreach e E f(e) 0 Δ smallest power of 2 greater than or equal to G f residual graph } while (Δ ) { G f (Δ) Δ-residual graph while (there exists augmenting path P in G f (Δ)) { f augment(f, c, P) update G f (Δ) } Δ Δ / 2 } return f 9
apacity Scaling: orrectness Assumption. All edge capacities are integers between and. Integrality invariant. All flow and residual capacity values are integral. orrectness. If the algorithm terminates, then f is a max flow. Pf. By integrality invariant, when Δ = G f (Δ) = G f. Upon termination of Δ = phase, there are no augmenting paths. 0
apacity Scaling: Running Time Lemma. The outer while loop repeats + log 2 times. Pf. Initially Δ < 2. Δ decreases by a factor of 2 each iteration. Lemma 2. Let f be the flow at the end of a Δ-scaling phase. Then the value of the maximum flow is at most v(f) + m Δ. proof on next slide Lemma 3. There are at most 2m augmentations per scaling phase. Let f be the flow at the end of the previous scaling phase. L2 v(f*) v(f) + m (2Δ). Each augmentation in a Δ-phase increases v(f) by at least Δ. Theorem. The scaling max-flow algorithm finds a max flow in O(m log ) augmentations. It can be implemented to run in O(m 2 log ) time.
apacity Scaling: Running Time Lemma 2. Let f be the flow at the end of a Δ-scaling phase. Then value of the maximum flow is at most v(f) + m Δ. Pf. (almost identical to proof of max-flow min-cut theorem) We show that at the end of a Δ-phase, there exists a cut (A, B) such that cap(a, B) v(f) + m Δ. hoose A to be the set of nodes reachable from s in G f (Δ). By definition of A, s A. By definition of f, t A. A B t s original network 2