Inenive Algorihm Lecure 24 Randomized Perfec Biparie Maching Lecurer: Daniel A. Spielman April 9, 208 24. Inroducion We explain a randomized algorihm by Ahih Goel, Michael Kapralov and Sanjeev Khanna for finding perfec maching in regular biparie graph. The paper, eniled Perfec Maching in O(n log n) Time in Regular Biparie Graph, appear in he SIAM Journal of Compuing, 203. Recall ha a graph i regular if every verex ha he ame degree. I i eay o how ha every regular biparie graph ha a perfec maching. Thi paper preen an incredibly imple algorihm for finding one. On a graph wih n verice and m edge, he algorihm find one in expeced ime O(n log n)! Ye, you read ha correcly. The running ime doe no depend on he number of edge preen in he graph. A fir hi ound aburd. Afer all, one hould have o read he enire inpu. In general, ha i rue. In hi cae, he running ime bound hold a long a he graph i provided in he correc forma. Wha he algorihm need i a li of he neighbor of every verex, and hi li need o be preened in uch a way ha he algorihm can chooe a random neighbor of a verex. Given hee li, he algorihm run in he aed ime. Noe ha hi i much faer han he maximum maching algorihm we previouly derived from he Ford-Fulkeron algorihm, which ake ime O(nm). Bu, he new algorihm can acually be underood a a randomized verion of Ford-Fulkeron. Keep in mind ha he new algorihm only work for biparie regular graph, wherea he algorihm we aw before find maximum maching in any biparie graph. 24.2 Perfec Maching in Biparie Graph To begin, le ee why regular biparie graph have perfec maching. Le G = (X Y, E) be a d-regular biparie graph wih X = Y = n. Recall ha Hall maching heorem ell u ha G conain a perfec maching if for every A X, N(A) A. We will ue hi heorem along wih ome elemenary couning o prove ha G ha a perfec maching. Theorem. If G = (X Y, E) i a regular biparie graph, hen N(A) A for every A X. Proof. Le d be he degree of every verex in G. A every verex in A ha degree d, here are d A edge ouching verice in A. Similarly, here are d N(A) edge ouching verice in N(A). A 24-
Lecure 24: April 9, 208 24-2 every edge ouching a verex in A mu alo ouch a verex in N(A), we have which implie A N(A). d A d N(A), 24.3 Review of Ford-Fulkeron We now review how he Ford-Fulkeron algorihm can be applied o find maximum maching in biparie graph. Le G = (X Y, E) be a biparie graph beween wo verex e, X and Y, boh of ize n. To conruc a maximum flow problem, we append wo addiional verice, and, and add direced edge from o every verex in X and from every verex in Y o. We alo direc every edge in E from X o Y. We now ry o find a maximum flow in he new graph, aking all edge capaciie o be. (a) A biparie graph (b) The graph of he direced flow problem. Le M E be a maching in he graph. I correpond o a flow ha end one uni from o x, from x o y, and from y o for every edge (x, y) M. So, he reidual graph of hi flow revere he direcion of all he edge in he maching, and of all he edge beween and and he mached verice. Recall ha he Ford-Fulkeron algorihm increae he flow by finding an augmening pah a pah from o in he reidual graph. Such a pah will never ue one of he edge beween and a mached verex, a i goe he wrong way. The ame hold for he edge beween and he mached verice. So, le ju ignore hoe edge. Now, le P be a pah from o in he reidual graph. When we add a flow of along i, i ha he effec of adding o he maching every edge in E P ha wa no in M, and removing from M every edge of E P ha wa in M, a you can ee in he figure below. 24.4 The Randomized Algorihm When we fir aw Ford-Fulkeron, we found augmening pah by running BFS from. In he randomized algorihm, we will find hem by aking random walk in he reidual graph from. We
Lecure 24: April 9, 208 24-3 (c) The original maching (d) The reidual flow graph wih a uni flow from o. (e) The updaed maching op he random walk when i ge o. The one cavea i ha we never reurn o : whenever he walk i a X i ep o Y. If here i an edge from ha verex in Y o, i ake i. If no, i walk along a back edge back o X. Tha i, we imagine a bug ha begin a. A each ep, i follow a random edge leaving i preen verex, bu never reurning o. I op when i reache. We le P be he pah of edge ha i follow. If we do hi in he reidual graph, we will find a pah from o. I i poible ha ome verice will appear wice on hi pah. Bu, ha i eay o deal wih: ju remove he cycle from he pah o make i a imple pah. We will how ha he expeced lengh of he pah will be hor. The lengh of he pah we find will be 3 plu wo ime number of back-edge i follow. So, i will uffice o bound he expeced number of back-edge in uch a pah. In paricular, we will prove he following heorem. Theorem 2. Le G = (X Y, E) be a regular biparie graph, le M be a maching conaining k edge, and le G M be he reidual graph of he correponding flow problem. The expeced number of back edge appearing in he random walk i a mo n n k. Thi mean ha early on in he algorihm we ake very few ep. If he preen maching ha fewer han n/2 edge, we expec o follow a mo one back-edge! Theorem 2 ell u ha he expeced number of ep we need o urn a maching of ize k ino one of ize k + i a mo 2 + 2 n n k. A we can um expecaion, we find he ha expeced number of ep required o go from a maching of ize 0 o one of ize n i a mo n (2 + 2 n n n k ) = 2n + 2n i. k=0 i=
Lecure 24: April 9, 208 24-4 The ummaion in hi la expreion i one ha we frequenly encouner. I i called he nh Harmonic number, and i known o approach γ + ln n, where γ = 0.57725 i Euler conan. For our purpoe, we ju require he fac ha An eay proof of hi come from n i=2 n i= i + ln n. n i dx = ln(n). x= x Reurning o he main ory, we conclude ha he expeced number of ep in all he augmening pah ued o conruc a perfec maching i a mo 2n + 2n( + ln n) = O(n log n). So, he algorihm ake expeced ime O(n log n). 24.5 Analyi of he random walk We now prove Theorem 2. Aume ha every verex of G ha degree d. Le X M and Y M denoe he mached verice in X and Y repecively. Alo le X U and Y U denoe he unmached verice. For any verex y Y, le M(y) be he verex in X wih which i i mached. For each verex v, le b(v) denoe he expeced number of back-edge ued in a random walk from v ha op when i reache. Our goal i o prove an upper bound on b(). We are going o do hi by eablihing relaion beween he value of b(v) for variou value of v, and hen combining hee relaion. To be ure ha we do no ge garbage when we ubrac one of hee expecaion from anoher, we hould be careful o check ha b(v) i finie for all v. We verify hi below in Theorem 3. A he walk fir move from o a random neighbor of, which i a random node in X U, b() = n k x X U b(x). For y Y U, he only edge leaving y poin o. So in hi cae b(y) = 0. On he oher hand, a verex y Y M ha one edge leaving i, and i goe o M(y). So, { 0 y Y U, b(y) = + b(m(y)) y Y M. A verex x X U ha d edge leaving i, all poining o differen verice in Y. The expeced number of back-edge in a walk from x will be he average of he expeced number of back-edge in a walk
Lecure 24: April 9, 208 24-5 from a random one of i neighbor. So, for x X U, b(x) = b(y) = db(x) = d A verex x X M only ha d edge leaving, a i i aached o one back-edge. So, for uch an x we have b(x) = b(y) = (d )b(x) = b(y). d M b(y). M Now recall ha for (x, y) M, b(y) = + b(x). By adding b(x) o boh ide, we find db(x) = + b(y). By umming hee equaion for b(x) over all x X, we obain d b(x) = k + b(y) x X x X A each verex y Y i aached o d verice in X, hi equal k + d y Y b(y), Plugging in our formula for b(y), we find b(y) = k + So, which give and d() = n k d x X y Y x X M b(x). b(x) = k + dk + d d x X U b(x) = (d )k x X U b(x) = (d )k d(n k) x X M b(x), k n k = n n k. 24.6 The expeced lengh i finie We now how ha if he algorihm ha no finihed hen b(v) i finie for every v. A lea, we prove hi for conneced graph. We do no need o prove i for diconneced graph, for wo reaon. Fir, we could pariion he graph ino conneced componen and hen find he biparie maching in each componen Second, we could inead prove ha he algorihm work by howing ha b(v) i finie for every v ha i reachable from, and hen ju ue hoe v in he analyi. Thi i a good hing, becaue when he graph i diconneced here can be verice v ha can no reach! Here i an example:
Lecure 24: April 9, 208 24-6 (f) A graph biparie (g) The graph of he direced flow problem. (h) A maching in he graph (i) The reidual graph. The boom verice have no pah o, bu are unreachable from. Theorem 3. While k < n, b(v) i finie for every v X Y. Proof. Le H be he graph of he correponding flow problem, le f be he flow correponding o M, and le H f be he reidual graph. In Theorem 4 we how ha here i a pah from every v X Y o in H f ha doe no go hrough. A uch a pah can ue a mo n back-edge, here i a non-zero probabiliy ha we reach afer uing n back-edge. Le p be he minimum over every verex v X Y of he probabiliy ha he walk ared from v reache afer uing n back-edge. A p > 0, he expeced number of back-edge ha we mu follow before reaching from any verex i a mo (n )/p. Tha i, he expeced number of ime we mu follow a pah of n back edge i a mo /p. Theorem 4. Le G = (X Y, E) be a conneced d-regular graph and le M be a maching in G of ize le han n. Le H be he graph of he correponding flow problem, le f be he flow correponding o M, and le H f be he reidual graph. Then here i a pah in H f ha doe no go hrough from every verex o. Proof. Le X B be he (poibly empy) ube of verie in X ha do no have a pah o, and le
Lecure 24: April 9, 208 24-7 Y B be he analogou ube of verice in Y. A every unmached verex in Y ha a direc pah o, all of he verice in Y B mu be mached. For each verex v ha i mached, le M(v) denoe i mach. Each mached verex y ha exacly one ou-going edge in H f, and i goe o M(y). So, y Y B if and only if M(y) X B. Thi ell u ha Y B X B. On he oher hand, all of he edge leaving an x X B mu go o a verex in Y B. Tha i N(X B ) Y B. Theorem now ell u ha Y B X B. Thu, we can conclude ha Y B = X B, and ha all of he edge ouching verice in X B end a verice in Y B, and vice vera. A he graph i conneced, hi implie ha eiher Y B = or Y B = Y. A we aumed ha he ize of he maching wa le han n, i mu be ha Y B, and hu X B, i empy. To ee ha here i a pah from o, noe ha here mu be ome unmached verex in X, and o ha an edge poining o i in H f. 24.7 Concluion I recommend ha you read he hiory ecion of he paper. You will be hocked by he more complicaed approache were ried and by how long i ook o obain hi reul. I i a nice reminder ha here remain unried, imple idea ha can reul in ubanial cienific progre.