/0/ dmin lunch oday rading MX LOW PPLIION 0, pring avid Kauchak low graph/nework low nework direced, weighed graph (V, ) poiive edge weigh indicaing he capaciy (generally, aume ineger) conain a ingle ource V wih no incoming edge conain a ingle ink/arge V wih no ougoing edge every verex i on a pah from o 0 0 0 low conrain in-flow = ou-flow for every verex (excep, ) flow along an edge canno exceed he edge capaciy flow are poiive 0 0 0
/0/ Max flow problem Nework flow properie iven a flow nework: wha i he maximum flow we can end from o ha mee he flow conrain? 0 If one of hee i rue hen all are rue (i.e. each implie he he oher): f i a maximum flow f (reidual graph) ha no pah from o f = minimum capaciy cu 0 0 ord-ulkeron pplicaion: biparie graph maching ord-ulkeron(,, ) flow = 0 for all edge f = reidualraph() while a imple pah exi from o in f end a much flow along he pah a poible f = reidualraph() reurn flow iparie graph a graph where every verex can be pariioned ino wo e X and Y uch ha all edge connec a verex u X and a verex v Y
/0/ pplicaion: biparie graph maching pplicaion: biparie graph maching maching M i a ube of edge uch ha each node occur a mo once in M maching M i a ube of edge uch ha each node occur a mo once in M maching pplicaion: biparie graph maching pplicaion: biparie graph maching maching M i a ube of edge uch ha each node occur a mo once in M maching M i a ube of edge uch ha each node occur a mo once in M maching no a maching
/0/ pplicaion: biparie graph maching pplicaion: biparie graph maching maching can be hough of a pairing he verice iparie maching problem: find he large maching in a biparie graph Where migh hi problem come up? - deparmen ha n coure and m faculy - very inrucor can each ome of he coure - Wha coure hould each peron each? - nyime we wan o mach n hing wih m, bu no all hing can mach pplicaion: biparie graph maching pplicaion: biparie graph maching iparie maching problem: find he large maching in a biparie graph eup a a flow problem: idea? - greedy? - dynamic programming?
/0/ pplicaion: biparie graph maching pplicaion: biparie graph maching eup a a flow problem: edge weigh? eup a a flow problem: all edge weigh are pplicaion: biparie graph maching pplicaion: biparie graph maching eup a a flow problem: afer we find he flow, how do we find he maching? eup a a flow problem: mach hoe node wih flow beween hem
/0/ pplicaion: biparie graph maching pplicaion: biparie graph maching I i correc? ume i no here i a beer maching becaue of how we eup he graph flow = # of mache herefore, he beer maching would have a higher flow conradicion (max-flow algorihm find maximal!) Run-ime? o o build he flow? O() n each exiing edge ge a capaciy of n inroduce V new edge (o and from and ) n V i O() (for non-degenerae biparie maching problem) Max-flow calculaion? aic ord-ulkeron: O(max-flow * ) dmund-karp: O(V ) Preflow-puh: O(V ) pplicaion: biparie graph maching pplicaion: biparie graph maching Run-ime? o o build he flow? O() n each exiing edge ge a capaciy of n inroduce V new edge (o and from and ) n V i O() (for non-degenerae biparie maching problem) Max-flow calculaion? aic ord-ulkeron: O(max-flow * ) n max-flow = O(V) n O(V ) iparie maching problem: find he large maching in a biparie graph - deparmen ha n coure and m faculy - very inrucor can each ome of he coure - Wha coure hould each peron each? - ach faculy can each a mo coure a emeer? hange he edge weigh (repreening faculy) o
/0/ urvey eign urvey eign eign a urvey wih he following requiremen: eign urvey aking n conumer abou m produc an only urvey conumer abou a produc if hey own i Queion conumer abou a mo q produc ach produc hould be urveyed a mo ime Maximize he number of urvey/queion aked How can we do hi? each conumer can anwer a mo q queion q q q q conumer c c c produc capaciy edge if conumer owned produc p p each produc can be queioned abou a mo ime p c urvey deign I i correc? ach of he commen above he flow graph mach he problem conrain max-flow find he maximum maching, given he problem conrain dge ijoin Pah wo pah are edge-dijoin if hey have no edge in common Wha i he run-ime? aic ord-ulkeron: O(max-flow * ) dmund-karp: O(V ) Preflow-puh: O(V )
/0/ dge ijoin Pah dge ijoin Pah Problem wo pah are edge-dijoin if hey have no edge in common iven a direced graph = (V, ) and wo node and, find he max number of edge-dijoin pah from o Why migh hi be ueful? dge ijoin Pah Problem dge ijoin Pah iven a direced graph = (V, ) and wo node and, find he max number of edge-dijoin pah from o lgorihm idea? Why migh hi be ueful? edge are unique reource (e.g. communicaion, ranporaion, ec.) how many concurren (non-conflicing) pah do we have from o 8
/0/ dge ijoin Pah Max flow formulaion: aign uni capaciy o every edge dge ijoin Pah Max flow formulaion: aign uni capaciy o every edge Wha doe he max flow repreen? Why? - max-flow = maximum number of dijoin pah - correcne: - each edge can have a mo flow =, o can only be ravered once - herefore, each uni ou of repreen a eparae pah o Max-flow variaion Wha if we have muliple ource and muliple ink (e.g. he Ruian rain problem ha muliple ink)? Max-flow variaion reae a new ource and ink and connec up wih infinie capaciie capaciy nework capaciy nework 9
/0/ Max-flow variaion Max-flow variaion Verex capaciie: in addiion o having edge capaciie we can alo reric he amoun of flow hrough each verex Verex capaciie: in addiion o having edge capaciie we can alo reric he amoun of flow hrough each verex 0/ 0 0/ 0/0 0 0 0 0/0 0/ 0 0/0 Wha i he max-flow now? uni Max-flow variaion Max-flow variaion Verex capaciie: in addiion o having edge capaciie we can alo reric he amoun of flow hrough each verex 0 0 0 0 How can we olve hi problem? or each verex v - creae a new node v - creae an edge wih he verex capaciy from v o v - move all ougoing edge from v o v 0 0 0 0 an you now prove i correc? 0
/0/ Max-flow variaion Max-flow variaion Proof:. how ha if a oluion exi in he original graph, hen a oluion exi in he modified graph. how ha if a oluion exi in he modified graph, hen a oluion exi in he original graph Proof: we know ha he verex conrain are aified n no incoming flow can exceed he verex capaciy ince we have a ingle edge wih ha capaciy from v o v we can obain he oluion, by collaping each v and v back o he original v node n in-flow = ou-flow ince here i only a ingle edge from v o v n becaue here i only a ingle edge from v o v and all he in edge go in o v and ou o v, hey can be viewed a a ingle node in he original graph More problem: maximum independen pah wo pah are independen if hey have no verice in common More problem: maximum independen pah wo pah are independen if hey have no verice in common
/0/ More problem: maximum independen pah ind he maximum number of independen pah Idea? maximum independen pah Max flow formulaion: - aign uni capaciy o every edge (hough any value would work) - aign uni capaciy o every verex ame idea a he maximum edge-dijoin pah, bu now we alo conrain he verice More problem: wirele nework he campu ha hired you o eup he wirele nework here are currenly m wirele aion poiioned a variou (x,y) coordinae on campu he range of each of hee aion i r (i.e. he ignal goe a mo diance r) ny paricular wirele aion can only ho k people conneced You ve calculae he n mo popular locaion on campu and have heir (x,y) coordinae ould he curren nework uppor n differen people rying o connec a each of he n mo popular locaion (i.e. one peron per locaion)? Prove correcne and ae run-ime noher maching problem n people node and m aion node if di(p i,w j ) < r hen add an edge from pi o wj wih weigh (where di i euclidean diance) add edge -> p i wih weigh add edge w j -> wih weigh k add edge if di(p i, w j ) < r p w k p w m n - olve for max-flow - check if flow = m k
/0/ orrecne If here i flow from a peron node o a wirele node hen ha peron i aached o ha wirele node if di(pi,wj) < r hen add an edge from pi o wj wih weigh (where di i euclidean diance) only people able o connec o node could have flow add edge -> pi wih weigh each peron can only connec o one wirele node add edge wj -> wih weigh L a mo L people can connec o a wirele node If flow = m, hen every peron i conneced o a node Runime = O(mn): every peron i wihin range of every node V = m + n + max-flow = O(m), ha a mo m ou-flow O(max-flow * ) = O(m n): ord-ulkeron O(V ) = O((m+n)m n ): dmund-karp O(V ) = O((m+n) ): preflow-puh varian