Extending Kargers randomized min-cut Algorithm for a Synchronous Distributed setting
A min-cut that seperates vertices s and t in a network is an edge set of minimum weight whose removal will disconnect s and t. This problem is the dual of the well known s-t max-flow problem. Several algorithms for the min-cut problem are based on ma…
Authors: S. Shine, K. Murali Krishnan
Extending Karger’ s randomized min-cut Algorithm f or a Synchr ono us Di strib uted setting Shine S Dept. of Computer Science and Engineering College of Engin eering T rivandrum K erala, India shine@cs.cet.ac.in K. Murali K rishnan Dept. of Computer Science and Engineering National Institute of T echnology Calicut K erala, India kmur ali@nitc.ac.in ABSTRA CT A min-cut that sep erates vertices s a nd t in a netw ork is an edge set of minim um we ight whose remo v al will discon- nect s and t . This problem is th e dual of the well k n o wn s − t max-flow problem. Several algo rithms for the min-cut problem are b ased on max-flow computation although the fastest kn o wn min-cut algorithms are not flow based. The w ell know n Karger’s randomized algorithm for min-cu t is a non-flow based method for solving the (global) min-cut prob- lem of finding the min s − t cut ov er all pair of vertices s, t in a we ighted undirected graph. This pap er p resen ts an adap- tation of Karger’s algorithm for a synchronous d istribu t ed setting where eac h node is allo w ed to p erform only local computations. The pap er essen tially addresses the techni- calities inv olv ed in circumv enting the limitations imp osed by a distributed setting to t h e wo rking of K arger’s algorithm. While the correctness pro of follo ws d irectly from Karger’s algorithm, the complexity analysis differs significan tly . The algorithm ac h ieve s the same probabilit y of success as the original algorithm with O ( mn 2 ) message complexit y and O ( n 2 ) time complexity , where n and m denote the num b er of vertices an d edges in the graph. Categories and Subject Descriptors [ Distributed Algorithms ]: Metrics— c omplexity me asur es ; [ Graph Theory ]: Miscellaneous General T erms Netw ork-flo w Keyw ords Max-flow, Min- cut 1. INTR ODUCTION The problem of computing the minimum-cut in a w eigh ted graph has b een classically studied in literature as th e dual of the w ell known max-flow problem for net wor ks [5] and clas- sical solutions to the max-flow problem were used to solve the min- cut problem. These algorithms could b e classified as th ose b ased on augmenting paths [5, 4], impro vemen ts to the augmenting path approach b ased on blo cking flows [3, 12] and those based on pre-flow metho d introduced by Goldb erg and T arja n[6]. The b est kno wn algo rithms for the max-fl o w problem are based on t he preflow approac h[1, 17, 7 ]. The max-flow p rob lem also has b een recently studied in a dis- tributed setting in [2]. F urther in vestigatio ns revealed th at there are more efficient direct solutions to the min-cut problem ( without solving max-flow and taking the dual). Nagamo chi and I baraki[13] published the first deterministic global minimum cut algo- rithm that is not based on flo w, bu t wa s rath er compli- cated. S toer and W agner[16] presented a simple determin- istic global minimum cut algorithm which runs in O ( mn + n 2 log n ). Karger[8] presen ted the first randomized global min-cut al- gorithm which runs in O ( mn 2 log 3 n ). The running time of a single trial of the algorithm is O ( m log 2 n ). The alg orithm has to b e repeated n 2 log n times to ac hieve a h igh success probabilit y of 1 − 1 n . Karger and S tein[9] further impro ved its running time to O ( n 2 log 3 n ) for the same probability . Recently there has b een revived interest in the min-cut prob- lem o wing to its applications to netw ork cod ing and wireless sensor netw orks [15, 10, 14]. Sensor netw orks op erate in a distributed setting and motiv ates a solution to the problem in a distributed setting. In this p ap er, we show how Karger’s algorithm[8 ] can b e adapted to efficiently solv e the min-cut problem in a d is- tributed setting. W e assume a very general mo d el of a graph where each n od e kn o ws only in formation abou t its neigbou rs. I t is assumed th at the storage capaci ty of a n o de is b ounded linearly in the size of the num b er of its neigb ours and the computing capacit y of a no de is b ounded p olyno- mially in the num b er of its neighbours. The assumption is reasonable as each no de must hav e storage and processing capacit y sufficient to ke ep track of comm unication with its neighbours. The nodes can p erform local computations and can communicate only with its neighbours along the ed ges of th e graph. Ou r ob jective is to find the val ue of th e glo bal min-cut and comm unicate the same to all the n odes. More- o ver, eac h no de m ust know which among the edges inciden t on it are p resent in the min-cut computed. While the cor- rectness pro of follow s directly from K arger’s algorithm, the complexity analysis differs significan tly . W e show that for a graph of n vertices and m edges, th e algorithm computes the global min- cu t with probability atleast 1 − 1 n with O ( mn 2 ) message complexity and O ( n 2 ) time complexit y when there is a global cloc k for sync hronization. W e n ote that although the assumption of a global clo ck ma y b e impractical in app li- cations like sensor n etw orks, th ere are standard tec hniqu es for converti ng synchronous distributed algorithms to asyn- chronous algorithms, with some loss in computational effi- ciency[11]. W e p ursue the simpler synchronous setting here as it allo ws a less cumb ersome p resentation of th e algorithm and a simple analysis. 2. THE ALGORITHM 2.1 A Brief Description Assume that given a weigh ted graph G = ( V , E , w ) where E ⊆ V × V a nd w : E → R + ∪ { 0 } is given(W e use the terms netw ork and graph interc hangeably). I n our algorithm N u represents the neighbourh oo d of vertex u , w eig ht u repre- sents the present edge w eigh ts of N u , that is, for eac h v ∈ N u , weig ht u [ v ] indicates the weig ht of edge ( u, v ). r a nk u [ v ] is the rank of edge ( u, v ), a random num b er which is uni- formly chosen b etw een 1 and m k (for some fix ed k ≥ 5), on each t rial. maxr a nk represents th e maxim um va lue of rank among all the edges. Initially max r ank u is defined as the maximum rank of the edges connected to vertex u . The algorithm sets maxr ank = M ax u ∈ V ( G ) maxr ank u . The status of a vertex ma y b e A C T I V E or I N AC T I V E (ini- tially AC T I V E ). status u = I N AC T I V E if all neighbour- ing edge weigh ts of v ertex u are 0, whic h means that vertex cannot initiate the contraction pro cess. W e call an edge active if at least one of its en d p oin ts is active. The algori thm p roceeds by simulating edge contractio ns as in[8], by collecting vertice s joined together by contraction into vertex gr oups . Edges within a group are inactive as they cannot be further contracted. At each step, an activ e edge of maximum rank is c hosen for contraction. Since edge ranks are assigned u n iformly at random, each active edge has equal probabilit y for getting con tracted. The algorithm conti nues contractions till only tw o vertex groups remain and the set of edges acros s the tw o groups is c hosen as the mincut for that trial. T he smallest cut found in n 2 log n trials will b e the mincut with p robabilit y 1 − 1 n . The va riable la stmsg u stores th e last message received at vertex u (used to reduce message floo ding) and the b oolean v ariable stop u is set to tr ue when only tw o vertex groups are remaining and no more con traction can b e made, and set to f alse otherwise. The v ariable g u represents the present group id of vertex u , initially g u = u . In itially th ere are n groups, one for eac h vertex. As contractions progress, the num b er of groups re- duces an d we set w eig ht u [ v ] = 0 if g u = g v and we ig ht u [ v ] 6 = 0 otherwise. The follo wing description presen ts a high level view of the algorithm. 2.2 Details of the Algorithm Algorithm 1 distribut ed -mincut-in-a- nutshell() assign a r ank (b etw een 1 and m k ) to eac h non-zero w eighted edge. { Algorithm 4 } At each nod e u of the netw ork ex ecute the follo wing: find maxr ank u of each v ertex u lo cally . { Algorithm 5 } find the vertex x (with largest vertex id) having th e max- im um v alue of max r ank . { Algorithms 6, 14 } if there are only t wo groups then { Algorithms 7, 9, 15, 16, 21 } compute lo cal mincut m c u by summing the non-zero edge w eigh ts of v ertex u . { Algorithm 10 } compute global mincu t by summing up all lo cal min - cuts. { Algorithms 11, 22 } broadcast the mincut to all no des an d stop . { Algo- rithms 12, 23 } else contra ct t w o vertex gro ups b y making the edge w eights b etw een them zero and group ids eq ual to the v alue of maxr ank ( The con traction pro cess is initiated by the vertex x ). { Algorithms 7, 8, 17 } rep eat the algori thm end if Eac h no de in the netw ork executes Algorithm 2 describ ed b elo w. Here, th e function initializ e () initializes th e group id of eac h vertex with its vertex id. The function as sig n - r ank () assigns a r ank t o eac h non- zero w eighted edge with in t h e netw ork, with a rand om v alue betw een 1 and m k . The time complexity for this function is O ( n ). The function f ind - local - maxr ank () computes th e maxim um rank within its neighbourho od , with time complexity O ( n ). The function f ind - g l obal - m axr ank () comput es the m ax im um of all t he local - maxr ank s within th e netw ork, with time complexity O ( n ) and message complexit y O ( mn ). The function check - e lig ibil ity - and - contra ct () chec ks whether there are more t han tw o groups within the netw ork and if so, contra cts tw o groups by making all the edge weigh ts b etw een them zero and th eir group ids t h e same. This can b e accom- plished with time complexity O ( n ) and message complex- it y O ( m ). The function check - t er mination - status () checks whether there are only tw o groups within th e net wo rk and if so, inv okes mincut comput ation and h alts, otherwise the algorithm is repeated. This can be accomplished with time complexity O ( n ) and message complexity O ( m ). A ll the above men tioned functions except initial iz e () h as to b e re- p eated n − 2 times. The function f ind - local - mincut () computes the sum of edge w eights within its neighbourho o d, with time complexity O ( n ). The function f ind - g lobal - mincut () computes the t he sum of all local - mincuts within the netw ork, with time complexity O ( n 2 ) and messa ge complexit y O ( mn ). No de u messag es to nod e u + 2 i − 1 in step i , for i ∈ { 1 , ... log n } to ensure that the messages propagate to all no des in O ( n 2 ) time with only O ( m n ) messages. The function broa dcast - mincut () broad- casts the comput ed mincut v alue to all the no des within th e netw ork, which is d one with time complexity O ( n ) and mes- sage complexity O ( m ). The fun ct ion sy nchroniz e () allo ws the n od es to w ait for some time so that the same instru ction can be executed by each n o de, in the next time step. This function w aits for O ( n ) steps. Algorithm 2 distributed-mincu t() //T o b e executed at eac h n o de initialize() repe at assign-rank() find-lo cal-maxrank() find-global-maxrank() synchronize() chec k-eligibilit y-and-contract() synchronize() chec k-termination-status() synchronize() un til stop u = t r ue find-lo cal-mincut() find-global-mincut() synchronize() broadcast-mincut() Algorithm 3 initialize() g u ← u Algorithm 4 assign-rank() { Rank of an edge to b e assigned by higher numbered end- p oin t } for eac h v ∈ N u do if u > v then if we ig ht u [ v ] 6 = 0 then r ank u [ v ] ← a random number betw een 1 and m k else r ank u [ v ] ← 0 end if send(SET-RAN K, r ank u [ v ]) to v . { See Algorithm 13 for receipt of message } end if end for Algorithm 5 fin d-local-maxrank () maxr ank u ← m ax v ∈ N u ( r ank u [ v ]) Algorithm 6 fin d-global-maxrank() send(FIND- MA X-RAN K, maxr ank u ) to each v ∈ N u . { See Algorithm 14 for receipt of message } Algorithm 7 chec k-eligibility-and-con tract() stop u ← tr ue if max r ank u = m ax v ∈ N u ( r ank u [ v ]) and u > v then if ∃ w ∈ N u with weig ht u [ w ] 6 = 0 and v 6 = w and g v 6 = g w then stop u ← f a lse contra ct() else send(IS-ELIGI BLE-CON TRACT , u , g u , g v ) to eac h x ∈ N u . { See Algorithm 15 for receipt of message } end if end if Algorithm 8 contract() if maxr ank u = m ax v ∈ N u ( r ank u [ v ]) and u > v the n we ig ht u [ v ] ← 0 chec k-active() g u ← maxr a nk u send(SET-GROUP-ID, g u , g v , maxr ank u ) to eac h x ∈ N u with weig ht u [ x ] = 0. { S ee Algorithm 17 for receipt of message } end if Algorithm 9 chec k-termination-status() send(STOP , s top u ) to eac h x ∈ N u . { See A lgorithm 21 for receipt of message } Algorithm 10 find -local-mincu t () if status u = A C T I V E then mc u ← P v ∈ N u we ig ht u [ v ] else mc u ← 0 end if Algorithm 11 find -global-mincut() for i ← 1 to log n step by 1 do for j ← 2 i − 1 to n − 1 step by 2 i do if u = j then send(LOCAL-MC, mc u , u , min( u + 2 i − 1 , n )) to eac h v ∈ N u . { See A lgorithm 22 for receipt of message } end if synchronize() end for end for Algorithm 12 broadcast-mincut( ) if u = n then mc u ← m c u / 2 send(MINCUT, mc u , u ) t o each v ∈ N u . { See Algo- rithm 23 for receipt of message } end if Algorithm 13 up on receipt of (SET-R ANK, num ) msg from w r ank u [ w ] ← num Algorithm 14 up on receipt of (FIND- MAX-RAN K, m ) msg from w { find maxim um rank among all v ertices } if m > ma xr ank u then maxr ank u ← m send(FIND- MA X-RAN K, m ) to eac h v ∈ N u where v 6 = w end if Algorithm 15 upon recei pt of ( I S-ELIGIBLE- CONTRACT, v , g ′ , g ′′ ) msg from w { c hecks the eligi bility of contraction } if (IS-ELIGIBLE-CONTRACT, v , g ′ , g ′′ ) 6 = lastmsg u then if ∃ y ∈ N u with w eig ht u [ y ] 6 = 0 and g y 6 = g ′ and g y 6 = g ′′ then send(ELIGIBLE-CONTRACT, v , g ′ ) to each z ∈ N u with w eig ht u [ z ] = 0 or ( w eig ht u [ z ] 6 = 0 and g z = g ′ ). { See Algorithm 16 for receipt of message } else send(IS-ELIGI BLE-CON TRACT , v , g ′ , g ′′ ) to each z ∈ N u with w eig ht u [ z ] = 0 and z 6 = w end if lastm sg u ← (IS- ELIGIBLE-CONTRACT, v , g ′ , g ′′ ) end if Algorithm 16 u p on receipt of (ELIGIBLE-CONTRACT, v , g ′ ) msg from w if (ELIGIBLE-CONTRACT, v , g ′ ) 6 = la stmsg u then if u = v then stop u ← f a lse contra ct() else send(ELIGIBLE-CONTRACT, v , g ′ ) to each z ∈ N u , z 6 = w with w eig ht u [ z ] = 0 or ( w eig ht u [ z ] 6 = 0 and g z = g ′ ) end if lastm sg u ← (ELIGIBLE-CONTRACT, v , g ′ ) end if Algorithm 17 upon receipt of (SET-GROUP-ID, g ′ , g ′′ , new r ank ) msg from w { up date group id of all ve rtices in the groups g’ an d g” by maxr ank u by sending mess ages } if g u 6 = new r ank then we ig ht u [ w ] ← 0 chec k-active() g u ← new r ank if status u = A C T I V E then for all v ∈ N u with w eig ht u [ v ] 6 = 0 do if g v = g ′ or g v = g ′′ or g v = new r ank then we ig ht u [ v ] ← 0 chec k-active() send(SET-WEIGHT) to v . { See Algorithm 19 for receipt of message } end if end for end if send(SET-GROUP-ID, g ′ , g ′′ , new r ank ) to each x ∈ N u where w eig ht u [ x ] = 0 end if Algorithm 18 synchronize() { w aits for all no des to reach the same step of algori thm } w ait for n pulses Algorithm 19 upon receipt of (SET-WEIGHT) msg from w we ig ht u [ w ] ← 0 chec k-active() Algorithm 20 chec k-active() if ∀ v ∈ N u , w eig ht u [ v ] = 0 then status u = I N AC T I V E end if Algorithm 21 up on receipt of ( STOP , t ) msg from w { broadcast t h e information on th e number of groups in the netw ork } if (STOP , t ) 6 = l astm sg u then if t = f al se then stop u ← f a lse send(STOP , t ) to each x ∈ N u lastm sg u ← (STOP , t ) end if end if 2.3 Corr ectness First, we b oun d th e probability of error created by ed ges getting the same rank. Lemma 2.3.1. The pr ob ability that two e dges get the same r ank in n trials is O ( n − 2 ) . Pr oof. The rank is a val ue from the set { 1 ...m k } . The probabilit y that tw o edges m and m ′ having th e same rank, P r [ r ank ( m ) = r ank ( m ′ )] ≤ 1 m k Hence, P r [ ∃ ( m, m ′ ) : r ank ( m ) = r ank ( m ′ )] ≤ P ( m,m ′ ) ∈ E × E P r [ r ank ( m ) = r ank ( m ′ )] ≤ m 2 m k = 1 m k − 2 Thus, using the un ion b ound, probability that there exists tw o edges m and m ′ having the same rank in n iterations is ≤ n m k − 2 ≤ m m k − 2 = 1 m k − 3 . No w choose k ≥ 5. Then, P r [ r ank ( m ) = r ank ( m ′ )] ≤ 1 m 2 = O ( n − 2 ). The follo wing Lemma proceeds exactly as in [8]. Lemma 2.3.2. A p articular mi n-cut in G i s pr o duc e d by the c ontr action algorithm with pr ob ability Ω( n − 2 ) . Pr oof. Let c b e the va lue of the mincut in G . Eac h contra ction reduces the number of vertices in the graph by one. Consider the contraction executed when the graph has r vertices. Since the contracted graph has a min-cut of at least c , it must hav e minim um degree c , and thus atleast r c 2 edges. H o wev er, only c of these edges are in min-cut. Thus, a randomly chosen edge is in the min-cut with probability at most 2 r . The probabilit y that w e never con tract a min -cut edge through all n − 2 contractions is atleast (1 − 2 n )(1 − 2 n − 1 )(1 − 2 n − 2 ) .... (1 − 2 3 ) = n 2 − 1 = Ω( n − 2 ) Algorithm 2 2 up on receipt of (LOCAL-MC, mcut , x , v ) msg from w { computes mincut partially } if (LOCAL-MC, mcut , x , v ) 6 = l astmsg u then if u = v then mc u ← m c u + m cut else send(LOCAL-MC, mcut , x , v ) to each y ∈ N u end if lastm sg u ← (LOCAL-MC, mcut , x , v ) end if Algorithm 23 up on receipt of (MINCUT, v , mincut ) msg from w { broadcasts the mincut to all no des } if (MINCUT, v , mincut ) 6 = l astmsg u then mc u ← m incut send(MINCUT, v , mincut ) to each y ∈ N u lastm sg u ← (MINCUT, v , mincut ) end if 2.4 Complexity Analysis 2.4.1 Message comple xity Theorem 2.4.1. The Kar ger’s distribute d algorithm uses O ( m n 2 ) messages, in a single trial. Pr oof. It is not hard to see that the most exp ensive steps in a trial are those of determination of m axr ank from lo- cal maxranks(fin d-global-maxrank()) and that of computing the mincut at the end(find- global-mincut()). I n find -global- maxrank(), each no de sends its lo cal maxrank v alue to its neighbours and this is rep eated atmost n times(num b er of times equal to the diameter of the graph sufficies). Hence the total num b er of messages is b ou n ded b y nO ( m + n ) = O ( m n ). Thus the message complexity for n − 2 iterations p er trial is O ( mn 2 ). Finally , in step i of find- global-mincut(), n 2 i nod es send messages to its neighbours. The total num- b er of messages sent at each step is b ou n ded by O ( m ). Thus, the total num b er of messages is Σ log n i =1 nm 2 i = O ( mn ). Hence the overa ll message complexity is O ( mn 2 ) + O ( m n ) = O ( m n 2 ). 2.4.2 T ime co mplexity Theorem 2.4.2. The Kar ger’s distribute d algorithm c om- putes mincut i n O ( n 2 ) tim e, i n a single trial. Pr oof. Before contraction, the algori thm assi gns a rank (random num b er) to each edge and find s the max-rank among all th e vertices in the graph. This requires atmost n − 1 steps(strictly , n umber of steps equal t o the diameter of the graph). F or contraction, a message is sent from a vertex within one group to other group and th e message is prop- agated to all th e vertices within the second group and the neighbouring vertices of th at group, which also takes atmost n − 1 pulses. Since only one contraction can take place at any time and there are n − 2 suc h con tractions, the runn ing time is O ( n 2 ). T o estimate time for computing the mincut, the fun ction find-global-mincut() run s O (log n ) steps and in step i , n 2 i nod es flo o d the netw ork. Thus the time p er step is n 2 2 i . Hence the total complexity is Σ log n i =1 n 2 2 i = O ( n 2 ). 3. CONCLUSION AND FUTURE WORK A sync hronous distribu t ed version of the Karger’s random- ized algorithm under netw ork setting is presented in th is pap er with a pro of of correctness and complexit y analysis. The present algorithm app ears not to make use of the full p o wer of p arallelism av ailable. I t is interesting to lo ok at how to efficiently redu ce time and message complexity by conducting edge contractions in paralle l. 4. REFERE NCES [1] R. K. Ahuja and J. B. Orlin. “A fast and simple algorithm for the maximum flo w problem” . OPERA TIONS RESEARCH , 37(5):748–75 9, September-Octob er 1989. [2] L. I. Bui. M, Thuy Lien Pham and S. H. Do. “A distributed algorithm for the maximum flo w problem” . In Pr o c e e dings of the 4 th International Symp osium on Par al lel and Distribute d Computing , pages 131–138, 4-6 July 2005. [3] E. A. Dinic. “Algorithm for solution of a problem of maximal flow in a net wo rk with p ow er estimation” . Soviet M ath. Do cklady , 11:1277–12 80, 1970. [4] J. Edmonds and R. M. Karp. “Theoretical impro vemen ts in algorithmic efficiency for netw ork problems” . Journal of ACM , 19(2):248– 264, April 1972. [5] L. R. F ord and D. R. F ulkerson. “Maximal flow through a netw ork” . Cand. J. Math , 8:399–404 , 1956. [6] A. V. Goldberg and R. E. T arjan. “A new approac h to the maximum fl o w problem” . Journal of A CM , 35(4):921– 940, 1988. [7] T. J. Cherian and K. Melhorn. “Can a maximum flo w b e computed in O ( m n ) time?” . In Pr o c e e di ngs of 17 th International Col loq uium on Automata, L anguages and Pr o gr ammi ng , pages 235–248 , July 1990. [8] D. R. Karger. “Global min-cuts in RNC, and other ramifications of a simple min-out algorithm” . I n Pr o c e e dings of the f ourth annual ACM-SIAM Symp osium on Discr ete algorithms , pages 21–30, 25-27 Jan uary 1993. [9] D. R. Karger and C. Stein. “An ˜ O( n 2 ) algorithm for minim um cuts” . In Pr o c e e dings of the twenty-fifth annual ACM symp osium on The ory of c omputing , pages 757–765 , 1993. [10] R . Koetter and M. Medard. “An algebraic approach to netw ork coding” . I EEE/ACM T r ansact ions on Networking , 11(5):782–7 95, 2003. [11] N . A. Lynch. “Distribute d algorithms” . Morgan Kaufmann, 4 edition, 1996. [12] V . M. M. M. Pramod h-Kumar and S. N. Maheshw ari. “An O( n 3 ) algorithm for finding maximum flo ws in netw orks” . Information Pr o c essing L etters , 7:277–278, 1978. [13] H . Nagamochi and T. Ibaraki. “Linear time algorithms for finding a sparse k-conn ected spanning subgraph of a k-connected graph” . Algorithmic a , 7:583–596, 199 2. [14] S .-Y. L. R. Y eung and N. Cai. “Net work coding theory” . F oundations and T r ends in Com m unic ations and Information The ory , 2,4,5: 241–381, 2005. [15] S .-Y. R. L. Rudolf Ahlswede, Ning Cai and R. W. Y eung. “Netw ork information flow” . IEEE T r ansactions on Information The ory , 46(4):1204–1 216, 2000. [16] M. Sto er and F. W agner. “A simple min-cut algorithm” . Journal of ACM , 44(4):585–591, July 1997. [17] S. R. V. King and R . T arjan. “A faster deterministic maximum fl o w algorithm” . Journa l of A lgorithms , 17(3):447– 474, Nov em b er 1994.
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment