Augmening Pah Algorihm Greedy-algorihm: ar wih f (e) = everywhere find an - pah wih f (e) < c(e) on every edge augmen flow along he pah repea a long a poible The Reidual Graph From he graph G = (V, E, c) and he curren flow f we conruc an auxiliary graph G f = (V, E f, c f ) (he reidual graph): Suppoe he original graph ha edge e = (u, v), and e = (v, u) beween u and v. G f ha edge e wih capaciy max{, c(e ) f (e ) + f (e )} and e wih wih capaciy max{, c(e ) f (e ) + f (e )}. 3 G u v G f u v c Ern Mayr, Harald Räcke 9. Generic Augmening Pah c Ern Mayr, Harald Räcke Augmening Pah Algorihm Definiion 5 An augmening pah wih repec o flow f, i a pah in he auxiliary graph G f ha conain only edge wih non-zero capaciy. Algorihm 5 FordFulkeron(G = (V, E, c)) : Iniialize f (e) for all edge. : while augmening pah p in G f do 3: augmen a much flow along p a poible. Augmening Pah Algorihm Theorem 5 A flow f i a maximum flow iff here are no augmening pah. Theorem 5 The value of a maximum flow i equal o he value of a minimum cu. Proof. Le f be a flow. The following are equivalen:. There exi a cu A, B uch ha val(f ) = cap(a, B).. Flow f i a maximum flow. 3. There i no augmening pah w.r.. f.. Generic Augmening Pah c Ern Mayr, Harald Räcke. Generic Augmening Pah c Ern Mayr, Harald Räcke
Augmening Pah Algorihm.. Thi we already howed.. 3. If here were an augmening pah, we could improve he flow. Conradicion. 3.. Le f be a flow wih no augmening pah. Le A be he e of verice reachable from in he reidual graph along non-zero capaciy edge. Since here i no augmening pah we have A and A. Augmening Pah Algorihm val(f ) = Thi finihe he proof. e ou(a) = e ou(a) f (e) c(e) = cap(a, V \ A) e ino(a) f (e) Here he fir equaliy ue he flow value lemma, and he econd exploi he fac ha he flow along incoming edge mu be a he reidual graph doe no have edge leaving A.. Generic Augmening Pah c Ern Mayr, Harald Räcke 3. Generic Augmening Pah c Ern Mayr, Harald Räcke Analyi Aumpion: All capaciie are ineger beween and C. Invarian: Every flow value f (e) and every reidual capaciy c f (e) remain inegral roughou he algorihm. Lemma 53 The algorihm erminae in a mo val(f ) nc ieraion, where f denoe he maximum flow. Each ieraion can be implemened in ime O(m). Thi give a oal running ime of O(nmC). Theorem 5 If all capaciie are ineger, hen here exi a maximum flow for which every flow value f (e) i inegral.. Generic Augmening Pah c Ern Mayr, Harald Räcke 5. Generic Augmening Pah c Ern Mayr, Harald Räcke
A bad inpu Problem: The running ime may no be polynomial. A bad inpu Problem: The running ime may no be polynomial. 999 998 999 998 999 998 999 998 Queion: Can we weak he algorihm o ha he running ime i polynomial in he inpu lengh? Queion: Can we weak he algorihm o ha he running ime i polynomial in he inpu lengh?. Generic Augmening Pah c Ern Mayr, Harald Räcke 7. Generic Augmening Pah c Ern Mayr, Harald Räcke 8 A Pahological Inpu Le r = ( 5 ). Then r n+ = r n r n+. r 5 How o chooe augmening pah? We need o find pah efficienly. We wan o guaranee a mall number of ieraion. 3 r 3 Several poibiliie: Chooe pah wih maximum boleneck capaciy. Chooe pah wih ufficienly large boleneck capaciy. Chooe he hore augmening pah. r + r 3 r 7 Running ime may be infinie!!!. Generic Augmening Pah c Ern Mayr, Harald Räcke 9. Generic Augmening Pah c Ern Mayr, Harald Räcke
=[fill=darkgreen,draw=darkgreen] Overview: Shore Augmening Pah Lemma 55 The lengh of he hore augmening pah never decreae. Lemma 5 Afer a mo O(m) augmenaion, he lengh of he hore augmening pah ricly increae.. Shore Augmening Pah c Ern Mayr, Harald Räcke. Shore Augmening Pah c Ern Mayr, Harald Räcke Overview: Shore Augmening Pah Thee wo lemma give he following heorem: Theorem 57 The hore augmening pah algorihm perform a mo O(mn) augmenaion. Thi give a running ime of O(m n). Proof. We can find he hore augmening pah in ime O(m) via BFS. O(m) augmenaion for pah of exacly k < n edge. Shore Augmening Pah Define he level l(v) of a node a he lengh of he hore -v pah in G f. Le L G denoe he ubgraph of he reidual graph G f ha conain only hoe edge (u, v) wih l(v) = l(u) +. A pah P i a hore -u pah in G f if i i a an -u pah in L G. G f L G 3 9 5. Shore Augmening Pah c Ern Mayr, Harald Räcke. Shore Augmening Pah c Ern Mayr, Harald Räcke 3
Shore Augmening Pah Fir Lemma: The lengh of he hore augmening pah never decreae. Afer an augmenaion he following change are done in G f. Some edge of he choen pah may be deleed (boleneck edge). Back edge are added o all edge ha don have back edge o far. Thee change canno decreae he diance beween and. G f L G Shore Augmening Pah Second Lemma: Afer a mo m augmenaion he lengh of he hore augmening pah ricly increae. Le E L denoe he e of edge in graph L G a he beginning of a round when he diance beween and i k. An - pah in G f ha doe ue edge no in E L ha lengh larger han k, even when conidering edge added o G f during he round. In each augmenaion one edge i deleed from E L. G f E L 9 3 9 9 5 9 9 3 9 9 5 9. Shore Augmening Pah c Ern Mayr, Harald Räcke. Shore Augmening Pah c Ern Mayr, Harald Räcke 5 Shore Augmening Pah Theorem 58 The hore augmening pah algorihm perform a mo O(mn) augmenaion. Each augmenaion can be performed in ime O(m). Theorem 59 (wihou proof) There exi nework wih m = Θ(n ) ha require O(mn) augmenaion, when we reric ourelve o only augmen along hore augmening pah. Shore Augmening Pah When icking o hore augmening pah we canno improve (aympoically) on he number of augmenaion. However, we can improve he running ime o O(mn ) by improving he running ime for finding an augmening pah (currenly we aume O(m) per augmenaion for hi). Noe: There alway exi a e of m augmenaion ha give a maximum flow.. Shore Augmening Pah c Ern Mayr, Harald Räcke. Shore Augmening Pah c Ern Mayr, Harald Räcke 7
Shore Augmening Pah We mainain a ube E L of he edge of G f wih he guaranee ha a hore - pah uing only edge from E L i a hore augmening pah. Wih each augmenaion ome edge are deleed from E L. When E L doe no conain an - pah anymore he diance beween and ricly increae. Noe ha E L i no he e of edge of he level graph bu a ube of level-graph edge. Suppoe ha he iniial diance beween and in G f i k. E L i iniialized a he level graph L G. Perform a DFS earch o find a pah from o uing edge from E L. Eiher you find afer a mo n ep, or you end a a node v ha doe no have any ougoing edge. You can delee incoming edge of v from E L.. Shore Augmening Pah c Ern Mayr, Harald Räcke 8. Shore Augmening Pah c Ern Mayr, Harald Räcke 9 Le a phae of he algorihm be defined by he ime beween wo augmenaion during which he diance beween and ricly increae. Iniializing E L for he phae ake ime O(m). The oal co for earching for augmening pah during a phae i a mo O(mn), ince every earch (ucceful (i.e., reaching ) or unucceful) decreae he number of edge in E L and ake ime O(n). The oal co for performing an augmenaion during a phae i only O(n). For every edge in he augmening pah one ha o updae he reidual graph G f and ha o check wheher he edge i ill in E L for he nex earch. How o chooe augmening pah? We need o find pah efficienly. We wan o guaranee a mall number of ieraion. Several poibiliie: Chooe pah wih maximum boleneck capaciy. Chooe pah wih ufficienly large boleneck capaciy. Chooe he hore augmening pah. There are a mo n phae. Hence, oal co i O(mn ).. Shore Augmening Pah c Ern Mayr, Harald Räcke 3.3 Capaciy Scaling c Ern Mayr, Harald Räcke 3
Capaciy Scaling Inuiion: Chooing a pah wih he highe boleneck increae he flow a much a poible in a ingle ep. Don worry abou finding he exac boleneck. Mainain caling parameer. G f ( ) i a ub-graph of he reidual graph G f ha conain only edge wih capaciy a lea. G f G f (99) 5 33 87 5 33 Capaciy Scaling Algorihm maxflow(g,,, c) : foreach e E do f e ; : log C 3: while do : G f ( ) -reidual graph 5: while here i augmening pah P in G f ( ) do : f augmen(f, c, P) 7: updae(g f ( )) 8: / 9: reurn f.3 Capaciy Scaling c Ern Mayr, Harald Räcke 3.3 Capaciy Scaling c Ern Mayr, Harald Räcke 33 Capaciy Scaling Aumpion: All capaciie are ineger beween and C. Invarian: All flow and capaciie are/remain inegral hroughou he algorihm. Correcne: The algorihm compue a maxflow: becaue of inegraliy we have G f () = G f herefore afer he la phae here are no augmening pah anymore hi mean we have a maximum flow. Capaciy Scaling Lemma There are log C ieraion over. Proof: obviou. Lemma Le f be he flow a he end of a -phae. Then he maximum flow i maller han val(f ) + m. Proof: le obviou, bu imple: An - cu in G f ( ) give me an upper bound on he amoun of flow ha my algorihm can ill add o f. The edge ha currenly have capaciy a mo in G f form an - cu wih capaciy a mo m..3 Capaciy Scaling c Ern Mayr, Harald Räcke 3.3 Capaciy Scaling c Ern Mayr, Harald Räcke 35
Capaciy Scaling Lemma There are a mo m augmenaion per caling-phae. Proof: Le f be he flow a he end of he previou phae. val(f ) val(f ) + m each augmenaion increae flow by. Theorem 3 We need O(m log C) augmenaion. The algorihm can be implemened in ime O(m log C)..3 Capaciy Scaling c Ern Mayr, Harald Räcke 3