an 0(log n) parallel algorithm for strong connectivity augmentation problem

13
This article was downloaded by: [North Carolina State University] On: 16 October 2014, At: 11:56 Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK International Journal of Computer Mathematics Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/gcom20 An 0(log n) parallel algorithm for strong connectivity augmentation problem Pranay Chaudhuri a a Department of Electronics and Electrical Communication Engineering , Indian Institute of Technology , Kharagpur, 721302, India Published online: 20 Mar 2007. To cite this article: Pranay Chaudhuri (1987) An 0(log n) parallel algorithm for strong connectivity augmentation problem, International Journal of Computer Mathematics, 22:3-4, 187-197, DOI: 10.1080/00207168708803592 To link to this article: http://dx.doi.org/10.1080/00207168708803592 PLEASE SCROLL DOWN FOR ARTICLE Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) contained in the publications on our platform. However, Taylor & Francis, our agents, and our licensors make no representations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose of the Content. Any opinions and views expressed in this publication are the opinions and views of the authors, and are not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be relied upon and should be independently verified with primary sources of information. Taylor and Francis shall not be liable for any losses, actions, claims, proceedings, demands, costs, expenses, damages, and other liabilities whatsoever or howsoever caused arising directly or indirectly in connection with, in relation to or arising out of the use of the Content. This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in any form

Upload: pranay

Post on 09-Feb-2017

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An 0(log n) parallel algorithm for strong connectivity augmentation problem

This article was downloaded by: [North Carolina State University]On: 16 October 2014, At: 11:56Publisher: Taylor & FrancisInforma Ltd Registered in England and Wales Registered Number: 1072954Registered office: Mortimer House, 37-41 Mortimer Street, London W1T3JH, UK

International Journal ofComputer MathematicsPublication details, including instructions forauthors and subscription information:http://www.tandfonline.com/loi/gcom20

An 0(log n) parallel algorithmfor strong connectivityaugmentation problemPranay Chaudhuri aa Department of Electronics and ElectricalCommunication Engineering , Indian Institute ofTechnology , Kharagpur, 721302, IndiaPublished online: 20 Mar 2007.

To cite this article: Pranay Chaudhuri (1987) An 0(log n) parallel algorithm forstrong connectivity augmentation problem, International Journal of ComputerMathematics, 22:3-4, 187-197, DOI: 10.1080/00207168708803592

To link to this article: http://dx.doi.org/10.1080/00207168708803592

PLEASE SCROLL DOWN FOR ARTICLE

Taylor & Francis makes every effort to ensure the accuracy of allthe information (the “Content”) contained in the publications on ourplatform. However, Taylor & Francis, our agents, and our licensorsmake no representations or warranties whatsoever as to the accuracy,completeness, or suitability for any purpose of the Content. Any opinionsand views expressed in this publication are the opinions and views ofthe authors, and are not the views of or endorsed by Taylor & Francis.The accuracy of the Content should not be relied upon and should beindependently verified with primary sources of information. Taylor andFrancis shall not be liable for any losses, actions, claims, proceedings,demands, costs, expenses, damages, and other liabilities whatsoeveror howsoever caused arising directly or indirectly in connection with, inrelation to or arising out of the use of the Content.

This article may be used for research, teaching, and private studypurposes. Any substantial or systematic reproduction, redistribution,reselling, loan, sub-licensing, systematic supply, or distribution in any form

Page 2: An 0(log n) parallel algorithm for strong connectivity augmentation problem

to anyone is expressly forbidden. Terms & Conditions of access and use canbe found at http://www.tandfonline.com/page/terms-and-conditions

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 3: An 0(log n) parallel algorithm for strong connectivity augmentation problem

Inrmm. i Corn~uler Moih.. 1987. Yo1 22, pp. 181-197 Pholocopytng pcrmitlsd h? liccna only (1 1981 Gordon and Breach, Slcnce Publirhrn. Lnc PnnlFd In Great Bnmn

An for

O(log n) Parallel Algorithm Strong Connectivity

Augmentation Problem

PRANAY CHAUDHURI Depertment of Electronics and Electrical Communication Engjneering, Indian lnst~tute of Technology, Kharagpur 721302, India

A synchronised parallel algorithm lor the strong connectivity augmentation problem is presented. Its depth is q h g n ) using qn? processors on a Concurrent read, concurrent write parallel random access machine.

KEY WORDS: Parallel algorithm. sequential algorithm, strong connectivity, augmentation. CRCW PRAM. time complexity.

CR CATEGORIES: GT:Algorithrn, SD:G.l.O, F.2.2

1. INTRODUCTION

In this paper a synchronised parallel algorithm for the strong connectivity augmentation problem is proposed. That is, given a directed graph (digraph in short) G = ( N , E), where N = { I , 2 , . . . , n} is a finite, nonempty set of n nodes and E s N x N is a set of e edges such that each edge is identified with an ordered pair of nodes, we are to find a set E, of minimum number of edges such that the digraph C . = (N, E u E,) is strongly c0nnected.t

Let C(i, j) be a cost function defined on edges not in E between nodes of N, then the weighted strong connectivity augmentation

tlr assumed that the reader is lamiliar with common graph theoretic terms.

187

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 4: An 0(log n) parallel algorithm for strong connectivity augmentation problem

problem is the problem of finding a set of edges E, with minimum total cost such that G , = ( N , E u E , ) is strongly connected. Eswaran and Tarjan [2] has shown the weighted strong connectivity aug- mentation problem to be NP-complete and proposed a sequential algorithm of O(rt+e) complexity for the unweighted strong connec- tivity augmentation problem. The parallel algorithm presented in this paper has O(logn) time complexity with O(n3) processors.

The computation model used fall into the shared memory single instruction stream, multiple data stream category. Simultaneous reading by several processors from the same shared location is allowed and so for simultaneous writing provided that all the processors attempt to write the same value. For a detailed descrip- tion of this n~odel, see [7]. This class of computation models in which simultaneous writing by two or more processors in the same memory location is allowed has been used by many authors 13, 6, 71 and i t is commonly known as concurrent read, concurrent write parallel random access machine (CRCW PRAM).

2. BASIC IDEAS AND VALIDITY OF THE ALGORITHM

It is obvious that for a digraph G = ( N , E ) finding the minimum edge set which can be added to form a new digraph G' such that G' is strongly connected is equivalent to that of finding the same for a directed acyclic graph (dag) G , = ( N , , E d ) obtained by collapsing each strongly connected component (scc) of C to a single node where two nodes of G , are joined by an edge if there is an edge in G from a node in one scc to a node in the other scc. G d is called the condensation of G with respect to sccs.

Let f:S+N, be an 1 - 1 and onto mapping, where S is the set of all supernodes (a supernode is the smallest-indexed node in a scc) and N , is a set of IS1 integers, i.e. N , = j l , 2 , . . . , 1 ~ l j . Now, if E , is a minimum augmenting set of edges which strongly connects G, then f ~ ' ( E , , ) = ( ( , / ' ( i ) , f 1 ( j ) ) l ( i , j ) € E d a } is the required augmenting set of edges to make G strongly connected. The following theorem due to Eswnran and Tarjan 121 gives a lower bound on the number of augmenting set of edges.

THEOREM 1 Ler G , = ( N , , E , ) be a [lug with n, sources, n, sinks and

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 5: An 0(log n) parallel algorithm for strong connectivity augmentation problem

STRONG CONNECTlVlTY GRAPH ALGORITHM 189

n, isolated nodes, where n, + n,+ n,> I . Then at least max (no, n,) + n, edge, are required to make G , stronyly connected.

Prouf See in 123.

Without loss of generality we assume n,sn,. If n,>n, then the problem can be solved by reversing the directions of all edges in G, and finally reversing the directions of all edges in the minimum augmentmg set. The following lemma gives the selection criteria for all edges of the minimum augmenting set.

L E M M A 1 Let x ( l ) , x ( 2 ) , . . . , X ( U ) be sources of G,= ( N , , E d ) und y(l) , y(2),.. . , y (u) he sinks of G, such that euch puir (x( i i , y(i)), I s i z u belongs to same weohl!. co~itiertrd r.oniponmr (nw) o/G,. Let x(u+ I), x(u +2). . . . ,x(n,) and ~ ( t r + I) . y(ir + 2). . . . .y(~i ,) be the remaining sources und remaining ( 1 1 , - 1 1 ) sirihs oj' G, respectiuely such that each x(i) , u+ 1 < i s n o cuii rrrrh to some y(i) , I < i s u and euch y(i), u + l 5 i s n, is reachable ,from some x( i ) , I i <u. Also let z ( I ) , ~ ( 2 ) . . . . ,z(n, +n,- n,) he the isolored itode> and sinks not among y(i), 15 i 5 n,. Then Gd = ( N , , Ed u Ed,). *,here

1s \ t ron~ ly connectrd

Proof Trivial.

The given digraph G = ( N , E) is first condensed with respect to sccs to form a dagG,=(N,, E d ) and then the minimum augmenting set of edges Ed, to make G, strongly connected are obtained by using Lemma 1. Finally, Ed. is converted into an augmenting set of edges for G.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 6: An 0(log n) parallel algorithm for strong connectivity augmentation problem

190 P. CHAUDHURI

3. THE ALGORITHM

Condensation of the given digraph with respect to sccs is performed in 121 by using an efficient sequential depth-first search algorithm due to Tarjan [8] in O(n+e) time. Since, depth-first search seems to be an inherently sequential process [4,5] (existing parallel algorithm for depth-first search has O(n) time complexity using we) processors [I]), we use a different approach for condensation of a digraph. This requires accessibility matrix A*(l:n, 1:n) of digraph G = ( N , E), where A*(i,i)= 1 if there is a directed path of length 2 0 from i to j in G and 0 otherwise. The accessibility matrix of a digraph (or an un- directed graph) can be obtained from its adjacency matrix A(l:n, 1:n) through rlognl boolean matrix multiplications. In this connection, we use the following.

THEOREV 2 Lrr A and B he n x n boolean mutrices. 7'ke11 rhe n x n hooleu~i morrix C = AB cun he compured in O ( I ] rime with O(n3) processors.

Pro@/; Because of the concurrent write assumption in our com- putation model. each element cjj( =V,= , , , ,, o, A bkj) of boolean matrix C can bc computed in O ( I ) time with O(II) processors. Considering for all 11' elements of C. the theorem follows immediately.

As a direct consequence of Theorem 2 we have the next corollary.

C O R U L L ~ R Y 1 Accessihilil). matrix of u grdplr wirk 11 nodes cun be ohroirrud in O(1ogn) rime with O(n3) processors.

The stepwise description of the parallel algorithm for a minimum augmenting set of edges for an arbitrary digraph G = ( N . E) is given below.

Algorithm SC-AUGMENTATION

It is assumed that the digraph G = (N, E) is available in the form of its adjacency matrix A(l:n, 1:n). The output of the algorithm is a minimum augmenting set of edges to make the digraph G strongly connected.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 7: An 0(log n) parallel algorithm for strong connectivity augmentation problem

STRONG CONNECTIVITY GRAPH ALGORITHM 191

1) Obtain accessibility matrix A'(l:n, 1:n) of digraph G from its adjacency matrix A(l:n, 1:n).

Comment This step can be implemented in O(logn) time with O(n3) processors (see, Corollary 1).

2) Construct n x n matrix B from A as follows:

For ; : I s i s n a n d j : l s j S n do

If A*(i.,j) A A*(j,i)= 1 then set B(j,i): = j

else set B(j, i): = s

Comment This step requires O(1) time and O(n2) processors.

3) Find strongly connected components (sccs) and assign com- ponent number to each node i c N:

For j : l Z j s n do

If B(p,,jt=min(B(i. j ) l i = l , 2 ,..., nj

then set C( j ) : =p,

Comment Let there he k sccs wlth component numbers (or supernodes) p,, p,, . . . ,p,. Step 3 can be implemented in O(logn) time with O(n2) processors.

4) Obtain an 1 - 1 and onto mapping of k supernodes to k integers 1,2,. . , k. This can be done as follows:

(4.1) For , j : l = < j s n do

I f C ( j )=p , then set D(p,): = I .

(4.2) For j: I j 5 n do

Set PS(j1: =xi=, D(i).

(4.3) For j: 1 5 js n do

If D(j)#O then set f ( j ) : =PS( j )

Comment Each of k supernodes are assigned with an unique integer between 1 and k (both inclusive). Step 4 requires qlogn) time and Wn2) processors.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 8: An 0(log n) parallel algorithm for strong connectivity augmentation problem

5) Construct an adjacency matrix Ad(l:k, 1:k) of the condensed dag G,= (N,, E d ) , where N,= { I. 2.. . . . k ) and (i, j) E Ed if there is an edge in G from a node in scc J'- '(il to a node in scc f - ' ( j ) as follows:

(5.2) F o r i : l s i S n a n d f ( j ) : l s j s k d o

Set A,(,f(i), J(j)): = V c , = i T ( h f ( j ) ) .

Comment Step 5 requires qlogn) time and O(n2) processors

6) Fmd weakly connected components (wccs) of G,.

16.1) F r i : l i k a n d j l j z k d o

If .-l,(i, j) v Ad(j, i)= I then set Ad,(i, j): = 1

else set .A,,(i.j): =O.

(6.2) Obtain accessibility matrix A&(l:k, 1:k)

of matrix A,,(l:k, I :k).

(6.3) F o r i : l i s k a n d j : l s j s , ! d o

If Afx,(i, j) = I then set BJi. j): =,I

else set BJi, j): = m.

(6.4) For j : 1 js k do

If Bx,(pm, j)=min {Bw(i, j)l i= 1,2,. . . . k i

then set C,(j): =p,

Comment Let there be M' wccs with component numbers p',.p>.. . .,p,. This step can be implemented in time q logn) with O(n'1 processors.

7) (7.1) For each wcc p;, I s i s w of G, construct two vectors .Y,;ll:N,;) and Yo;), where each of N,; elements of X , belongs to wccp; and is a source likewise each of "; elements of Yo; belongs to qccpj and is a sink.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 9: An 0(log n) parallel algorithm for strong connectivity augmentation problem

STRONG CONNI:CTIVITY G R ~ P H ALGORITHM 193

(7.2) Identify and store each isolated node z of G, at the zth location of a vector Z ( I : k ) .

Cutnmet~t The sources and sinks of G, can be identified by computing the cumulative sums of each row and each column of A,(I:k, I : k ) , i.e. CS,(i) and CS,(i) for I 5 i S k respectively. A node i t N , is a source i f f CS,(i) > I A CS,= I . and a node ;E N , is a sink iff CS,(i)= I A CS,.(ij> 1. A node I E N, is an isolated node iff CS,([)= CS,(I)= 1 . This step requires q log k) time and O(k2) processors.

8) (8.1) For each wcc pi, I i 5 w of G , do -

Set q,:: =min(N,;,t~,;); N,;: = N,;-q,;:&;: =no;-q,;.

(8.2) Set n: =I:='=, q , .

(8.3) For each wccpj, 1 < i s w of G, do

else set PS(qPi): = PS(N,;): = PS(n,;): = 0.

Comment It is obvious that either f?,; or ri,; is zero for each wcc pi, 1 < i s w. Step 8.1 requires O ( 1 ) time and O(w) processors. Step 8.2 requires O(log w) time and O(w) processors while Step 8.3 takes O(1ogw) time with O(w2) processors. Therefore, overall time complexity of Step 8 is q log w) when O(w2) processors are used.

9) Construct an array U(I:2, I:n,) and a vector V ( 1 : n , + n , . n , ) as follows.

(9.1) For each wcc pj, I 5 i s w do

(9.1.1) For j : I s j 5 q , : d o

(9.1.2) If f? ,;#O then for R : 1 Z R S N , ; do

Set u ( l , n + P S ( N , ) + R ) : = X , ( q , , + R )

else for r: 1 rs?i,; do

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 10: An 0(log n) parallel algorithm for strong connectivity augmentation problem

(9.2) For j: 1 S js k do

(9.2.1) If Z ( j ) = 1 then set B,(j): = 1

else set B,(i): =O.

(9.2.2) Set CS'( j): = B=, B,(i).

(9.2.3) If Z(j)f 0 then set V(CS'(j1: = Z ( j )

Comment U(1,l:nJ contains n, sources of G,, U(2, I:&) contains n, sinks of G, and V(l:nb+n,-n,) contains n, isolated nodes and rest nb-n, sinks not in U(l,l:n,) satisfying Lemma 1. Time complexity of Step 9 is O(1ogk) when O(k2) processors are used.

10) Construct the augmenting set of edges Ed, of G, using Lemma 1 and then covert Ed, to the required augmenting set of edges E, as E , = / ' - ' ( E d 4 J .

Comment This step clearly requirss O( I ) time and O(n, n,) processors.

THEOREM 3 Alg~rritllm S C - A U G M E N T . 4 T I O N hus time complexity O(log n ) when O(n') processors ure used.

Proqf The complexity analysis for each step of algorithm SC- AUGMENTATION proves the theorem.

4. ILLUSTRATION OF ALGORITHM SC-AUGMENTATION BY AN EXAMPLE

Figurz 2 shows the matrix B formed from the adjacency matrix of the given digraph G (Figure 1) a t Step 2 of algorithm SC-AUGMENTATION to obtain the sccs of G. Figure 3 is the condensed dag of G (with respect to sccs), where the set of 10 supernodes of G, i.e. {I, 2, 5, 7, 8, 9, 12, 14, 15, 16) are mapped onto

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 11: An 0(log n) parallel algorithm for strong connectivity augmentation problem

STRONG CONNECTIVITY GRAPH ALGORITHM 195

Figure I A dmcred graph G

1 2 3 1 5 6 7 8 9 10 11 12 13 1L 15 16

2

3

L

5

6

7

8

9

10

11

12

13

1 L

15

16

1 1

2 2 2

3 3 3

L L L

5 5

6 6

7

8

9 9 9

10 10 10

1 1 11 I1

12 12

13 13

I L

15

16

Figure 2 The rnatrlx B( I 16, 1 I bl 'el u p at Step 2 of algornhm SC-AUGMENTATION The entnei left blank are all r.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 12: An 0(log n) parallel algorithm for strong connectivity augmentation problem

Figure 3 The condensed directed acyclic graph G, corresponding to digraph G of Figure 1.

Figure 4 The array U(1:2, 1:2) and vector VII,I:2) constructed at Step 9 of algorithm SC-AUGMENTATION.

a set of integers(1, 2, . . ., lo}. In the condensed dag of Figure 3. there are two sources, two sinks and one isolated node. Figure 4 shows the 2 x n, (i.e. 2 x 2 in the present case) array U and I x (n,+ n, - n,), i.e. I x 2 vector Vconstructed at Step 9.

Acknowledgements

1 would like to express my thanks to Dr R. K. Ghash 01 Computer Science Department, I.I.T. (Kanpur, India) and Professor S. Ghosh of Electronics Engineering Department, Jadavpur University (Calcultta. India). presentl) with Computer Science Department, University of lowa (lowa, U.S.A.) for helpful comments.

References [ I ] D. M. Eckstein and D. A. Alton, Parallel graph processing using depth-tirst

search, In Prucuedinzs oj rhe Con/erencr on Throrrricnl Cornpuler Scimcu, Ont.. Canada. 1977.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014

Page 13: An 0(log n) parallel algorithm for strong connectivity augmentation problem

STRONG CONNECTIVITY GRAPH ALGORITHM 197

171 K. P. Eswaran and R. E. Tarjan, Augmentatian problems, S l A M J. Cornpuling 5 (1976). 653-665.

I?] L. Kuiera. Parallel computation and conflicts in memory access. Infbrmarion Prowsiing Lvlrers 14 (1982). 93-96.

[4] E. Reghbati and D. G. Corneil, Parallel computations in graph theor). S I J h l .I. Computing 7 (1978). 23G237.

[S] J. H. Reif, Depth-first search is inherently sequential, Infirmarion Prwt , i r ivp I.rrtrrs 20 (1Y85l . 229-234.

[6] J. H. Reif and P. Spirakis, T h e Expected Time C o m p l e i r y of Parirllel Gnqd und DiRraph Al,quritbms, Tech. Rep. TR-11-82. Aiken Computation Laboratory. Harrard Unir.. Cambridge. Mass.. 1982.

[7] Y. Shiloach and U . Vishkln. Finding the maximum mergtng, and wrring in a parallel computation model, J. A l p r i l h m s 2 (1981). 8 8 102.

181 R. E. Tar,jan. Dcpth-first search and linear graph algorilhrns, S/4b/ J. Cwripurit8f l(1972). 146-166.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

11:

56 1

6 O

ctob

er 2

014