Maximm Flo 5/6/17 21:08 Preenaion for e ih he exbook, Algorihm Deign and Applicaion, by M. T. Goodrich and R. Tamaia, Wiley, 2015 Maximm Flo χ 4/6 4/7 1/9 2015 Goodrich and Tamaia Maximm Flo 1 Flo Neork A flo neork (or j neork) N coni of n A eighed digraph G ih nonnegaie ineger edge eigh, here he eigh of an edge e i called he capaciy c(e) of e n To diingihed erice, and of G, called he orce and ink, repeciely, ch ha ha no incoming edge and ha no ogoing edge. Example: 5 6 3 1 1 2 3 7 9 5 2015 Goodrich and Tamaia Maximm Flo 2 1
Maximm Flo 5/6/17 21:08 Flo A flo f for a neork N i i an aignmen of an ineger ale f(e) o each edge e ha aifie he folloing properie: Capaciy Rle: For each edge e, 0 f (e) c(e) Coneraion Rle: For each erex, f ( e) = f e E ( ) + e E ( ) ( e) here E - () and E + () are he incoming and ogoing edge of, rep. The ale of a flo f, denoed f, i he oal flo from he orce, hich i he ame a he oal flo ino he ink Example: 1/3 3/7 2/9 4/5 2015 Goodrich and Tamaia Maximm Flo 3 Maximm Flo A flo for a neork N i aid o be maximm if i ale i he large of all flo for N The maximm flo problem coni of finding a maximm flo for a gien neork N Applicaion n Hydralic yem n Elecrical circi n Traffic moemen n Freigh ranporaion 1/3 3/7 2/9 4/5 Flo of ale 8 = 2 + 3 + 3 = 1 + 3 + 4 4/6 3/7 2/9 4/5 Maximm flo of ale 10 = 4 + 3 + 3 = 3 + 3 + 4 2015 Goodrich and Tamaia Maximm Flo 4 2
Maximm Flo 5/6/17 21:08 C A c of a neork N ih orce and ink i a pariion χ = (V,V ) of he erice of N ch ha V and V n Forard edge of c χ: origin in V n and deinaion in V Backard edge of c χ: origin in V and deinaion in V Flo f(χ) acro a c χ: oal flo of forard edge min oal flo of backard edge Capaciy c(χ) of a c χ: oal capaciy of forard edge Example: n c(χ) = 24 n f(χ) = 8 2015 Goodrich and Tamaia Maximm Flo 5 5 6 χ χ 3 1 1 2 3 1/3 7 9 3/7 2/9 5 4/5 Flo and C Lemma: The flo f(χ) acro any c χ i eqal o he flo ale f Lemma: The flo f(χ) acro a c χ i le han or eqal o he capaciy c(χ) of he c Theorem: The ale of any flo i le han or eqal o he capaciy of any c, i.e., for any flo f and any c χ, e hae f c(χ) χ 1 χ 2 1/3 3/7 2/9 4/5 c(χ 1 ) = 12 = 6 + 3 + 1 + 2 c(χ 2 ) = 21 = 3 + 7 + 9 + 2 f = 8 2015 Goodrich and Tamaia Maximm Flo 6 3
Maximm Flo 5/6/17 21:08 Agmening Pah Conider a flo f for a neork N Le e be an edge from o : n Reidal capaciy of e from o : Δ f (, ) = c(e) - f (e) n Reidal capaciy of e from o : Δ f (, ) = f (e) Le π be a pah from o n The reidal capaciy Δ f (π) of π i he malle of he reidal capaciie of he edge of π in he direcion from o A pah π from o i an agmening pah if Δ f (π) > 0 2015 Goodrich and Tamaia Maximm Flo 7 2/5 π 1/3 2/7 2/9 Δ f (,) = 3 Δ f (,) = 1 Δ f (,) = 1 Δ f (,) = 2 Δ f (π) = 1 f = 7 4/5 Flo Agmenaion Lemma: Le π be an agmening pah for flo f in neork N. There exi a flo fʹ for N of ale fʹ = f + Δ f (π) Proof: We compe flo fʹ by modifying he flo on he edge of π 2/3 n Forard edge: fʹ (e) = f(e) + Δ f (π) 2/7 n Backard edge: fʹ (e) = f(e) - Δ f (π) 2/9 4/5 2015 Goodrich and Tamaia Maximm Flo 8 2/5 π 1/3 2/7 2/9 Δ f (π) = 1 π 4/5 f = 7 fʹ = 8 4
Maximm Flo 5/6/17 21:08 The Ford-Flkeron Algorihm Iniially, f(e) = 0 for each edge e Repeaedly n Search for an agmening pah π n Agmen by Δ f (π) he flo along he edge of π A pecialiaion of DFS (or BFS) earche for an agmening pah n An edge e i raered from o proided Δ f (, ) > 0 2015 Goodrich and Tamaia Maximm Flo 9 Max-Flo and Min-C Terminaion of Ford- Flkeron algorihm n There i no agmening pah from o ih repec o he crren flo f Define V e of erice reachable from by agmening pah V e of remaining erice C χ = (V,V ) ha capaciy c(χ) = f n Forard edge: f(e) = c(e) n Backard edge: f(e) = 0 Th, flo f ha maximm ale and c χ ha minimm capaciy Theorem: The ale of a maximm flo i eqal o he capaciy of a minimm c 4/6 χ 4/7 1/9 c(χ) = f = 10 2015 Goodrich and Tamaia Maximm Flo 10 5
Maximm Flo 5/6/17 21:08 Example (1) 0/6 0/3 0/2 0/3 1/7 0/9 0/5 1/6 1/3 0/3 2/7 0/9 0/3 1/3 0/6 1/6 1/7 2/7 1/3 2/3 0/9 0/9 2015 Goodrich and Tamaia Maximm Flo 11 Example (2) 3/6 2/3 2/7 0/9 4/6 o ep 3/7 1/9 2/5 3/6 4/6 2/7 4/7 1/9 2/5 1/9 2015 Goodrich and Tamaia Maximm Flo 12 6
Maximm Flo 5/6/17 21:08 Analyi In he or cae, Ford- Flkeron algorihm perform f* flo agmenaion, here f* i a maximm flo Example n The agmening pah fond alernae beeen π 1 and π 2 n The algorihm perform 100 agmenaion Finding an agmening pah and agmening he flo ake O(n + m) ime The rnning ime of Ford- Flkeron algorihm i O( f* (n + m)) 2015 Goodrich and Tamaia Maximm Flo 13 0/50 0 0/50 0 π 1 π 2 0 0 0 0 Maximm Biparie Maching In he maximm biparie maching problem, e are gien a conneced ndireced graph ih he folloing properie: n The erice of G are pariioned ino o e, X and Y. n Eery edge of G ha one endpoin in X and he oher endpoin in Y. Sch a graph i called a biparie graph. A maching in G i a e of edge ha hae no endpoin in common ch a e pair p erice in X ih erice in Y o ha each erex ha a mo one parner in he oher e. The maximm biparie maching problem i o find a maching ih he greae nmber of edge. 2015 Goodrich and Tamaia Maximm Flo 14 7
Maximm Flo 5/6/17 21:08 Redcion o Max Flo Gien a flo f for H, e e f o define a e M of edge of G ing he rle ha an edge e i in M heneer f(e) = 1. 2015 Goodrich and Tamaia Maximm Flo 15 Example and Analyi Rnning ime i O(nm), becae G i conneced. 2015 Goodrich and Tamaia Maximm Flo 16 8
Maximm Flo 5/6/17 21:08 Baeball Eliminaion Le T be a e of eam in a por leage, hich, for hiorical reaon, le ame i baeball. A any poin dring he eaon, each eam, i, in T, ill hae ome nmber, i, of in, and ill hae ome nmber, g i, of game lef o play. The baeball eliminaion problem i o deermine heher i i poible for eam i o finih he eaon in fir place, gien he game i ha already on and he game i ha lef o play. Noe ha hi depend on more han j he nmber of game lef for eam i, hoeer; i alo depend on he repecie chedle of eam i and he oher eam. 2015 Goodrich and Tamaia Maximm Flo 17 Baeball Eliminaion Example Le g i,j denoe he nmber of game remaining beeen eam i and eam j, o ha g i i he m, oer all j, of he g i,j. 2015 Goodrich and Tamaia Maximm Flo 18 9
Maximm Flo 5/6/17 21:08 Redcion o Max Flo Le ame no ingle eam eliminae eam k (ince hi i eay o check). 2015 Goodrich and Tamaia Maximm Flo 19 Creaing he Graph To conider ho a combinaion of eam and game ocome migh eliminae eam k, e creae a graph, G, ha ha a i erice a orce,, a ink,, and he e T and L. Then, le inclde he folloing edge in G: 2015 Goodrich and Tamaia Maximm Flo 20 10
Maximm Flo 5/6/17 21:08 Creaing he Graph, Example 2015 Goodrich and Tamaia Maximm Flo 21 Iniion and Analyi We can ole baeball eliminaion for any eam in a e of n eam by oling a ingle maximm flo problem on a neork ih a mo O(n 2 ) erice and edge. 2015 Goodrich and Tamaia Maximm Flo 22 11