Chapter 7 Network Flow Slide by Kevin Wayne. Copyright 5 Pearon-Addion Weley. All right reerved.
Soviet Rail Network, 55 Reference: On the hitory of the tranportation and maximum flow problem. Alexander Schrijver in Math Programming, :,.
Maximum Flow and Minimum Cut Max flow and min cut. Two very rich algorithmic problem. Cornertone problem in combinatorial optimization. Beautiful mathematical duality. Nontrivial application / reduction. Data mining. Open-pit mining. Project election. Airline cheduling. Bipartite matching. Baeball elimination. Image egmentation. Network reliability. Ditributed computing. Egalitarian table matching. Security of tatitical data. Network intruion detection. Multi-camera cene recontruction. Many many more... Network connectivity.
Minimum Cut Problem Flow network. Abtraction for ubtance flowing through the edge. G = (V, E) = directed graph, no parallel edge. Two ditinguihed node: = ource, t = target. c(e) = capacity of edge e. 5 5 5 ource 5 t target capacity 5 5 7
Cut Def. An -t cut i a partition (A, B) of V with A and t B. Def. The capacity of a cut (A, B) i: cap( A, B) = c(e) e out of A 5 5 5 5 t A 5 5 7 Capacity = + 5 + 5 = 5
Cut Def. An -t cut i a partition (A, B) of V with A and t B. Def. The capacity of a cut (A, B) i: cap( A, B) = c(e) e out of A 5 5 5 5 t A 5 5 7 Capacity = + 5 + + =
Minimum Cut Problem Min -t cut problem. Find an -t cut of minimum capacity. 5 5 5 5 t A 5 5 7 Capacity = + + = 7
Flow Def. An -t flow i a function that atifie: For each e E: f (e) c(e) (capacity) For each v V {, t}: f (e) = f (e) (conervation) e in to v e out of v Def. The value of a flow f i: v( f ) = f (e) e out of. 5 5 5 5 t capacity 5 5 flow 7 Value =
Flow Def. An -t flow i a function that atifie: For each e E: f (e) c(e) (capacity) For each v V {, t}: f (e) = f (e) (conervation) e in to v e out of v Def. The value of a flow f i: v( f ) = f (e) e out of. 5 5 5 5 t capacity 5 5 flow 7 Value =
Maximum Flow Problem Max flow problem. Find -t flow of maximum value. 5 5 5 5 t capacity 5 5 flow 7 Value =
Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then, the net flow ent acro the cut i equal to the amount leaving. e out of A f (e) e in to A f (e) = v( f ) 5 5 5 5 t A 5 5 7 Value =
Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then, the net flow ent acro the cut i equal to the amount leaving. e out of A f (e) e in to A f (e) = v( f ) 5 5 5 5 t A 5 5 7 Value = + + - + =
Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -t cut. Then, the net flow ent acro the cut i equal to the amount leaving. e out of A f (e) e in to A f (e) = v( f ) 5 5 5 5 t A 5 5 7 Value = - + - + =
Flow and Cut Flow value lemma. Let f be any flow, and let (A, B) be any -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 by flow conervation, all term except v = are = v ( f (e) f (e) ) A e out of v e in to v = f (e) e out of A f (e). e in to A
Flow and Cut Weak duality. Let f be any flow, and let (A, B) be any -t cut. Then the value of the flow i at mot the capacity of the cut. Cut capacity = Flow value 5 5 5 5 t A 5 5 7 Capacity = 5
Flow and Cut Weak duality. Let f be any flow. Then, for any -t cut (A, B) we have v(f) cap(a, B). Pf. v( f ) = f (e) e out of A e out of A f (e) c(e) e out of A = cap(a, B) e in to A f (e) A 7 B t
Certificate of Optimality Corollary. Let f be any flow, and let (A, B) be any cut. If v(f) = cap(a, B), then f i a max flow and (A, B) i a min cut. Value of flow = Cut capacity = Flow value 5 5 5 5 t A 5 5 7 7
Toward a Max Flow Algorithm Greedy algorithm. Start with f(e) = for all edge e E. Find an -t path P where each edge ha f(e) < c(e). Augment flow along path P. Repeat until you get tuck. t Flow value =
Toward a Max Flow Algorithm Greedy algorithm. Start with f(e) = for all edge e E. Find an -t path P where each edge ha f(e) < c(e). Augment flow along path P. Repeat until you get tuck. X X t X Flow value =
Toward a Max Flow Algorithm Greedy algorithm. Start with f(e) = for all edge e E. Find an -t path P where each edge ha f(e) < c(e). Augment flow along path P. Repeat until you get tuck. locally optimality global optimality t t greedy = opt =
Reidual Graph Original edge: e = (u, v) E. capacity Flow f(e), capacity c(e). u 7 v flow Reidual edge. "Undo" flow ent. e = (u, v) and e R = (v, u). reidual capacity Reidual capacity: u v c f (e) = { c(e)-f(e) if e E reidual capacity f(e R ) if e R E Reidual graph: G f = (V, E f ). Reidual edge with poitive reidual capacity. E f = {e : f(e) < c(e)} {e R : f(e) > }.
Ford-Fulkeron Algorithm G: capacity 5 t
Ford-Fulkeron Algorithm G: flow capacity 5 t Flow value =
Ford-Fulkeron Algorithm G: X X flow capacity X 5 t Flow value = G f : reidual capacity 5 t
Ford-Fulkeron Algorithm G: X X X X 5 t Flow value = G f : 5 t 5
Ford-Fulkeron Algorithm G: X X X X 5 t Flow value = G f : 7 5 t
Ford-Fulkeron Algorithm G: X X X X 5 t Flow value = G f : 5 t 7
Ford-Fulkeron Algorithm X G: X 7 X X X 5 t Flow value = G f : 5 t
Ford-Fulkeron Algorithm G: 7 5 t Flow value = G f : 7 5 t
Ford-Fulkeron Algorithm G: 7 5 t Cut capacity = Flow value = G f : 7 5 t
Augmenting Path Algorithm Augment(f, c, P) { b bottleneck(p,c,f) foreach e P { } if (e E) f(e) f(e) + b ele f(e R ) f(e R ) - b } return f min reidual capacity of edge on P forward edge revere edge Ford-Fulkeron(G,, t, c) { foreach e E f(e) G f reidual graph } while (there exit augmenting path P in G f ) { f Augment(f, c, P) update G f (along path P) } return f
Max-Flow Min-Cut Theorem Augmenting path theorem. Flow f i a max flow iff there are no augmenting path. Max-flow min-cut theorem. [Ford-Fulkeron 5] The value of the max flow i equal to the value of the min cut. Proof trategy. We prove both imultaneouly by howing the following are equivalent: (i) There exit a cut (A, B) uch that v(f) = cap(a, B). (ii) Flow f i a max flow. (iii) There i no augmenting path relative to f. (i) (ii) Thi wa the corollary to weak duality lemma. (ii) (iii) We how contrapoitive: Let f be a flow. If there exit an augmenting path, then we can improve f by ending flow along path.
Proof of Max-Flow Min-Cut Theorem (iii) (i) Let f be a flow with no augmenting path. Let A be et of vertice reachable from in reidual graph. By definition of A, A. By definition of G f, t A. v( f ) = f (e) e out of A = c(e) e out of A = cap(a, B) e in to A f (e) (otherwie connect outide A) A B t original network
Running Time Aumption. All capacitie are integer between and C. Invariant. Every flow value f(e) and every reidual capacitie c f (e) remain an integer throughout the algorithm. Theorem. The algorithm terminate in at mot v(f*) nc iteration. Pf. Each augmentation increae value by at leat. Corollary. If C =, Ford-Fulkeron run in O(mn) time. Integrality theorem. If all capacitie are integer, then there exit a max flow f for which every flow value f(e) i an integer. Pf. Since algorithm terminate, theorem follow from invariant.
7. Chooing Good Augmenting Path
Ford-Fulkeron: Exponential Number of Augmentation Q. I generic Ford-Fulkeron algorithm polynomial in input ize? m, n, and log C A. No. If C=larget capacity, then algorithm can take C iteration. X C C X X C C t X X X t C C X C iteration C C X X
Chooing Good Augmenting Path Ue care when electing augmenting path. Some choice lead to exponential algorithm. Clever choice lead to polynomial algorithm. If capacitie are irrational, algorithm not guaranteed to terminate! Goal: chooe augmenting path o that: Can find augmenting path efficiently. Few iteration. Chooe augmenting path with: [Edmond-Karp 7, Dinitz 7] Max bottleneck capacity. Sufficiently large bottleneck capacity. Fewet number of edge. 7
Capacity Scaling Intuition. Chooing path with highet bottleneck capacity increae flow by max poible amount. Don't worry about finding exact highet bottleneck path. Maintain caling parameter Δ. Let G f (Δ) be the ubgraph of the reidual graph coniting of only edge with capacity at leat Δ. t t 7 7 G f G f ()
Capacity Scaling Scaling-Max-Flow(G,, t, c, C) { foreach e E f(e) Δ larget power of C G f reidual graph } while (Δ ) { G f (Δ) Δ-reidual graph while (there exit augmenting path P in G f (Δ)) { f augment(f, c, P) update G f (Δ) (along P) } Δ Δ / } return f
Ford-Fulkeron Algorithm G: flow capacity 5 t Flow value =
Ford-Fulkeron Algorithm with Capacity Scaling G: flow capacity 5 t Flow value = Δ = G f : reidual capacity 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: X X flow capacity X 5 t Flow value = G f (): reidual capacity 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f : 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f (): 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: X X X X 5 t Flow value = G f (): 5 t 5
Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f : 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: 5 t Flow value = Δ = G f (): 5 t 7
Ford-Fulkeron Algorithm with Capacity Scaling X G: X 5 X X X 5 t Flow value = G f (): 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: 5 5 t Flow value = 7 Δ = G f : 5 5 t
Ford-Fulkeron Algorithm with Capacity Scaling G: X X5 7 X 5 t Flow value = 7 G f (): 5 5 t 5
Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Flow value = Δ = G f : 7 5 t 5
Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Flow value = Δ = G f (): 7 5 t 5
Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Flow value = G f (): 7 5 t 5
Ford-Fulkeron Algorithm with Capacity Scaling G: 7 5 t Cut capacity = Flow value = G f (): 7 5 t A = {vertice reachable from in G f ()} 5
Capacity Scaling: Correctne Aumption. All edge capacitie are integer between and C. Integrality invariant. All flow and reidual capacity value are integral. Correctne. If the algorithm terminate, then f i a max flow. Pf. By integrality invariant, when Δ = G f (Δ) = G f. Upon termination of Δ = phae, there are no augmenting path. 55
Capacity Scaling: Running Time Lemma. Let f be the flow at the end of a Δ-caling phae. Then the value of the maximum flow i at mot v(f) + m Δ. Pf. (almot identical to proof of max-flow min-cut theorem) We how that at the end of a Δ-phae, there exit a cut (A, B) uch that cap(a, B) v(f) + m Δ. Chooe A to be the et of node reachable from in G f (Δ). By definition of A, A. By definition of G f (Δ), t A. v( f ) = f (e) e out of A (c(e) e out of A = c(e) e in to A Δ) f (e) e in to A e out of A e out of A e in to A cap(a, B) - m Δ Δ Δ Δ A B t original network 5
Capacity Scaling: Running Time Lemma. The outer while loop repeat + log C time. Pf. Initially C/ < Δ C < Δ. Δ decreae by a factor of each iteration. Lemma. Let f be the flow at the end of a Δ-caling phae. Then the value of the maximum flow i at mot v(f) + m Δ. proof on previou lide Lemma. There are at mot m augmentation per caling phae. Pf. Initially, each of the m edge can carry at mot C<Δ flow. In general, conider the ituation at the beginning of a Δ-phae. Each augmentation in a Δ-phae will increae v(f) by at leat Δ. Let f be the flow at the end of the previou caling (Δ-)phae. Lemma v(f*) v(f) + m (Δ). Theorem. The caling max-flow algorithm find a max flow in O(m log C) augmentation. It can be implemented to run in O(m log C) time. 57
Chapter 7 Network Flow Slide by Kevin Wayne. Copyright 5 Pearon-Addion Weley. All right reerved. 5