Sovie Rail Nework, haper Nework Flow Slide by Kevin Wayne. opyrigh Pearon-ddion Weley. ll righ reerved. Reference: On he hiory of he ranporaion and maximum flow problem. lexander Schrijver in Mah Programming, :,. Maximum Flow and Minimum u Minimum u Problem Max flow and min cu.! Two very rich algorihmic problem.! ornerone problem in combinaorial opimizaion.! Beauiful mahemaical dualiy. Flow nework.! bracion 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. Nonrivial applicaion / reducion.! Daa mining.! Nework reliabiliy.! Open-pi mining.! Diribued compuing.! Projec elecion.! irline cheduling.! Egaliarian able maching.! Securiy of aiical daa.! Biparie maching.! Baeball eliminaion.! Nework inruion deecion.! Muli-camera cene reconrucion. ource ink! Image egmenaion.! Nework conneciviy.! Many many more... capaciy
u u Def. n - cu i a pariion (, B) of V wih! and! B. Def. n - cu i a pariion (, B) of V wih! and! B. Def. The capaciy of a cu (, B) i: cap(, B) = " c(e) e ou of Def. The capaciy of a cu (, B) i: cap(, B) = " c(e) e ou of apaciy = + + = apaciy = + + + = Minimum u Problem Flow Min - cu problem. Find an - cu of minimum capaciy. Def. n - 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 apaciy = + + = capaciy flow Value =
Flow Maximum Flow Problem Def. n - 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 Max flow problem. Find - flow of maximum value. capaciy flow Value = capaciy flow Value = Flow and u Flow and u Flow value lemma. Le f be any flow, and le (, 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 e in o Flow value lemma. Le f be any flow, and le (, 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 e in o Value = Value = + + - + =
Flow and u Flow and u Flow value lemma. Le f be any flow, and le (, 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 e in o Flow value lemma. Le f be any flow, and le (, B) be any - cu. Then " f (e)# " f (e) = v( f ). e ou of e in o Pf. by flow conervaion, all erm excep v = are v( f ) = " f (e) e ou of = % ( " ' " f (e) $ " f (e)* & ) v # e ou of v e in o v = " f (e) $ " f (e). e ou of e in o Value = - + - + = Flow and u Flow and u Weak dualiy. Le f be any flow, and le (, B) be any - cu. Then he value of he flow i a mo he capaciy of he cu. Weak dualiy. Le f be any flow. Then, for any - cu (, B) we have v(f) " cap(, B). Pf. u capaciy = # Flow value " v( f ) = " f (e)# " f (e) e ou of e in o $ " f (e) e ou of $ " c(e) e ou of = cap(, B)! B apaciy =
erificae of Opimaliy Toward a Max Flow lgorihm orollary. Le f be any flow, and le (, B) be any cu. If v(f) = cap(, B), hen f i a max flow and (, B) i a min cu. Value of flow = u capaciy = # Flow value " Greedy algorihm.! Sar wih f(e) = for all edge e! E.! Find an - pah P where each edge ha f(e) < c(e).! ugmen flow along pah P.! Repea unil you ge uck. Flow value = Toward a Max Flow lgorihm Toward a Max Flow lgorihm Greedy algorihm.! Sar wih f(e) = for all edge e! E.! Find an - pah P where each edge ha f(e) < c(e).! ugmen flow along pah P.! Repea unil you ge uck. Greedy algorihm.! Sar wih f(e) = for all edge e! E.! Find an - pah P where each edge ha f(e) < c(e).! ugmen flow along pah P.! Repea unil you ge uck. locally opimaliy # global opimaliy X X X Flow value = greedy = op =
Reidual Graph Ford-Fulkeron lgorihm Original edge: e = (u, v)! E.! Flow f(e), capaciy c(e). u capaciy flow v G: capaciy Reidual edge.! "Undo" flow en.! e = (u, v) and e R = (v, u).! Reidual capaciy: u 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) >. ugmening Pah lgorihm Max-Flow Min-u Theorem ugmen(f, c, P) { b $ boleneck(p) foreach e! P { if (e! E) f(e) $ f(e) + b ele f(e R ) $ f(e) - b reurn f Ford-Fulkeron(G,,, c) { foreach e! E f(e) $ G f $ reidual graph while (here exi augmening pah P) { f $ ugmen(f, c, P) updae G f reurn f forward edge revere edge ugmening pah heorem. Flow f i a max flow iff here are no augmening pah. Max-flow min-cu heorem. [Ford-Fulkeron ] The value of he max flow i equal o he value of he min cu. Proof raegy. We prove boh imulaneouly by howing he TFE: (i) There exi a cu (, B) uch ha v(f) = cap(, 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-u Theorem Running Time (iii) # (i)! Le f be a flow wih no augmening pah.! Le be e of verice reachable from in reidual graph.! By definiion of,!.! By definiion of f, &. v( f ) = " f (e)# " f (e) e ou of e in o = " c(e) e ou of = cap(, B) B umpion. ll capaciie are ineger beween and. Invarian. Every flow value f(e) and every reidual capaciie c f (e) remain an ineger hroughou he algorihm. Theorem. The algorihm erminae in a mo v(f*) " n ieraion. Pf. Each augmenaion increae value by a lea.! orollary. If =, Ford-Fulkeron run in O(mn) ime. Inegraliy heorem. If all capaciie are ineger, hen here exi a max flow f for which every flow value f(e) i an ineger. Pf. Since algorihm erminae, heorem follow from invarian.! original nework Ford-Fulkeron: Exponenial Number of ugmenaion. hooing Good ugmening Pah Q. I generic Ford-Fulkeron algorihm polynomial in inpu ize? m, n, and log. No. If max capaciy i, hen algorihm can ake ieraion. X X X X X X X X X
hooing Good ugmening Pah apaciy Scaling Ue care when elecing augmening pah.! Some choice lead o exponenial algorihm.! lever choice lead o polynomial algorihm.! If capaciie are irraional, algorihm no guaraneed o erminae! Goal: chooe augmening pah o ha:! an find augmening pah efficienly.! Few ieraion. Inuiion. hooing pah wih highe boleneck capaciy increae flow by max poible amoun.! Don' worry abou finding exac highe boleneck pah.! Mainain caling parameer '.! Le G f (') be he ubgraph of he reidual graph coniing of only arc wih capaciy a lea '. hooe augmening pah wih: [Edmond-Karp, Diniz ]! Max boleneck capaciy.! Sufficienly large boleneck capaciy.! Fewe number of edge. G f G f () apaciy Scaling apaciy Scaling: orrecne umpion. ll edge capaciie are ineger beween and. Scaling-Max-Flow(G,,, c) { foreach e! E f(e) $ ' $ malle power of greaer han or equal o G f $ reidual graph while (' ( ) { G f (') $ '-reidual graph while (here exi augmening pah P in G f (')) { f $ augmen(f, c, P) updae G f (') ' $ ' / reurn f Inegraliy invarian. ll flow and reidual capaciy value are inegral. orrecne. If he algorihm erminae, hen f i a max flow. Pf.! By inegraliy invarian, when ' = # G f (') = G f.! Upon erminaion of ' = phae, here are no augmening pah.!
apaciy Scaling: Running Time apaciy Scaling: Running Time Lemma. The ouer while loop repea + )log * ime. Pf. Iniially " ' <. ' decreae by a facor of each ieraion.! Lemma. Le f be he flow a he end of a '-caling phae. Then he value of he maximum flow i a mo v(f) + m '. proof on nex lide Lemma. There are a mo m augmenaion per caling phae.! Le f be he flow a he end of he previou caling phae.! L # v(f*) " v(f) + m (').! Each augmenaion in a '-phae increae v(f) by a lea '.! Theorem. The caling max-flow algorihm find a max flow in O(m log ) augmenaion. I can be implemened o run in O(m log ) ime.! Lemma. Le f be he flow a he end of a '-caling phae. Then value of he maximum flow i a mo v(f) + m '. Pf. (almo idenical o proof of max-flow min-cu heorem)! We how ha a he end of a '-phae, here exi a cu (, B) uch ha cap(, B) " v(f) + m '.! hooe o be he e of node reachable from in G f (').! By definiion of,!.! By definiion of f, &. v( f ) = " f (e) # " f (e) e ou of e in o $ " (c(e)# %) # " % e ou of e in o = " c(e) # " % # " % e ou of e ou of e in o $ cap(, B) - m% original nework B