Algorihm Deign and Analyi LECTURES 17 Nework Flow Dualiy of Max Flow and Min Cu Algorihm: Ford-Fulkeron Capaciy Scaling Sofya Rakhodnikova S. Rakhodnikova; baed on lide by E. Demaine, C. Leieron, A. Smih, K. Wayne L17.1
Nework Flow S. Rakhodnikova; baed on lide by E. Demaine, C. Leieron, A. Smih, K. Wayne L17.
Minimum Cu Problem Flow nework. Abracion for maerial flowing hrough he edge. G = (V, E) = direced graph, no parallel edge. Two diinguihed node: = ource, = ink. c(e) = capaciy of edge e. 9 ource 3 8 ink capaciy 3 7
Cu Def. An - cu i a pariion (A, B) of V wih A and B. Def. The capaciy of a cu (A, B) i: cap(a, B) c(e) e ou of A 9 3 8 A 3 7 Capaciy = + + = 3
Cu Def. An - cu i a pariion (A, B) of V wih A and B. Def. The capaciy of a cu (A, B) i: cap(a, B) c(e) e ou of A we don coun edge ino A 9 3 8 A 3 7 Capaciy = 9 + + 8 + 3 =
Minimum Cu Problem Min - cu problem. Find an - cu of minimum capaciy. 9 3 8 A 3 7 Capaciy = + 8 + = 8
Flow Def. An - flow i a funcion ha aifie: For each e E: f (e) c(e) (capaciy) For each v V {, }: f (e) f (e) (conervaion) e in o v e ou of v Def. The value of a flow f i: v( f ) f (e). e ou of Waer flowing in and ou of v 9 3 8 capaciy flow 3 7 Value =
Maximum Flow Problem Max flow problem. Find - flow of maximum value. 9 9 1 9 8 9 3 8 capaciy flow 1 1 3 7 Value = 8
Flow and Cu Flow value lemma. Le f be any flow, and le (A, B) be any - cu. Then he ne flow en acro he cu i equal o he amoun leaving. f (e) f (e) v( f ) e ou of A e in o A 9 3 8 8 3 8 A 1 11 11 3 7 Value =
Flow and Cu Weak dualiy. Le f be any flow. Then, for any - cu (A, B), v(f) cap(a, B). Proof. v( f ) f (e) f (e) e ou of A e in o A f (e) e ou of A c(e) e ou of A cap(a, B) A 8 7 B
Review Queion True/Fale Le G be an arbirary flow nework, wih a ource, and ink, and a poiive ineger capaciy c e on every edge e. 1) If f i a maximum - flow in G, hen f aurae every edge ou of wih flow (i.e., for all edge e ou of, we have f(e) = c e ). ) Le (A,B) be a minimum - cu wih repec o hee capaciie. If we add 1 o every capaciy, hen (A,B) i ill a minimum - cu wih repec o he new capaciie.
Toward a Max Flow Algorihm Greedy algorihm. Sar wih f(e) = for all edge e E. Find an - pah P where each edge ha f(e) < c(e). Augmen flow along pah P. Repea unil you ge uck. 1 3 Flow value =
Toward a Max Flow Algorihm Greedy algorihm. Sar wih f(e) = for all edge e E. Find an - pah P where each edge ha f(e) < c(e). Augmen flow along pah P. Repea unil you ge uck. 1 X 3 X X Flow value =
Toward a Max Flow Algorihm Greedy algorihm. Sar wih f(e) = for all edge e E. Find an - pah P where each edge ha f(e) < c(e). Augmen flow along pah P. Repea unil you ge uck. How can we ge from greedy o op here? Wha if we puh waer back acro middle edge? locally opimaliy global opimaliy 1 1 3 3 greedy = op = 3
Reidual Graph Original edge: e = (u, v) E. Flow f(e), capaciy c(e). u 17 capaciy v flow Reidual edge. "Undo" flow en. e = (u, v) and e R = (v, u). Reidual capaciy: u 11 reidual capaciy v c(e) f (e) c f (e) if f (e) e E if e R E reidual capaciy Reidual graph: G f = (V, E f ). Reidual edge wih poiive reidual capaciy. E f = {e : f(e) < c(e)} {e R : c(e) > }.
Ford-Fulkeron Algorihm G: 8 capaciy 3 9 1
Augmening Pah Algorihm Ford-Fulkeron(G,,, c) { foreach e E, f(e) G f reidual graph } while (here exi augmening pah P) { f Augmen(f, c, P) updae G f } reurn f Augmen(f, c, P) { b boleneck-capaciy(p) foreach e P { } if (e E) f(e) f(e) + b ele f(e R ) f(e R ) - b } reurn f Min reidual capaciy of an edge in P forward edge revere edge
Ford-Fulkeron: Analyi Ford-Fulkeron ummary: While you can, Greedily puh flow Updae reidual graph Lemma 1 (Feaibiliy): Ford-Fulkeron oupu a valid flow. Proof: Check capaciy and conervaion condiion. (Deail in KT) Sill o do: Opimaliy: Doe i oupu a maximum flow? Running ime (in paricular, erminaion!)
Max-Flow Min-Cu Theorem Augmening pah heorem. Flow f i a max flow iff here are no augmening pah. Max-flow min-cu heorem. [Ford-Fulkeron 19] The value of he max flow i equal o he value of he min cu. Proof raegy. We prove boh imulaneouly by howing ha TFAE: (i) There exi a cu (A, B) uch ha v(f) = cap(a, B). (ii) Flow f i a max flow. (iii) There i no augmening pah relaive o f. (i) (ii) Thi wa he corollary o weak dualiy lemma. (ii) (iii) We how conrapoiive. Le f be a flow. If here exi an augmening pah, hen we can improve f by ending flow along pah.
Proof of Max-Flow Min-Cu Theorem (iii) (i) Le f be a flow wih no augmening pah. Le A be e of verice reachable from in reidual graph. By definiion of A, ource A. By definiion of f, ink A. Obervaion: No edge of he reidual graph go from A o B. Claim 1: If e goe from A o B, hen f(e) =c(e). Proof: Oherwie here would be reidual capaciy, and he reidual graph would have an edge A o B. original nework A B Claim : If e goe from B o A, hen f(e)=. Proof: Oherwie reidual edge would go from A o B. v( f ) f (e) f (e) e ou of A e in o A c(e) e ou of A cap(a, B)
Ford-Fulkeron: Analyi Ford-Fulkeron ummary: While you can, Greedily puh flow Updae reidual graph Lemma 1 (Feaibiliy): Ford-Fulkeron oupu a valid flow. Augmening pah heorem. Flow f i a max flow iff here are no augmening pah. Opimaliy: If Ford-Fulkeron erminae hen he oupu i a max flow. Sill o do: Running ime (in paricular, erminaion!)