7. NETWORK FLOW I 7. NETWORK FLOW I max-flow and min-cu problem max-flow and min-cu problem Ford Fulkeron algorihm Ford Fulkeron algorihm max-flow min-cu heorem max-flow min-cu heorem capaciy-caling algorihm capaciy-caling algorihm hore augmening pah hore augmening pah Diniz algorihm Diniz algorihm imple uni-capaciy nework SECTION 7.1 imple uni-capaciy nework Lecure lide by Kevin Wayne Copyrigh 2005 Pearon-Addion Weley hp://www.c.princeon.edu/~wayne/kleinberg-ardo La updaed on 4/27/18 5:51 AM Flow nework Minimum-cu problem A flow nework i a uple G = (V, E,,, c). Digraph (V, E) wih ource V and ink V. Capaciy c(e) > 0 for each e E. Inuiion. Maerial flowing hrough a ranporaion nework; maerial originae a ource and i en o ink. aume all node are reachable from Def. An -cu (cu) i a pariion (A, B) of he node wih A and B. Def. I capaciy i he um of he capaciie of he edge from A o B. cap(a, B) = c(e) capaciy 9 4 15 15 5 8 5 15 4 6 15 15 16 3 capaciy = + 5 + 15 = 30 4
Minimum-cu problem Minimum-cu problem Def. An -cu (cu) i a pariion (A, B) of he node wih A and B. Def. I capaciy i he um of he capaciie of he edge from A o B. cap(a, B) = c(e) Def. An -cu (cu) i a pariion (A, B) of he node wih A and B. Def. I capaciy i he um of he capaciie of he edge from A o B. cap(a, B) = c(e) Min-cu problem. Find a cu of minimum capaciy. 8 8 don include edge from B o A capaciy = + 8 + 16 = 34 16 5 capaciy = + 8 + = 28 6 Nework flow: quiz 1 Maximum-flow problem Which i he capaciy of he given -cu? A. 11 (20 + 25 8 11 9 6) B. 34 (8 + 11 + 9 + 6) Def. An -flow (flow) f i a funcion ha aifie: For each e E : 0 c(e) [capaciy] For each v V {, } : = [flow conervaion] e v e v C. 45 (20 + 25) D. 79 (20 + 25 + 8 + 11 + 9 + 6) flow capaciy capaciy 5 / 9 inflow a v = 5 + 5 + 0 = ouflow a v = + 0 = 20 8 5 / 15 5 / 6 12 8 11 9 6 8 5 / 5 5 / 8 v 1 16 25 1 0 / 6 / 16 7 8
Maximum-flow problem Maximum-flow problem Def. An -flow (flow) f i a funcion ha aifie: For each e E : 0 c(e) [capaciy] For each v V {, } : = [flow conervaion] e v e v Def. An -flow (flow) f i a funcion ha aifie: For each e E : 0 c(e) [capaciy] For each v V {, } : = [flow conervaion] e v e v Def. The value of a flow f i: val(f) = e e Def. The value of a flow f i: val(f) = e e Max-flow problem. Find a flow of maximum value. 5 / 9 8 / 9 5 / 15 5 / 2 / 15 8 / 5 / 5 5 / 8 5 / 5 8 / 8 1 0 / 6 13 / 15 3 / 6 value = 5 + + = 25 / 16 value = + 5 + 13 = 28 13 / 16 9 Toward a max-flow algorihm SECTION 7.1 7. NETWORK FLOW I max-flow and min-cu problem Ford Fulkeron algorihm max-flow min-cu heorem capaciy-caling algorihm hore augmening pah Diniz algorihm imple uni-capaciy nework Greedy algorihm. Sar wih f (e) = 0 for each 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. flow nework G and flow f flow capaciy 0 / 0 / 2 0 / 8 0 / 6 0 / value of flow 0 / 0 / 9 0 / 0 12
Toward a max-flow algorihm Greedy algorihm. Sar wih f (e) = 0 for each 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. Toward a max-flow algorihm Greedy algorihm. Sar wih f (e) = 0 for each 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. flow nework G and flow f flow nework G and flow f 0 / 0 / 2 0 / 8 0 / 6 0 / 8 0 / 0 / 2 8 0 / 8 0 / 6 0 / 0 / 0 / 9 0 / 0 8 0 / 0 / 9 0 / 0 + 8 = 8 13 14 Toward a max-flow algorihm Greedy algorihm. Sar wih f (e) = 0 for each 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. Toward a max-flow algorihm Greedy algorihm. Sar wih f (e) = 0 for each 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. flow nework G and flow f flow nework G and flow f 8 / 2 0 / 2 8 / 8 0 / 6 0 / 2 / 2 8 / 8 6 0 / 6 6 0 / 2 0 / 0 / 9 8 / 8 + 2 = 6 8 0 / 2 / 9 + 6 = 16 15 16
Toward a max-flow algorihm Greedy algorihm. Sar wih f (e) = 0 for each 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. Toward a max-flow algorihm Greedy algorihm. Sar wih f (e) = 0 for each 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. flow nework G and flow f ending flow value = 16 flow nework G and flow f bu max-flow value = 19 3 / 4 2 / 2 8 / 8 6 / 6 6 / 0 / 2 7 / 8 6 / 6 9 / 6 / 8 / 9 16 9 / 9 / 9 19 17 18 Why he greedy algorihm fail Reidual nework Q. Why doe he greedy algorihm fail? A. Once greedy algorihm increae flow on an edge, i never decreae i. Ex. Conider flow nework G. The unique max flow ha f * (v, w) = 0. Greedy algorihm could chooe v w a fir augmening pah. flow nework G v 2 Boom line. Need ome mechanim o undo a bad deciion. 2 1 2 2 w 19 Original edge. e = (u, v) E. Flow f (e). Capaciy c(e). Revere edge. e revere = (v, u). Undo flow en. Reidual capaciy. c f (e) = c(e) e E e E original flow nework G Reidual nework. G f = (V, E f,,, c f ). E f = {e : f (e) < c(e)} {e revere : f (e) > 0}. Key propery: f ʹ i a flow in G f iff f + f ʹ i a flow in G. u u flow reidual nework Gf edge wih poiive reidual capaciy 6 / 17 11 6 capaciy v reidual capaciy where flow on a revere edge negae flow on correponding forward edge v revere edge 20
Augmening pah Nework flow: quiz 2 Def. An augmening pah i a imple pah in he reidual nework G f. Def. The boleneck capaciy of an augmening pah P i he minimum reidual capaciy of any edge in P. Key propery. Le f be a flow and le P be an augmening pah in G f. Then, afer calling f ʹ AUGMENT( f, c, P), he reuling f ʹ i a flow and val( f ʹ) = val( f ) + boleneck(g f, P). Which i he augmening pah of highe boleneck capaciy? A. A F G H B. A B C D H C. A F B G H D. A F B G C D H AUGMENT( f, c, P) reidual capaciy 5 δ boleneck capaciy of augmening pah P. A 9 B 8 C 6 D FOREACH edge e P : IF (e E) f (e) f (e) + δ. ource 5 8 4 5 7 7 6 8 5 ELSE f (e revere ) f (e revere ) δ. RETURN f. E 5 F 2 G 3 H 21 5 arge 22 Ford Fulkeron algorihm Ford Fulkeron augmening pah algorihm. Sar wih f (e) = 0 for each edge e E. Find an pah P in he reidual nework G f. Augmen flow along pah P. Repea unil you ge uck. FORD FULKERSON(G) FOREACH edge e E : f (e) 0. G f reidual nework of G wih repec o flow f. WHILE (here exi an pah P in G f ) f AUGMENT( f, c, P). Updae G f. RETURN f. augmening pah SECTION 7.2 7. NETWORK FLOW I max-flow and min-cu problem Ford Fulkeron algorihm max-flow min-cu heorem capaciy-caling algorihm hore augmening pah Diniz' algorihm imple uni-capaciy nework 23
Relaionhip beween flow and cu Relaionhip beween flow and cu Flow value lemma. Le f be any flow and le (A, B) be any cu. Then, he value of he flow f equal he ne flow acro he cu (A, B). Flow value lemma. Le f be any flow and le (A, B) be any cu. Then, he value of he flow f equal he ne flow acro he cu (A, B). val(f) = e A val(f) = e A ne flow acro cu = 5 + + = 25 ne flow acro cu = + 5 + = 25 5 / 9 5 / 9 5 / 15 5 / 5 / 15 5 / 5 / 5 5 / 8 value of flow = 25 5 / 5 5 / 8 value of flow = 25 1 0 / 6 1 0 / 6 / 16 / 16 25 26 Relaionhip beween flow and cu Nework flow: quiz 3 Flow value lemma. Le f be any flow and le (A, B) be any cu. Then, he value of he flow f equal he ne flow acro he cu (A, B). Which i he ne flow acro he given cu? A. 11 (20 + 25 8 11 9 6) val(f) = e A B. 26 (20 + 22 8 4 4) C. 42 (20 + 22) ne flow acro cu = ( + + 5 + + 0 + 0) (5 + 5 + 0 + 0) = 25 D. 45 (20 + 25) 5 / 9 edge from B o A flow capaciy 5 / 15 5 / 20 / 20 8 / 8 4 / 5 / 5 1 5 / 8 0 / 6 value of flow = 25 1 / 6 5 / 12 8 / 8 4 / 11 4 / 9 0 / 6 4 / 8 / 16 1 / 1 14 / 16 22 / 25 27 28
Relaionhip beween flow and cu Relaionhip beween flow and cu Flow value lemma. Le f be any flow and le (A, B) be any cu. Then, he value of he flow f equal he ne flow acro he cu (A, B). val(f) = e A val(f) = e e Weak dualiy. Le f be any flow and (A, B) be any cu. Then, val( f ) cap(a, B). flow value lemma val(f) = = cap(a, B) c(e) e A by flow conervaion, all erm excep for v = are 0 = v A e v e v 8 / 9 = e A 5 / 5 2 / 15 7 / 8 8 / 9 / 5 12 / 15 2 / 6 15 12 / 16 29 value of flow = 27 capaciy of cu = 30 30 Cerificae of opimaliy Max-flow min-cu heorem Corollary. Le f be a flow and le (A, B) be any cu. If val( f ) = cap(a, B), hen f i a max flow and (A, B) i a min cu. weak dualiy For any flow f ʹ: val( f ʹ) cap(a, B) = val( f ). For any cu (Aʹ, Bʹ): cap(aʹ, Bʹ) val( f ) = cap(a, B). Max-flow min-cu heorem. Value of a max flow = capaciy of a min cu. rong dualiy weak dualiy 8 / 9 2 / 15 8 / A Noe on he Maximum Flow Through a Nework* 5 / 5 8 / 8 8 P. ELIAS, A. FEINSTEINI, AND C. E. SHANNON! 13 / 15 3 / 6 13 / 16 Summary--Thi noe dicue he problem of maximizing he rae of flow from one erminal o anoher, hrough a nework which coni of a number of branche, each of which ha a!imied capaciy. The main reul i a heorem: The maximum poible flow from lef o righ hrough a nework i equal o he minimum value among all imple cu-e. Thi heorem i applied o olve a more general problem, in which a number of inpu node and a number of oupu node are ued. from one erminal o he oher in he original nework pae hrough a lea one branch in he cu-e. In he nework above, ome example of cu-e are (d, e, f), and (b, c, e, g, h), (d, g, h, i). By a imple cu-e we will mean a cu-e uch ha if any branch i omied i i no longer a cu-e. Thu (d, e, f) and (b, c, e, g, h) are imple cu-e while (d, g, h, ;) i no. When a imple cu-e i value of flow = 28 = capaciy of cu = 28 31 32
<laexi ha1_bae64="ztukvgmmjb/wcce6tg9au4cgi=">aaacwxicbvdbthxepuuparpkqgovvinkedyrchgvrvanhhscwsigwjyovmgoxxxnjkfqp6nfwxu+avezejmcmoqn2xp6b8bjewkhhcuoegncjq+bh7can5qfv2x/3wn7vwdozdl2upzw3kleihoicjdwwbliesuind5e13/8lxgqbnbawdbnd0pkgjp00qh19jmv2hixt4qgsyieyypdkh1ri6uvf+ad/rkp6ipqjvjvqrdpqdrivsjcd3adfaseyub4vcmmhcvtggqgbzdqnrnnowd8gd3bwfpfcrddcrzzrx94zuwzbfxrsgfq/x0ly62d5qmvzbne21wvf/zbg6z2epvoeqfj8pypykqgkdex0laxzl1bpgjfb/pfyegcbrh7k0zfz2axxpk3lilob6dcuqxakavvku49xm1knvubnhnfjpsfv8bjfng3wj38kbickposdx5jp0csf/ycn5i/baxiejba5lw2drc8+wuk4/wzjq7me</laexi> <laexi ha1_bae64="ztukvgmmjb/wcce6tg9au4cgi=">aaacwxicbvdbthxepuuparpkqgovvinkedyrchgvrvanhhscwsigwjyovmgoxxxnjkfqp6nfwxu+avezejmcmoqn2xp6b8bjewkhhcuoegncjq+bh7can5qfv2x/3wn7vwdozdl2upzw3kleihoicjdwwbliesuind5e13/8lxgqbnbawdbnd0pkgjp00qh19jmv2hixt4qgsyieyypdkh1ri6uvf+ad/rkp6ipqjvjvqrdpqdrivsjcd3adfaseyub4vcmmhcvtggqgbzdqnrnnowd8gd3bwfpfcrddcrzzrx94zuwzbfxrsgfq/x0ly62d5qmvzbne21wvf/zbg6z2epvoeqfj8pypykqgkdex0laxzl1bpgjfb/pfyegcbrh7k0zfz2axxpk3lilob6dcuqxakavvku49xm1knvubnhnfjpsfv8bjfng3wj38kbickposdx5jp0csf/ycn5i/baxiejba5lw2drc8+wuk4/wzjq7me</laexi> <laexi ha1_bae64="ztukvgmmjb/wcce6tg9au4cgi=">aaacwxicbvdbthxepuuparpkqgovvinkedyrchgvrvanhhscwsigwjyovmgoxxxnjkfqp6nfwxu+avezejmcmoqn2xp6b8bjewkhhcuoegncjq+bh7can5qfv2x/3wn7vwdozdl2upzw3kleihoicjdwwbliesuind5e13/8lxgqbnbawdbnd0pkgjp00qh19jmv2hixt4qgsyieyypdkh1ri6uvf+ad/rkp6ipqjvjvqrdpqdrivsjcd3adfaseyub4vcmmhcvtggqgbzdqnrnnowd8gd3bwfpfcrddcrzzrx94zuwzbfxrsgfq/x0ly62d5qmvzbne21wvf/zbg6z2epvoeqfj8pypykqgkdex0laxzl1bpgjfb/pfyegcbrh7k0zfz2axxpk3lilob6dcuqxakavvku49xm1knvubnhnfjpsfv8bjfng3wj38kbickposdx5jp0csf/ycn5i/baxiejba5lw2drc8+wuk4/wzjq7me</laexi> <laexi ha1_bae64="ztukvgmmjb/wcce6tg9au4cgi=">aaacwxicbvdbthxepuuparpkqgovvinkedyrchgvrvanhhscwsigwjyovmgoxxxnjkfqp6nfwxu+avezejmcmoqn2xp6b8bjewkhhcuoegncjq+bh7can5qfv2x/3wn7vwdozdl2upzw3kleihoicjdwwbliesuind5e13/8lxgqbnbawdbnd0pkgjp00qh19jmv2hixt4qgsyieyypdkh1ri6uvf+ad/rkp6ipqjvjvqrdpqdrivsjcd3adfaseyub4vcmmhcvtggqgbzdqnrnnowd8gd3bwfpfcrddcrzzrx94zuwzbfxrsgfq/x0ly62d5qmvzbne21wvf/zbg6z2epvoeqfj8pypykqgkdex0laxzl1bpgjfb/pfyegcbrh7k0zfz2axxpk3lilob6dcuqxakavvku49xm1knvubnhnfjpsfv8bjfng3wj38kbickposdx5jp0csf/ycn5i/baxiejba5lw2drc8+wuk4/wzjq7me</laexi> Max-flow min-cu heorem Max-flow min-cu heorem Max-flow min-cu heorem. Value of a max flow = capaciy of a min cu. Augmening pah heorem. A flow f i a max flow iff no augmening pah. The following hree condiion are equivalen for any flow f : i. There exi a cu (A, B) uch ha cap(a, B) = val( f ). ii. f i a max flow. iii. There i no augmening pah wih repec o f. [ i ii ] Thi i he weak dualiy corollary. if Ford Fulkeron erminae, hen f i max flow Max-flow min-cu heorem. Value of a max flow = capaciy of a min cu. Augmening pah heorem. A flow f i a max flow iff no augmening pah. The following hree condiion are equivalen for any flow f : i. There exi a cu (A, B) uch ha cap(a, B) = val( f ). ii. f i a max flow. iii. There i no augmening pah wih repec o f. [ ii iii ] We prove conrapoiive: iii ii. Suppoe ha here i an augmening pah wih repec o f. Can improve flow f by ending flow along hi pah. Thu, f i no a max flow. 33 34 Max-flow min-cu heorem [ iii i ] Le f be a flow wih no augmening pah. Le A be e of node reachable from in reidual nework G f. By definiion of A: A. By definiion of flow f: A. flow value lemma val(f) = = = cap(a, B) c(e) e A 0 edge e = (v, w) wih v B, w A mu have = 0 original flow nework G A B SECTION 7.3 7. NETWORK FLOW I max-flow and min-cu problem Ford Fulkeron algorihm max-flow min-cu heorem capaciy-caling algorihm hore augmening pah Diniz' algorihm imple uni-capaciy nework edge e = (v, w) wih v A, w B mu have = c(e) 35
Analyi of Ford Fulkeron algorihm (when capaciie are inegral) Ford Fulkeron: exponenial example Aumpion. Every edge capaciy c(e) i an ineger beween 1 and C. Inegraliy invarian. Throughou Ford Fulkeron, every edge flow f (e) and reidual capaciy c f (e) i an ineger. By inducion on he number of augmening pah. Theorem. Ford Fulkeron erminae afer a mo val( f *) n C augmening pah, where f * i a max flow. Each augmenaion increae he value of he flow by a lea 1. Corollary. The running ime of Ford Fulkeron i O(m n C). Can ue eiher BFS or DFS o find an augmening pah in O(m) ime. Inegraliy heorem. There exi an inegral max flow f *. Since Ford Fulkeron erminae, heorem follow from inegraliy invarian (and augmening pah heorem). i an ineger for every e conider cu A = { } (aume no parallel edge) 37 Q. I generic Ford Fulkeron algorihm poly-ime in inpu ize? A. No. If max capaciy i C, hen algorihm can ake C ieraion. v w w v v w w v v w w v each augmening pah end only 1 uni of flow (# augmening pah = 2C) v C C m, n, and log C 1 C C w 38 Nework flow: quiz 4 Chooing good augmening pah The Ford Fulkeron algorihm i guaraneed o erminae if he edge capaciie are A. Raional number. B. Real number. C. Boh A and B. D. Neiher A nor B. Le D denoe he produc (or lcm) of he denominaor. Then, every edge flow f (e) and every reidual capaciy c f (e) i a muliple of 1 / D. Ue care when elecing augmening pah. Some choice lead o exponenial algorihm. Clever choice lead o polynomial algorihm. Pahology. When edge capaciie can be irraional, no guaranee ha Ford Fulkeron erminae (or converge o a maximum flow)! Goal. Chooe augmening pah o ha: Can find augmening pah efficienly. Few ieraion. 39 40
Chooing good augmening pah Capaciy-caling algorihm Chooe augmening pah wih: Max boleneck capaciy ( fae ). Sufficienly large boleneck capaciy. Fewe edge. ahead how o find? nex Overview. Chooing augmening pah wih large boleneck capaciy. Mainain caling parameer Δ. Le G f (Δ) be he par of he reidual nework conaining only hoe edge wih capaciy Δ. Any augmening pah in G f (Δ) ha boleneck capaciy Δ. hough no necearily large Theoreical Improvemen in Algorihmic Efficiency for Nework Flow Problem JACK EDMONDS Univeriy of Waerloo, Waerloo, Onario, Canada AND 1 2 1 2 RICHARD M. KARP Univeriy of California, Berkeley, California ABSTRACT. Thi paper preen new algorihm for he maximum flow problem, he Hichcock ranporaion problem, and he general minimum-co flow problem. Upper bound on he number of ep in hee algorihm are derived, and are hown o compale favorably wih upper bound on he number of ep required by earlier algorihm. 1 Edmond-Karp 1972 (USA) Diniz 1970 (Sovie Union) 122 170 122 170 invened in repone o a cla exercie by Adel on-vel kiĭ 41 Gf Gf (Δ), Δ = 0 42 Capaciy-caling algorihm Capaciy-caling algorihm: proof of correcne CAPACITY-SCALING(G) FOREACH edge e E : f (e) 0. Δ large power of 2 C. WHILE (Δ 1) G f (Δ) Δ-reidual nework of G wih repec o flow f. WHILE (here exi an pah P in G f (Δ)) f AUGMENT( f, c, P). Updae Gf (Δ). Δ Δ / 2. RETURN f. Δ-caling phae Aumpion. All edge capaciie are ineger beween 1 and C. Invarian. The caling parameer Δ i a power of 2. Iniially a power of 2; each phae divide Δ by exacly 2. Inegraliy invarian. Throughou he algorihm, every edge flow f (e) and reidual capaciy c f (e) i an ineger. Same a for generic Ford Fulkeron. Theorem. If capaciy-caling algorihm erminae, hen f i a max flow. By inegraliy invarian, when Δ = 1 G f (Δ) = G f. Upon erminaion of Δ = 1 phae, here are no augmening pah. Reul follow augmening pah heorem 43 44
Capaciy-caling algorihm: analyi of running ime Capaciy-caling algorihm: analyi of running ime Lemma 1. There are 1 + log 2 C caling phae. Iniially C / 2 < Δ C; Δ decreae by a facor of 2 in each ieraion. Lemma 2. Le f be he flow a he end of a Δ-caling phae. Then, he max-flow value val( f ) + m Δ. Nex lide. Lemma 3. There are 2m augmenaion per caling phae. Le f be he flow a he beginning of a Δ-caling phae. Lemma 2 max-flow value val( f ) + m (2 Δ). Each augmenaion in a Δ-phae increae val( f ) by a lea Δ. Theorem. The capaciy-caling algorihm ake O(m 2 log C) ime. Lemma 1 + Lemma 3 O(m log C) augmenaion. Finding an augmening pah ake O(m) ime. or equivalenly, a he end of a 2Δ-caling phae 45 Lemma 2. Le f be he flow a he end of a Δ-caling phae. Then, he max-flow value val( f ) + m Δ. We how here exi a cu (A, B) uch ha cap(a, B) val( f ) + m Δ. Chooe A o be he e of node reachable from in G f (Δ). By definiion of A: A. By definiion of flow f: A. val(f) = flow value lemma cap(a, B) (c(e) ) c(e) m e A e A e A edge e = (v, w) wih v B, w A mu have < Δ original flow nework A edge e = (v, w) wih v A, w B mu have > c(e) Δ B 46 Shore augmening pah 7. NETWORK FLOW I Q. How o chooe nex augmening pah in Ford Fulkeron? A. Pick one ha ue he fewe edge. SECTION 17.2 max-flow and min-cu problem Ford Fulkeron algorihm max-flow min-cu heorem capaciy-caling algorihm hore augmening pah Diniz algorihm imple uni-capaciy nework can find via BFS SHORTEST-AUGMENTING-PATH(G) FOREACH e E : f (e) 0. G f reidual nework of G wih repec o flow f. WHILE (here exi an pah in Gf ) P BREADTH-FIRST-SEARCH(Gf ). f AUGMENT( f, c, P). Updae Gf. RETURN f. 48
Shore augmening pah: overview of analyi Lemma 1. The lengh of a hore augmening pah never decreae. Ahead. Lemma 2. Afer a mo m hore-pah augmenaion, he lengh of a hore augmening pah ricly increae. Ahead. number of edge Theorem. The hore-augmening-pah algorihm ake O(m 2 n) ime. O(m) ime o find a hore augmening pah via BFS. There are m n augmenaion. - a mo m augmening pah of lengh k - a mo n 1 differen lengh Lemma 1 + Lemma 2 Shore augmening pah: analyi Def. Given a digraph G = (V, E) wih ource, i level graph i defined by: l(v) = number of edge in hore v pah. L G = (V, E G ) i he ubgraph of G ha conain only hoe edge (v, w) E wih l(w) = l(v) + 1. graph G augmening pah are imple pah 49 l = 0 l = 1 l = 2 l = 3 50 Nework flow: quiz 5 Which edge are in he level graph of he following digraph? A. D F. B. E F. C. Boh A and B. D. Neiher A nor B. Shore augmening pah: analyi Def. Given a digraph G = (V, E) wih ource, i level graph i defined by: l(v) = number of edge in hore v pah. L G = (V, E G ) i he ubgraph of G ha conain only hoe edge (v, w) E wih l(w) = l(v) + 1. Key propery. P i a hore v pah in G iff P i an v pah in L G. 1 B 3 D ource A C E F ink 0 1 2 3 51 l = 0 l = 1 l = 2 l = 3 52
Shore augmening pah: analyi Lemma 1. The lengh of a hore augmening pah never decreae. Le f and f ʹ be flow before and afer a hore-pah augmenaion. Le L G and L Gʹ be level graph of G f and G f ʹ. Only back edge added o G f (any pah ha ue a back edge i longer han previou lengh) Shore augmening pah: analyi Lemma 2. Afer a mo m hore-pah augmenaion, he lengh of a hore augmening pah ricly increae. A lea one (boleneck) edge i deleed from L G per augmenaion. No new edge added o L G unil hore pah lengh ricly increae. l = 0 l = 1 l = 2 l = 3 l = 0 l = 1 l = 2 l = 3 53 54 Shore augmening pah: review of analyi Shore augmening pah: improving he running ime Lemma 1. Throughou he algorihm, he lengh of a hore augmening pah never decreae. Lemma 2. Afer a mo m hore-pah augmenaion, he lengh of a hore augmening pah ricly increae. Theorem. The hore-augmening-pah algorihm ake O(m 2 n) ime. Noe. Θ(m n) augmenaion neceary for ome flow nework. Try o decreae ime per augmenaion inead. Simple idea O(mn 2 ) [Diniz 1970] ahead Dynamic ree O(m n log n) [Sleaor Tarjan 1983] A Daa Srucure for Dynamic Tree DANIEL D. SLEATOR AND ROBERT ENDRE TARJAN Bell Laboraorie, Murray Hill, New Jerey 07974 Received May 8, 1982; revied Ocober 18, 1982 A daa rucure i propoed o mainain a collecion of verex-dijoin ree under a equence of wo of operaion: a link operaion ha combine wo ino one by kind ree adding edge, and a cu operaion ha divide one ree ino wo by deleing an edge. Each an operaion require O(log n) ime. Uing hi daa rucure, new fa algorihm are obained for he following problem: (1) Compuing neare common anceor. (2) Solving variou nework flow problem including finding maximum flow, blocking and acyclic flow. flow, (3) Compuing cerain kind of conrained minimum panning ree. (4) Implemening he nework implex algorihm for minimum-co flow. mo ignifican applicaion i (2); an O(mn log n)-ime algorihm obained The i o find a maximum flow in nework of verice and m edge, beaing by a facor of log n he fae a n algorihm previouly known for pare graph. 55 56
Diniz algorihm SECTION 18.1 7. NETWORK FLOW I max-flow and min-cu problem Ford Fulkeron algorihm max-flow min-cu heorem capaciy-caling algorihm hore augmening pah Diniz algorihm imple uni-capaciy nework Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. conruc level graph wihin a phae, lengh of hore augmening pah doe no change 58 Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. advance augmen remove from level graph edge wih boleneck capaciy 59 60
Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. advance rerea 61 62 Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. advance augmen 63 64
Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. advance rerea 65 66 Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. Diniz algorihm Two ype of augmenaion. Normal: lengh of hore pah doe no change. Special: lengh of hore pah ricly increae. Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G; and rear from. If ge uck, delee node from L G and rerea o previou node. rerea end of phae 67 68
Diniz algorihm (a refined by Even and Iai) Nework flow: quiz 6 How o compue he efficienly? INITIALIZE(G, f ) ADVANCE(v) L G level-graph of G f. IF (v = ) A. Deph-fir earch. P. GOTO ADVANCE(). RETREAT(v) AUGMENT(P). Remove auraed edge from L G. P. GOTO ADVANCE(). B. Breadh-fir earch. C. Boh A and B. D. Neiher A nor B. IF (v = ) STOP. ELSE Delee v (and all inciden edge) from L G. Remove la edge (u, v) from P. GOTO ADVANCE(u). IF (here exi edge (v, w) L G) ELSE Add edge (v, w) o P. GOTO ADVANCE(w). GOTO RETREAT(v). ource 1 3 B D A C E F ink 69 0 1 2 3 70 Diniz algorihm: analyi Augmening-pah algorihm: ummary Lemma. A phae can be implemened o run in O(m n) ime. Iniializaion happen once per phae. A mo m augmenaion per phae. (becaue an augmenaion delee a lea one edge from L G ) A mo n rerea per phae. (becaue a rerea delee one node from L G ) A mo mn advance per phae. O(m) uing BFS O(mn) per phae O(m + n) per phae O(mn) per phae (becaue a mo n advance before rerea or augmenaion) Theorem. [Diniz 1970] Diniz algorihm run in O(mn 2 ) ime. By Lemma, O(mn) ime per phae. A mo n 1 phae (a in hore-augmening-pah analyi). year mehod # augmenaion running ime 1955 augmening pah n C O(m n C) 1972 fae pah m log (mc) O(m 2 log n log (mc)) 1972 capaciy caling m log C O(m 2 log C) 1985 improved capaciy caling m log C O(m n log C) 1970 hore augmening pah m n O(m 2 n) 1970 level graph m n O(m n 2 ) 1983 dynamic ree m n O(m n log n ) augmening-pah algorihm wih m edge, n node, and ineger capaciie beween 1 and C fa pah hore pah 71 72
Maximum-flow algorihm: heory highligh Maximum-flow algorihm: pracice year mehod wor cae dicovered by 1951 implex O(m n2 C) Danzig 1955 augmening pah O(m n C) Ford Fulkeron 1970 hore augmening pah O(m n2) Edmond Karp, Diniz 1974 blocking flow O(n3) Karzanov 1983 dynamic ree O(m n log n) Sleaor Tarjan 1985 improved capaciy caling O(m n log C) Gabow 1988 puh relabel O(m n log (n2 / m)) Goldberg Tarjan 1998 binary blocking flow O(m3/2 log (n2 / m) log C) Goldberg Rao 2013 compac nework O(m n) Orlin 2014 inerior-poin mehod Õ(m m1/2 log C) Lee Sidford 2016 elecrical flow Õ(m/7 C1/7) Mądry Puh relabel algorihm (SECTION 7.4). [Goldberg Tarjan 1988] Increae flow one edge a a ime inead of one augmening pah a a ime. A New Approach o he Maximum-Flow Problem ANDREW V. GOLDBERG Maachue Iniue of Technology, Cambridge, Maachue AND ROBERT E. TARJAN Princeon Univeriy, Bell Laboraorie, Murray Hill, New Jerey Abrac. All previouly known effcien maximum-flow algorihm work by finding augmening pah, eiher one pah a a ime (a in he original Ford and Fulkeron algorihm) or all hore-lengh augmening pah a once (uing he layered nework approach of Dinic). An alernaive mehod baed on he preflow concep of Karzanov i inroduced. A preflow i like a flow, excep ha he oal amoun flowing ino a verex i allowed o exceed he oal amoun flowing ou. The mehod mainain a preflow in he original nework and puhe local flow exce oward he ink along wha are eimaed o be hore pah. The algorihm and i analyi are imple and inuiive, ye he algorihm run a fa a any oher known mehod on dene.graph, achieving an O(n)) ime bound on an n-verex graph. By incorporaing he dynamic ree daa rucure of Sleaor and Tarjan, we obain a verion of he algorihm running in O(nm log(n /m)) ime on an n-verex, m-edge graph. Thi i a fa a any known mehod for any graph deniy and faer on graph of moderae deniy. The algorihm alo admi eficien diribued and parallel implemenaion. A parallel implemenaion running in O(n log n) ime uing n proceor and O(m) pace i obained. Thi ime bound mache ha of he Shiloach-Vihkin algorihm, which alo ue n proceor bu require O(n ) pace. 20xx max-flow algorihm wih m edge, n node, and ineger capaciie beween 1 and C Princeon, New Jerey, and AT&T Caegorie and Subjec Decripor: F.2.2 [Analyi of Algorihm and Problem Complexiy]: Nonnumerical Algorihm and Problem; G.2.2 [Dicree Mahemaic]: Graph Theory-graph algorihm; 73 74 nework problem General Term: Algorihm, Deign, Theory, Verificaion Addiional Key Word and Phrae: Dynamic ree, maximum-flow problem Maximum-flow algorihm: pracice Maximum-flow algorihm: pracice 1. Inroducion The problem of finding a maximum flow in a direced graph wih edge capaciie arie in many eing in operaion reearch and oher field, and efficien algorihm for he problem have receivedwork a grea beer deal of aenion. Exenivedene viion. Differen algorihm for ome Cavea. Wor-cae running ime i generally no ueful for predicing or Compuer comparing max-flow algorihm performance in pracice. problem ha onarie applicaion o28-30). compuer Theory ofin Compuing (Berkeley, Calif., May ACM, New York,viion. 1986, pp. 136-146. A preliminary verion of hi paper appeared in he Proceeding of he 18h Annual ACM Sympoium The work of A. V. Goldberg wa uppored by a Fannie and John Herz Foundaion Fellowhip and by he Advanced Reearch Projec Agency of he Deparmen of Defene under conrac NO0014-80-C0622. The work of R. E. Tarjan wa parially uppored by he Naional Science Foundaion under In IEEE Tranacion on PAMI, Vol. 26, No. 9, pp.gran 1124-1137, Sep. 2004 p.1 of Naval Reearch under Conrac N00014-87-K-0467. DCR-8605962 and he Office Auhor preen addree: A. V. Goldberg, Deparmen of Compuer Science, Sanford Univeriy, Sanford, CA 94305; R. E. Tarjan, AT&T Bell Laboraorie, 600 Mounain Ave., Murray Hill, NJ 07974-2070. VERMA, BATRA: MAXFLOW REVISITED o copy maerial i graned provided ha he copie are no An ExperimenalPermiion Comparion of wihou fee all or par of hi made or diribued Min-Cu/Max-Flow Algorihm for for direc commercial advanage, he ACM copyrigh noice and he ile of he publicaion and i dae appear, and noice i given ha copying i by permiion of he Aociaion for Energy Minimizaion in Viion Compuing Machinery. To copy oherwie, or omaxflow republih, require a fee and/or pecific permiion. Reviied: 0 1988 ACM 0004-541 l/88/00-0921 $01.50 Yuri Boykov and Vladimir Kolmogorov Be in pracice. Puh relabel mehod wih gap relabeling: O(m3/2) in pracice. Journal On I m p l e m e n i n g P u h - R e l a b e l M e h o d for he M a x i m u m Flow P r o b l e m EUROPEAN JOURNAL OF OPERATIONAL RESEARCH Bori V. Cherkaky 1 and Andrew V. Goldberg 2 1 Cenral Iniue for Economic and Mahemaic, Kraikova S. 32, 117418, Mocow, Ruia for Compuing Machinery. ELSEVIER Afer [15, 31, 19, 8, 25, 5] minimum cu/maximum flow algorihm on graph emerged a European Journal of Operaional Reearch 97 (1997) 509-542 An Empirical Comparion of Maxflow 1988, pp. 921-940. Algorihm for Dene Viion Problem Vol. 35, No. 4. Ocober Tanmay Verma an increaingly ueful ool for exac or approximae energy minimizaion in low-level viion. anmay08054@iiid.ac.in The combinaorial opimizaion lieraure provide many min-cu/max-flow algorihm wih Dhruv Bara differen polynomial ime complexiy. Their pracical efficiency, however, ha o dae been dbara@ic.edu IIIT-Delhi Delhi, India TTI-Chicago Chicago, USA udied mainly ouide he cope of compuer viion. The goal of hi paper i o provide an cher@eemi.mk.u 2 Compuer Science Deparmen, Sanford Univeriy Sanford, CA 94305, USA goldberg~c. anford, edu of he Aociaion Abrac 1 Theory and Mehodology experimenal comparion of he efficiency of min-cu/max flow algorihm for applicaion Ravindra A b r a c. We udy efficien implemenaion of he puh-relabel mehod for he maximum flow problem. The reuling code are faer han he previou code, and much faer on ome problem familie. The peedup i due o he combinaion of heuriic ued in our implemenaion. We alo exhibi a family of problem for which he running ime of all known mehod eem o have a roughly quadraic growh rae. a K. A h u j a a, M u r a l i K o d i a l a m Abrac in viion. We compare he running ime of everal andard algorihm, a well a a Compuaional inveigaion of maximum flow algorihm new algorihm ha we have recenly developed. The algorihm we udy include boh b, A j a y K. M i h r a c, J a m e B. O r l i n d,. Goldberg-Tarjan yle puh-relabel mehod and algorihm baed on Ford-Fulkeron Deparmen ~'lndurial and Managemen Engineering. Indian Iniue of Technology. Kanpur, 208 016, India b AT& T Bell Laboraorie, Holmdel, NJ 07733, USA c KA'F-ZGraduae School of Buine, Univeriy of Piburgh, Piburgh, PA 15260, USA d Sloun School of Managemen, Maachue Iniue of Technology. Cambridge. MA 02139. USA yle augmening pah. We benchmark hee algorihm on a number of ypical graph in he conex of image reoraion, ereo, and egmenaion. In many cae our new algorihm work everal ime faer han any of he oher mehod making near real-ime Received 30 Augu 1995; acceped 27 June 1996 performance poible. An implemenaion of our max-flow/min-cu algorihm i available Algorihm for finding he maximum amoun of flow poible in a nework (or maxflow) play a cenral role in compuer viion problem. We preen an empirical comparion of differen max-flow algorihm on modern problem. Our problem inance arie from energy minimizaion problem in Objec Caegory Segmenaion, Image Deconvoluion, Super Reoluion, Texure Reoraion, Characer Compleion and 3D Segmenaion. We compare 14 differen implemenaion and find ha he mo popularly ued implemenaion of Kolmogorov [5] i no longer he fae algorihm available, epecially for dene graph. upon reque for reearch purpoe. 1 Inroducion The rnaximum flow problem i a claical combinaorial problem ha come up in a wide variey of applicaion. In hi paper we udy implemenaion of he puh-rdabel [13, 17] mehod for he problem. The baic mehod for he maximum flow problem include he nework implex mehod of Danzig [6, 7], he augmening pah mehod of Ford and F~lkeron [12], he blocking flow mehod of Diniz [], and he puh-relabel mehod of Goldberg and Tarjan [14, 17]. (An earlier algorihm of Cherkaky [5] ha many feaure of he puh-relabel mehod.) The be heoreical ime bound for he maximum flow problem, baed on he laer mehod, are a follow. An algorihm of Goldberg and Tarjan [17] run in O(nm log(n2/m)) ime, an algo- Abrac The maximum flow algorihm i diinguihed by he long line of ucceive conribuion reearcher have made in obaining algorihm wih incremenally beer wor-cae complexiy. Some, bu no all, of hee heoreical improvemen have produced improvemen in pracice. The purpoe of hi paper i o e ome of he major algorihmic idea developed in he recen year and o ae heir uiliy on he empirical fron. However, our udy differ from previou udie in everal way. Wherea previou udie focu primarily on CPU ime analyi, our analyi goe furher and provide deailed inigh ino algorihmic behavior. I no only oberve how algorihm behave bu alo rie o explain why algorihm behave ha way. We have limied our udy o he be previou maximum flow algorihm and ome of he recen algorihm ha are likely o be efficien in pracice. Our udy encompae en maximum flow algorihm and five clae of nework. The augmening pah algorihm eed by u include Dinic' algorihm, he hore augmening pah algorihm, and he capaciy-caling algorihm. The preflow-puh algorihm eed by u include Karzanov' algorihm, hree implemenaion of Goldberg-Tarjan' algorihm, and hree verion of Ahuja-Orlin-Tarjan' exce-caling algorihm. Index Term Energy minimizaion, graph algorihm, minimum cu, maximum flow, image reoraion, egmenaion, ereo, muli-camera cene reconrucion. Yuri Boykov i wih he Compuer Science Deparmen a he Univeriy of Weern Onario, Canada, yuri@cd.uwo.ca. Vladimir Kolmogorov i wih Microof Reearch, Cambridge, England, vnk@microof.com. Thi work wa mainly done while he auhor were wih Siemen Corp. Reearch, Princeon, NJ. 1 Inroducion 75 Over he pa wo decade, algorihm for finding he maximum amoun of flow poible in a nework (or max-flow) have become he workhore of modern compuer viion and machine learning from opimal (or provably-approximae) inference in ophiicaed dicree model [6, 11, 27, 30, 32] o enabling real-ime image proceing [38, 39]. Perhap he mo prominen role of max-flow i due o he work of Hammer [23] and Kolmogorov and Zabih [27], who howed ha a fairly large cla of energy funcion um of ubmodular funcion on pair of boolean variable can be efficienly and opimally 76
Maximum-flow algorihm: Malab Maximum-flow algorihm: Google 77 78 Nework flow: quiz 7 7. NETWORK FLOW I max-flow and min-cu problem Ford Fulkeron algorihm max-flow min-cu heorem capaciy-caling algorihm hore augmening pah Diniz algorihm imple uni-capaciy nework Which max-flow algorihm o ue for biparie maching? A. Ford Fulkeron: O(m n C). B. Capaciy caling: O(m 2 log C). C. Shore augmening pah: O(m 2 n). D. Diniz algorihm: O(m n 2 ). we ll how ha Diniz algorihm run in O(m n 1/2 ) ime for biparie maching NETWORK FLOW AND TESTING GRAPH CONNECTIVITY* SHIMON EVEN" AND R. ENDRE TARJAN:I: Abrac. An algorihm of Dinic for finding he maximum flow in a nework i decribed. I i hen hown ha if he verex capaciie are all equal o one, he algorihm require a mo O(IV[ 1/2 IEI) ime, and if he edge capaciie are all equal o one, he algorihm require a mo O(I VI 2/3. IEI) ime. Alo, hee bound are igh for Dinic algorihm. Thee reul are ued o e he verex conneciviy of a graph in O(IVI 1/z. IEI 2) ime and he edge conneciviy in O(I V[ 5/3. IEI) ime. 80
Simple uni-capaciy nework Def. A flow nework i a imple uni-capaciy nework if: Every edge ha capaciy 1. Every node (oher han or ) ha exacly one enering edge, or exacly one leaving edge, or boh. Propery. Le G be a imple uni-capaciy nework and le f be a 0 1 flow. Then, reidual nework G f i alo a imple uni-capaciy nework. Ex. Biparie maching. 1 1 1 node capaciy = 1 Simple uni-capaciy nework Shore-augmening-pah algorihm. Normal augmenaion: lengh of hore pah doe no change. Special augmenaion: lengh of hore pah ricly increae. Theorem. [Even Tarjan 1975] In imple uni-capaciy nework, Diniz algorihm compue a maximum flow in O(m n 1/2 ) ime. Lemma 1. Each phae of normal augmenaion ake O(m) ime. Lemma 2. Afer n 1/2 phae, val( f ) val( f * ) n 1/2. Lemma 3. Afer n 1/2 addiional augmenaion, flow i opimal. Lemma 3. Afer n 1/2 addiional augmenaion, flow i opimal. Each augmenaion increae flow value by a lea 1. Lemma 1 and Lemma 2. Ahead. 81 82 Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. wihin a phae, lengh of hore augmening pah doe no change Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. conruc level graph advance 83 84
Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in LG unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in LG unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. augmen remove from level graph all edge in augmening pah advance 85 86 Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. rerea advance 87 88
Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in LG unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. Simple uni-capaciy nework Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in LG unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. augmen end of phae (lengh of hore augmening pah ha increaed) 89 90 Simple uni-capaciy nework: analyi Phae of normal augmenaion. Conruc level graph L G. Sar a, advance along an edge in L G unil reach or ge uck. If reach, augmen flow; updae L G ; and rear from. If ge uck, delee node from L G and go o previou node. Lemma 1. A phae of normal augmenaion ake O(m) ime. O(m) o creae level graph L G. O(1) per edge (each edge involved in a mo one advance, rerea, and augmenaion). O(1) per node (each node deleed a mo once). Nework flow: quiz 8 Conider running advance rerea algorihm in a uni-capaciy nework (bu no necearily a imple one). Wha i running ime? A. O(m). B. O(m 3/2 ). C. O(m n). ueful for hi week homework! D. May no erminae. boh indegree and oudegree of a node can be larger han 1 91 92
Simple uni-capaciy nework: analyi Lemma 2. Afer n 1/2 phae, val( f ) val( f * ) n 1/2. Afer n 1/2 phae, lengh of hore augmening pah i > n 1/2. Thu, level graph ha n 1/2 level (no including level for or ). Le 1 h n 1/2 be a level wih min number of node V h n 1/2. Simple uni-capaciy nework: analyi Lemma 2. Afer n 1/2 phae, val( f ) val( f * ) n 1/2. Afer n 1/2 phae, lengh of hore augmening pah i > n 1/2. Thu, level graph ha n 1/2 level (no including level for or ). Le 1 h n 1/2 be a level wih min number of node V h n 1/2. Le A = {v : l(v) < h} {v : l(v) = h and v ha 1 ougoing reidual edge}. cap f (A, B) V h n 1/2 val( f ) val( f * ) n 1/2. for flow f reidual nework Gf uni-capaciy imple nework reidual edge A V 1 V h V n 1/2 V 1 V h V n 1/2 93 94 Simple uni-capaciy nework: review Theorem. [Even Tarjan 1975] In imple uni-capaciy nework, Diniz algorihm compue a maximum flow in O(m n 1/2 ) ime. Lemma 1. Each phae ake O(m) ime. Lemma 2. Afer n 1/2 phae, val( f ) val( f * ) n 1/2. Lemma 3. Afer n 1/2 addiional augmenaion, flow i opimal. Corollary. Diniz algorihm compue max-cardinaliy biparie maching in O(m n 1/2 ) ime. 95