Soviet Rail Network, 1955 Reference: On the history of the transportation and maximum flow problems . Alexander Schrijver in Math Programming, 91: 3, 2002. 2
Maximum Flow and Minimum Cut Max flow and min cut. Two very rich algorithmic problems. Cornerstone problems in combinatorial optimization. Beautiful mathematical duality. Nontrivial applications / reductions. Data mining. Network reliability. Open-pit mining. Distributed computing. Project selection. Egalitarian stable matching. Airline scheduling. Security of statistical data. Bipartite matching. Network intrusion detection. Baseball elimination. Multi-camera scene reconstruction. Image segmentation. Many many more . . . Network connectivity. 3
Minimum Cut Problem Flow network. Abstraction for material flowing through the edges. G = (V, E) = directed graph, no parallel edges. Two distinguished nodes: s = source, t = sink. c(e) = capacity of edge e. 9 2 5 10 15 15 10 4 source 5 sink 8 10 s 3 6 t 15 4 6 10 15 capacity 30 4 7 4
Cuts Def. An s-t cut is a partition (A, B) of V with s ∈ A and t ∈ B. Def. The capacity of a cut (A, B) is: cap ( A , B ) = c ( e ) ∑ e out of A 9 2 5 10 15 15 10 4 5 8 10 s 3 6 t A 15 4 6 10 15 Capacity = 10 + 5 + 15 = 30 30 4 7 5
Cuts Def. An s-t cut is a partition (A, B) of V with s ∈ A and t ∈ B. Def. The capacity of a cut (A, B) is: cap ( A , B ) = c ( e ) ∑ e out of A 9 2 5 10 15 15 10 4 5 8 10 s 3 6 t A 15 4 6 10 15 Capacity = 9 + 15 + 8 + 30 = 62 30 4 7 6
Minimum Cut Problem Min s-t cut problem. Find an s-t cut of minimum capacity. 9 2 5 10 15 15 10 4 5 8 10 s 3 6 t 15 4 6 10 A 15 Capacity = 10 + 8 + 10 = 28 30 4 7 7
Flows Def. An s-t flow is a function that satisfies: For each e ∈ E: (capacity) 0 ≤ f ( e ) ≤ c ( e ) For each v ∈ V – {s, t}: (conservation) f ( e ) f ( e ) = ∑ ∑ e in to v e out of v Def. The value of a flow f is: v ( f ) = f ( e ) . ∑ e out of s 0 9 2 5 4 0 0 10 15 15 0 10 4 4 0 4 4 5 8 10 s 3 6 t 0 0 15 0 0 4 6 10 capacity 15 flow 0 0 Value = 4 30 4 7 8
Flows Def. An s-t flow is a function that satisfies: For each e ∈ E: (capacity) 0 ≤ f ( e ) ≤ c ( e ) For each v ∈ V – {s, t}: (conservation) f ( e ) f ( e ) = ∑ ∑ e in to v e out of v Def. The value of a flow f is: v ( f ) = f ( e ) . ∑ e out of s 6 9 2 5 10 6 0 10 15 15 0 10 4 4 3 8 8 5 8 10 s 3 6 t 1 10 15 0 0 4 6 10 capacity 15 flow 11 11 Value = 24 30 4 7 9
Maximum Flow Problem Max flow problem. Find s-t flow of maximum value. 9 9 2 5 10 9 1 10 15 15 0 10 0 4 4 9 8 5 8 10 s 3 6 t 4 10 15 0 0 4 6 10 capacity 15 flow 14 14 Value = 28 30 4 7 10
Flows and Cuts Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s. f ( e ) f ( e ) = v ( f ) − ∑ ∑ e out of A e in to A 6 9 2 5 10 6 0 10 15 15 0 10 4 4 3 8 8 5 8 10 s 3 6 t A 1 10 15 0 0 4 6 10 15 11 11 Value = 24 30 4 7 11
Flows and Cuts Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s. f ( e ) f ( e ) = v ( f ) − ∑ ∑ e out of A e in to A 6 9 2 5 10 6 0 10 15 15 0 10 4 4 3 8 8 5 8 10 s 3 6 t A 1 10 15 0 0 4 6 10 15 11 11 Value = 6 + 0 + 8 - 1 + 11 = 24 30 4 7 12
Flows and Cuts Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s. f ( e ) f ( e ) = v ( f ) − ∑ ∑ e out of A e in to A 6 9 2 5 10 6 0 10 15 15 0 10 4 4 3 8 8 5 8 10 s 3 6 t A 1 10 15 0 0 4 6 10 15 11 11 Value = 10 - 4 + 8 - 0 + 10 = 24 30 4 7 13
Flows and Cuts Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then f ( e ) f ( e ) = v ( f ) − . ∑ ∑ e out of A e in to A Pf. v ( f ) f ( e ) = ∑ e out of s f ( e ) − f ( e ) by flow conservation, all terms = ∑ ∑ ∑ except v = s are 0 v ∈ A e out of v e in to v f ( e ) − f ( e ). = ∑ ∑ e out of A e in to A 14
Flows and Cuts Weak duality. Let f be any flow, and let (A, B) be any s-t cut. Then the value of the flow is at most the capacity of the cut. Cut capacity = 30 ⇒ Flow value ≤ 30 9 2 5 10 15 15 10 4 5 8 10 s 3 6 t A 15 4 6 10 15 Capacity = 30 30 4 7 15
Flows and Cuts Weak duality. Let f be any flow. Then, for any s-t cut (A, B) we have v(f) ≤ cap(A, B). Pf. A B 4 v ( f ) f ( e ) f ( e ) = − ∑ ∑ 8 t e out of A e in to A f ( e ) ≤ ∑ e out of A c ( e ) ≤ ∑ s e out of A 7 ▪ cap( A , B ) = 6 16
Certificate of Optimality Corollary. Let f be any flow, and let (A, B) be any cut. If v(f) = cap(A, B), then f is a max flow and (A, B) is a min cut. Value of flow = 28 Cut capacity = 28 ⇒ Flow value ≤ 28 9 9 2 5 10 9 1 10 15 15 0 10 0 4 4 9 8 5 8 10 s 3 6 t 4 10 15 0 A 0 4 6 10 15 14 14 30 4 7 17
Towards a Max Flow Algorithm Greedy algorithm. Start with f(e) = 0 for all edge e ∈ E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck. 1 0 0 20 10 30 0 s t 10 20 Flow value = 0 0 0 2 18
Towards a Max Flow Algorithm Greedy algorithm. Start with f(e) = 0 for all edge e ∈ E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck. 1 X 20 0 0 20 10 X 30 0 20 s t 10 20 Flow value = 20 X 0 0 20 2 19
Towards a Max Flow Algorithm Greedy algorithm. Start with f(e) = 0 for all edge e ∈ E. Find an s-t path P where each edge has f(e) < c(e). Augment flow along path P. Repeat until you get stuck. locally optimality ⇒ global optimality 1 1 20 0 20 10 20 10 20 10 t t s s 30 20 30 10 10 20 10 20 0 20 10 20 2 2 greedy = 20 opt = 30 20
Residual Graph Original edge: e = (u, v) ∈ E. capacity Flow f(e), capacity c(e). u v 17 6 flow Residual edge. "Undo" flow sent. residual capacity e = (u, v) and e R = (v, u). u v Residual capacity: 11 6 c f ( e ) = c ( e ) − f ( e ) if e ∈ E residual capacity if e R ∈ E f ( e ) Residual graph: G f = (V, E f ). Residual edges with positive residual capacity. E f = {e : f(e) < c(e)} ∪ {e R : c(e) > 0}. 21
Ford-Fulkerson Algorithm 4 2 4 capacity G: 6 8 10 10 2 10 s 3 5 10 t 9 22
Augmenting Path Algorithm Augment(f, c, P) { b ← bottleneck(P) foreach e ∈ P { forward edge if (e ∈ E) f(e) ← f(e) + b reverse edge else f(e R ) ← f(e) - b } return f } Ford-Fulkerson(G, s, t, c) { foreach e ∈ E f(e) ← 0 G f ← residual graph while (there exists augmenting path P) { f ← Augment(f, c, P) update G f } return f } 23
Max-Flow Min-Cut Theorem Augmenting path theorem. Flow f is a max flow iff there are no augmenting paths. Max-flow min-cut theorem. [Ford-Fulkerson 1956] The value of the max flow is equal to the value of the min cut. Proof strategy. We prove both simultaneously by showing the TFAE: (i) There exists a cut (A, B) such that v(f) = cap(A, B). (ii) Flow f is a max flow. (iii) There is no augmenting path relative to f. (i) ⇒ (ii) This was the corollary to weak duality lemma. (ii) ⇒ (iii) We show contrapositive. Let f be a flow. If there exists an augmenting path, then we can improve f by sending flow along path. 24
Proof of Max-Flow Min-Cut Theorem (iii) ⇒ (i) Let f be a flow with no augmenting paths. Let A be set of vertices reachable from s in residual graph. By definition of A, s ∈ A. By definition of f, t ∉ A. v ( f ) f ( e ) f ( e ) = − ∑ ∑ A e out of A e in to A B c ( e ) = ∑ t e out of A cap ( A , B ) = s original network 25
Running Time Assumption. All capacities are integers between 1 and C. 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*) ≤ nC iterations. Pf. Each augmentation increase value by at least 1. ▪ Corollary. If C = 1, 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. ▪ 26
7.3 Choosing Good Augmenting Paths
Ford-Fulkerson: Exponential Number of Augmentations Q. Is generic Ford-Fulkerson algorithm polynomial in input size? m, n, and log C A. No. If max capacity is C, then algorithm can take C iterations. 1 1 X X 1 X 0 0 0 0 1 1 C C C C X 1 X X s t s 0 t 1 0 1 0 1 C C C C X X X 0 0 1 0 0 1 1 2 2 28
Recommend
More recommend