PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

14
This article was downloaded by: [University of York] On: 03 December 2014, At: 17:13 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 Parallel Algorithms and Applications Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/gpaa19 PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS PRANAY CHAUDHURI a a Department of Electrical and Computer Engineering , Kuwait University , PO Box 5969, Safat, Kuwait Published online: 27 Apr 2007. To cite this article: PRANAY CHAUDHURI (1998) PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS, Parallel Algorithms and Applications, 13:2, 153-165 To link to this article: http://dx.doi.org/10.1080/01495739808947365 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 to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http:// www.tandfonline.com/page/terms-and-conditions

Transcript of PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

Page 1: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

This article was downloaded by: [University of York]On: 03 December 2014, At: 17:13Publisher: Taylor & FrancisInforma Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House,37-41 Mortimer Street, London W1T 3JH, UK

Parallel Algorithms and ApplicationsPublication details, including instructions for authors and subscription information:http://www.tandfonline.com/loi/gpaa19

PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZINGACTIVITY NETWORKSPRANAY CHAUDHURI aa Department of Electrical and Computer Engineering , Kuwait University , PO Box 5969,Safat, KuwaitPublished online: 27 Apr 2007.

To cite this article: PRANAY CHAUDHURI (1998) PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS,Parallel Algorithms and Applications, 13:2, 153-165

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

PLEASE SCROLL DOWN FOR ARTICLE

Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) containedin the publications on our platform. However, Taylor & Francis, our agents, and our licensors make norepresentations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose of theContent. Any opinions and views expressed in this publication are the opinions and views of the authors, andare not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be relied upon andshould be independently verified with primary sources of information. Taylor and Francis shall not be liable forany losses, actions, claims, proceedings, demands, costs, expenses, damages, and other liabilities whatsoeveror howsoever caused arising directly or indirectly in connection with, in relation to or arising out of the use ofthe Content.

This article may be used for research, teaching, and private study purposes. Any substantial or systematicreproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in anyform to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http://www.tandfonline.com/page/terms-and-conditions

Page 2: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

Parallel Al~~rilhm and Applirorionr. Vol. 13. pp. 153-165 & 1998 OPA (Ovcraas Publirhcn Asracialion) N.V. Rcprina available directly from Ihc publisher Published by licenr undcr Pholompy~ng permitled by l i a n a only ths Gordon and Brrrch Scicnce

Publishcrr imprinl. Printed in India.

PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PRANAY CHAUDHURI

Department of Electrical a n d Con~purer Engineering. Kuwait U~iiversif.~. PO Box 5969. Sofor. Ktrn'nit

(Received 18 September 1996: lnfinnlfon~i I1 April 1998)

This paper presents parallel incremental algorithms for analyzing activity networks. The start- over algorithm used for this problem is a modified version of an algori~hm due to Chaudhuri and Ghosh (BIT 26 (1986), 418-429). The computational model used is a shared memory single-instruction stream, multiple-data stream computer that allows bolh read and write con- flicts. It is shown that the incremental algorithms for the event and activity insertion problems both require only O(loglogn) parallel time, in contrast to O(logn loglogn) parallel time for the corresponding start-over algorithm.

Key~t,ord.~: Parallel algorithm; Incremental algorithm; Activity networks; Earliest start time; Latest start time; Critical activities

C.R. C?otegories: GI .O, F2.2

1. INTRODUCTION

Incremental o r updating graph algorithms are used to recompute (update) properties of a graph after a minor modification has been made to it. Let S be a solution to a problem P on graph G obtained using algorithm A. Algo- rithm A is referred to as the start-over o r the main algorithm for P. Let G' be the graph obtained after a minor modification is made to G and S' be the corresponding solution for P on G'. Now an incremental algorithm A' for this problem P finds S' froni S. In order to be a useful updating algorithm, A' must have a low cost compared to that of A. The cost of a parallel algorithm is defined as the product of its time complexity and the number of processors used.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 3: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

154 P. CHAUDHURI

Serial incremental algorithms for graphs have received some attention in the past while the interest in the same for parallel computational mod- els is relatively of more recent origin [2,3,5-8,101. In this paper, fast par- allel incremental algorithms are presented for the problem of analyzing activity networks. More precisely, we consider the problem of updating the solutions corresponding to analysis of an activity network when a new event (node) together with all the incident activities (edges) o r a new activity (edge) is inserted into the existing activity network. The corre- sponding deletion problems seem to be difficult to handle. The reason for this difficulty is mainly due to the fact that the auxiliary results generated by the start-over algorithm used in this paper may not be sufficient to update the solutions for arbitrary deletion of events o r activities and hence in these cases the solutions for the modilied activity networks have to be obtained from the beginning using the start-over algorithm. For this reason, in this paper, we are dealing only 'with the insertion prob- lems. The computational model used for the start-over algorithm as well ;IS the incremental algorithms is the shared memory single-instruction stream, nlultiple-data stream computer that allows both read and write conflicts. Such a computational model is more commonly known as the Concurrent Read, Concurrent Write Parallel Random Access Machine (CRCW PRAM) in the literature [l-4,9].

It appears that the start-over algorithms have significant impact on the incremental algorithms in terms of the generation of the auxiliary results. A modified version of the parallel algorithm due to Chaudhuri and Ghosh [4] is used as the start-over algorithm in this paper. It may be noted that the algo- rithm Tor analyzing activity networks due to Chaudhuri and Ghosh [4] requires O(lognloglogn) time with 0(n3) processors on a CRCW PRAM model. In this paper, we first present the start-over algorithm, which runs in O(logt~loglogn) time but with 0(n3/loglogn) processors on a CRCW PRAM. Finally, we show how to recompute or update the solutions for the problem of analyzing activity network, in parallel, when the concerned activity network undergoes a minor change as mentioned above. The most notable results in this paper are that the incremental algorithms for the event and activity insertion problems require only O(log logn) parallel time, where the original activity network has n events (nodes). It may be noted that the time complexities of these incremental algorithms are less than the corresponding start-over algorithm by a factor of logn using an identical number of processors.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 4: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PARALLEL INCREMENTAL ALGORITHMS 155

2. PRELIMINARIES

Throughout this paper an activity network (precisely, activify-on-edge net- work o r AOE network) is defined to be a weighted directed acyclic graph (DAG) G = (V, E), where each node i~ V corresponds to an event and each directed edge (i , j) E E associated with a positive weight corresponds to an activity. Without loss of generality we assume V to be { I , 2, . . . ,n}. It is assumed that G has a single source, say S E V, which is the initial event representing the start of the project and a single sink, say f~ V, which is the destination event representing the successful completion of the project. The algorithms presented in this paper are based on the concepts of the k-tree and the maximum-weighted-pat11 property (MWP property) which are defined below.

DEFINITION 2.1 Given a DAG G = (V, E) , a k-tree is a tree with node x as the root (.YE V), containing all the nodes that can be reached from x through a directed path of length 1 2k in G, where 0 I k I rlogn]. We will denote a k-tree rooted a t node x by Tk(.x).

The immediate predecessor, or parent of node y in Tk(x) is denoted by P(y l Tk(x)). We assume that the parent of the root in a tree is the root itself, i.e. P(x I Tk(,y))=x. Let us denote the weight associated with an edge (x,y) E E by W(y ( To(.u)) and the sum of the weights associated with each edge on the path x t o y , x, y E V, in a tree Tk(x) by W(y I Tk(x)).

DEFINITION 2.2 Given a weighted DAG G=(V, E), Tk(x), and a pair of distinct nodes y and z in a tree Tk(.y) such that (y , z) E E but (y , z) does not belong to Tk(.y), then the tree Tk(x) is said to preserve the M W P property if one of the following conditions is satisfied:

(i) W(y l T~(x)) + W(Z I TOW) I W(Z I Tk(.y)); (ii) The path x to y in Tk(x) consists of 2k edges.

An arbitrary weighted DAG G = (V, E ) and the corresponding 2-tree preserving the MWP property is shown in Figure I.

3. START-OVER ALGORITHM

The heart of the start-over algorithm for analyzing activity networks is the computation of the MWPs or the longest paths between every pair of nodes

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 5: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

P. CHAUDHURI

FIGURE I An arbitrary weighted DAG G = ( V , E) representing the AOE network of a hypothetical project and T2(I). The edges of T2(I) are shown by bold lines.

in the network, wherever such a path exists. Once this is done the rest, i.e. computing the earliest and latest start times EST(i,j) and LST(i,j) respectively for each activity (i,j) E E of the AOE network, can be obtained without much difficulty. Note that the project duration, which is the weight of the MWP from the source event (node) s to the destination event (node) S, is available as an output of the MWPs compuation. Finally, computing the slack time for each activity (i,j) E E, SLACK(i,j), and then identifying the critical activites are starightforward once the ESTs and LSTs are known.

It is assumed that the 0-trees To(x), VXE V, are available as the input. The other input requirement is the weight, W(y 1 To(x)) specified for each pair of nodes x, y = 1,2, . . . , n. The main part of the algorithm that com- putes the MWPs is based on the following idea. Initially, for each X E V, all the trees To(y), y E To(x), are merged with the tree To(x) to produce a new tree Tl(.r). This process of tree merging is repeated rlognl times, finally producing a tree Ty logn l (~) , for each x E V, so that for all s in V we obtain a MWP tree rooted a t .u consisting of all the nodes of G reachable from x. The tree merging is carried out in such a manner that a t any stage k, the tree Tk(s) which is obtained from the trees T k - I ( ~ ) and all Tk-I(y)r y E Tk-!(x), 0 < k 5 rlognl preserves the M W P property defined in the pre- vious section. The EST(i,j), for activity (i,j) E E, is simply the weight of the MWP from the initial event (or the source node) s to the event (node) i, i.c. W(i I TrIo,,,l(~)). The project duration (PD) is W( f I Tllog,,l(~)). Once EST(i, j ) is available for each activity (i, j ) E E, the latest start time LST(i,j), (i, j ) E E, can readily be computed using the following relation.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 6: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PARALLEL INCREMENTAL ALGORITHMS 157

When both the ESTs and LSTs are available for all the activities, the slack time for each activity (i,j) E E can be obtained as follows:

The activities corresponding to zero slack times are the critical activities. A detailed description o f the algorithm is given below.

Algorithm ANET-ANALYSIS

Input: The tree To(x) for each xE V , specified by P(y I To(x)) for each y E V, and the weight o f each edge (x, y) E E, i.e. W ( y / To(x)).

Output: The project duration (PD), the earliest and latest start times, EST(i,j) and LST(i,j), and the slack time, SLACK(;,/') for each activity ( i , j ) E E. The activities corresponding to zero slack times are marked as 'critical activities'.

Step 1: [Initialize] k := 0. Step 2: [Repeat steps] For [lognl times repeat Steps 3-6. Step 3: [Initialize matrices] For each triple I, y, z = 1,2,. . . , n do the

following: i f ( Z = X ) AND (P(y I Tk(x)) # 0) then M;(y, z ) := W( y I T&)) else i f (z E Tk(x)) AND (P(j1 I Tk(z)) # 0) then

else M t ( y , z ) := -m. Step 4: [Find the maximum o f each row o f each matrix] For each pair

o f nodes x,y= 1,2,. . ,n find y,,, such that Mi(y,y,,,) = max{M;(y,z) 1 z = 1,2,. . . ,n).

Step 5 : [Define new trees] k := k+ 1 . For each pair o f nodes .\-,y= 1,2,.. . ,nset P(Y I Tk(x)):=P(y I Tk-l(yrnax)).

Step 6: [Update weights] For each pair o f nodes x , y = 1,2,. . . , n set

W(Y I TAX)) := W(.vrnax I T ~ - I ( x ) + W(Y I Tk-I (yrnax)). Step 7: [Obtain project duration] PD := W ( f I T l l o g n l ( ~ ) ) . Step 8: [Obtain earliest start times using relation RI] For each ( i , j ) E E

set EST(i,j):= W(i 1 Tllognl(s)). Step 9: [Obtain latest start times] For each ( i , j ) ~ E set LST(i,j]=

W ( f / T~I.~.~(s))- W ( f I Tr~ognl(j))- W ( j I To(i)). Step 10: [Obtain slack times using relation R2 and identify critical

activities] For each (i,j) E E do the following: SLACK(i, j ) = LST(i, j ) - EST(;, j); i f SLACK(;, j ) = 0 then mark (i, j ) as 'Critical Activity'.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 7: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

Input to Algorithm ANET-ANALYSIS

End of first iteration of Steps 3 through 6

I 2 7 6 12 9

0 1 6

End of second iteration of Steps 3 through 6

F I G U R E 2 This figure illustrates the construction of the trees T,(.\-) ond T2(.v) from T,(.r). s= 1.2.. . . .8 during the first two iterations of Steps 3-6 of algorithm ANET-ANALYSIS correspot~ding to the AOE network of Figure I .

Figure 2 illustrates the errect of the iterative Steps 3-6 of algorithm ANET-ANALYSIS on the AOE network given in Figure 1. The complete output of algorithm ANET-ANALYSIS is shown in Table I.

The time complexity of algorithm ANET-ANALYSIS is clearly domi- nated by the repeat loop of Step 2. The body of this repeat loop is Steps 3-6.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 8: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PARALLEL INCREMENTAL ALGORITHMS 159

TABLE 1 The project duration, and the earliest start, latest start and slack times for each activity of the AOE network of Figure 1

A c i v i ( i , j ) Projecr duration EST(i, j ) LST(i, j ) SLACK(i. j )

Step 3 can be implemented in O(1oglogn) time with 0(n3/loglogn) pro- cessors to initialize n matrices each of size n x n. Using a maximum finding algorithm due to Shiloach and Vishkin [9], that requires O(1oglogn) time with O(n/loglogn) processors on a CRCW PRAM, Step 4 of algorithm ANET-ANALYSIS can be implemented in O(1oglogn) time using 0(n3/ loglogn) processors. In this step while computing the maximum ties are broken in favor of lower numbered node, i.e. if Mi(y , z,) = M f ( y , ib) and z, < zb then Mi(y , z,) is considered 'greater' than Mi(y, zb). Each of Steps 5 and 6 takes O(I) time when 0(n2) processors are employed. Therefore, a single execution of the body of the repeat loop of Step 2 runs in O(loglogn) time with ~ ( r ~ ~ / l o g l o ~ n ) processors. Since this step is repeated [lognl times, the overall time complexity of Steps 2-6 is O(lognloglogn) using 0(n3/log1ogtr) processors. Each of Steps 1 and 7 requires O(I) time with a single processor to make an assignment. Finally, each of the remaining three steps, i.e. Steps 8-10, takes O(I) time but uses O(e) processors, where e = I E 1. From this discussion we have the following theorem.

THEOREM 3.1 Algorithm ANET-A NAL YSIS runs in O(log n log log n) time when 0(n3/log log n) processors are employed.

The correctness of algorithm ANET-ANALYSIS is established through the following lemmas.

LEMMA 3.2 A tree Tk(.x), x E V obtained at the end of k successive irera- tions of Steps 3-6 of algorithm ANET-ANAL YSIS cottrains all nodes y E V reachable from x by an acyclic path of length less than or equal to 2k.

Proof The lemma is proved by induction on k for Tk(.x), X E V. The lemma trivially holds for a tree To(x), x E V, since by definition To(s) con- tains only those nodes y € V such that (s, y) E E.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 9: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

Let the lemma be true for every tree Ti(.r), xE V, where i < k . Consider a node y E V that does not belong to Ti+l (x) , but for which there exists an acyclic path of length less than or equal to 2'+' from .r to y in G. From . Steps 3-5 of algorithm ANET-ANALYSIS we observe that y f Ti+l(x) implies that there is no node u E Ti(x) with y E Tj(u). Due to the induction hypothesis Tj(u) contains all nodes v reachable from u by an acyclic path of length less than or equal to 2' in G. Therefore, if y f Ti(x) and also y$ Ti(u) for any node u E Ti(x) then every acyclic path from .r to y in G is of length greater than 2'+2'=2'+'. This contradicts the initial assumption about node y. Thus, every node V reachable from x by an acyclic path of length less than or equal to 2'+' belongs to Tj+l(x).

LEMMA 3.3 A tree Tk(s) , x E V obtaitled at the end of k successive itera- tiot~s o/ Steps 3-6 of rrlgoritl~rn ANET-ANALYSIS does tiot contain any tlocle y E V for tvhich the lengtl~ of every uc.~~clic path fron~ .Y to y in G is greoter tl~crt~ zk. Proof The lemma trivially holds for tree To(.r), S E V , since by defini- tion To(s) contains only those nodes y € V such that ( x , y ) ~ E. Using this as the basis, the lemma can easily be proved by induction as in Lemma 3.2.

LEMMA 3.4 The tree Tk(x), X E V obr(~ilied front trees Tk-I (x) and all Tk-~O,), yE T k - I ( ~ ) , at the end of k successive iterutions of Steps 3-6 o/ olgorithnl ANET-ANAL YSlS preserves the M WP property. .

Proof The lemma trivially holds for k = 0, since by definition To(x), x E V , preserves the M W P property.

Let us assume that the lemma holds for every tree T;(x), X E V, where i is an integer such that i < k . Consider the tree obtained by merging the trees Ti(u), I ~ E Ti(s) , into the tree T,(.Y). For each node y an immediate predecessor z is selected to define the new tree Tj+l(s) . The selection is done in such a way (see Step 4 of algorithm ANET-ANALYSIS) that there exists no other immediate predecessor u of y in G which would satisfy the inequality W(u I ti+!(.^)) + W(JJ I To(u)) > W(ymnx ( Ti ( x ) ) + W(z 1 Ti(?:,,,,,,)) + W ( y I To(i)). At step 5 of the algorithm P(y 1 Ti+,(.u)) is set to z. From the induction hypothesis, Ti(s) , V S E V , satisfy M W P prop- erty. This implies that both of the trees Ti(y,,,,), and Ti(x) in the inequality above preserve the M W P property. Since both Ti(y,,,), and Ti(x) preserve the MWP property, the weight of any path from s t o y in G must be greater than o r equal to the right hand side of the inequality shown. However, W(Y I Ti+, (4) is equal to ~ ( J J , , , , I Ti(-v)) + W(z I T;(y,,,)) + W(y I TO(?)),

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 10: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PARALLEL INCREMENTAL ALGORITHMS 161

due to the choice of P ( y 1 T;+,(x)) . Consequently, Ti+1(x) preserves the MWP property. Therefore, from the basis step and the induction hypothesis i t follows that Tk(x), V X E V, preserve the MWP property, where k is a finite nonzero integer.

LEMMA 3.5 Tlze tree Tl lOgnl(x) , x E V, 1x1s all the nodes reacl~uble fronz s it1 G cmcl preserves rlle M WP property.

Proof By Lemma 3.2 it follows that the tree T r l o g , l ( . ~ ) , s E V, consists of all nodes of G that are reachable from x by an acyclic path consisting of n

edges or less. Since n is the number of nodes in G, the tree Trlognl( .~) con- sists of all nodes of G reachable from s. The last part of the lemma follows from Lemma 3.4.

THEOREM 3.6 Algorithm ANET-ANALYSIS correct1,v compures the pro- ject duration (PD), and EST(;, j) , LST(i,j). SLACK(i,j], V(i , j] E E oJa givetz AOE network.

Proof Follows from Lemmas 3.2-3.5.

4. INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

In this section we will consider the problem of recomputing or updating the solutions corresponding to an activity network when a new event (node) or activity (edge) is inserted into the existing activity network repre- sented by a weighted DAG G = ( V , E ) . It may be noted that when an event or node is inserted into the DAG G, all the edges incident on this node are also added to G. We will see here that the partial spanning tree merg- ing technique. which is the basis for the start-over algorithm ANET- ANALYSIS, produces some auxiliary results during analyzing the activity network that can be efficiently used to recomputing or updating solutions to the corresponding activity network when the same undergoes some minor changes.

4.1. Event (Node) Insertion

It is assumed that all of the trees Tl lognl ( .~) , V.YE V of G, specified by P ( y I Trlog , , l ( .~ ) ) and W ( y / T r l o g n l ( . ~ ) ) , Vy E V are av;iilable. The indegree (i.e.. the number of edges incident upon a node) of the new node to be inserted, say 11 , is assumed to be greater than zero, i.e., it cannot be a new

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 11: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

162 P. CHAUDHURI

source node in G. Assume that there are edges from each of s l , x2, . . . , xp to tr and from tc to Y I , y2,. . . , yq Also it is assumed that the insertion of this node together with the edges does not introduce any cycle in the given 'DAG. The basic idea underlying the algorithm is to initialize a new 0-tree To(ti) and to select a unique parent of u in each of the [lognl-trees Tllogal(x). Then, by means of a single iteration of a tree merging process, similar to that used by the start-over algorithm, all [log(n+ I)]-trees Tllog(,,+ ~ ~ ( x ) , Vx E VU {u) are obtained. Once the trees TllogO,+ I)~(X). V.YE VU {u) are available recomputing the project duration and the earliest start times are starightforward. Finally, the latest start times and the slack times can be obtained using relations (RI) and (R2) and the new critical activities can be identified as in algorithm ANET-ANALYSIS. The follow- ing algorithm illustrates this updating process. Without loss of generality we assume u to b e n + 1.

AIgorirhnz EVENT-UPDATE

Input: The tree Tllognl(.~) for each x E V , specified by P(y 1 Tpognl(x)) and W(y I Trlogn1(x)) for each y E V , and the new node n + I . Also the edges (x i , u) having weights W(u 1 To(xi)), i = 1,2, . . . , p, and the edges (11, y,) having weights W(yj I To(u)), j= l , 2 , . . . , q.

Output: The reconstructed trees Trlogc,,+l)l(~), VxE VU {u) specified by P(Y I Tllog(,,+ I )~(x)) and W(v I Tpo,(,+ I)~(x)), for all ,Y,Y = 1.2,. . . , t i + 1, from which the PD, the ESTs, the LSTs, and the slack times are recomputed.

Step I: [Find the immediate predecessor o r parent of 11 + I in each of the [log nl-trees Trlog,,l(.~), x = 1,2,. . . , n] For each node x = - .

1,2, . . . ,ti do the following: I. I. Obtain x , such that W(x, I Tllog,,l(~)) = max{ W(xi I

T ~ I ~ ~ , , ~ ( . Y ) ) I i= 1,2,. . . , P I . 1.2. Set P(u I Tllog,,l(~)) := x,.

Step 2: [Obtain Trlog,rl(n + I)] 2.1. SetP(yjI To( t r+I ) ) :=n+1, fora l l j=1 ,2 ,..., q. 2.2. Merge To(n+ I) and all Tllognl(j~), for all j = 1,2, . . . , q and

call the resulting tree Trlognl(n + 1). Step 3: [Obtain Tllog(,,+l)l(.~),s= l ,2 , .. . . , n + I] For each node x =

1,2,. . . ,ti + 1 do the tree merging as in Steps 3-6 of the start-over algorithm ANET-ANALYSIS once to obtain Tllog(n+l)l(~), S =

l 3 2 , . . , t l + l . Step 4: [Obtain project duration] PD := W( f I Tllogc,,+ l)l(.r)).

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 12: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PARALLEL INCREMENTAL ALGORITHMS 163

Step 5: [Obtain earliest start times] For each (i,j) E EU {(xi, u) 1 i = 1,2, . . . ,~}U{(u,.uj) I ~ = 1 , 2 , . . . , q J set EST(i, j ) :=

bf'(i I Tilog("+ l)l(~)). Step 6: [Obtain latest start times] For each (i,j) E E U {(xi, u) 1 i =

1,2 ,..., p j U ((u,xj) 1 j = 1 , 2 ,..., q}set LST(i, j) = W(f I T l~ogcn+~~l (~) ) - W(f I T r ~ ~ ~ ( , ~ + ~ ) l ( j ) ) - W(j I TO(;)).

Step 7: [Obtain slack times and identify critical activities] For each ( i , j )€Eu{(x i ,u ) l i = 1 , 2 , . . . , p)U{(u,xj)( j= 1,2 ,..., q} d o the following: SLACK(i, J ] = LST(i, j) - EST(;, J];

if SLACK(i,j) = O then mark (i,j) as 'Critical Activity'.

Merging of the partial spanning trees as required in Steps 2 and 3 of algorithm EVENT-UPDATE can be implemented using an identical pro- cedure as in Steps 3-6 of algorithm ANET-ANALYSIS which, requires O(log log n) time with 0(n3/log log n) processors. Step 1 of algorithm EVENT-UPDATE requires O(log log n) time using O(n/log log n) processors and Step 4 requires O(1) time with a single processor. Finally, each of Steps 5-7 takes O(1) time with O(e) processors. Therefore, we have proved the following.

THEOREM 4.1.1 Algorifhni EVENT-UPDA T E takes O(1og log n) ~irne when 0(n3/log logn) processors ore used.

4.2. Activity (Edge) Insertion

Let (u, v) be the new activity (edge), associated with some positive weight. to be inserted in the activity network (DAG) G. It is assumed that all of the trees Tllognl(x), VXE Y of G, specified by P ( y / Tllog,l(x)) and W(y 1 Tylog,l(~)). VyE V are available. It is also assumed that due to the insertion of this edge in G no cycle is created. We now proceed to update the solutions corresponding to the activity network G as follows.

Algorithm ACTIVITY-UPDATE

Input: The tree Tllosnl(x) for each .YE V, specified by P(y I Trlognl(.~)) and W(y I Trlognl(x)) for each Y E V, and the new edge (u, v) having weight denoted by W(v ( To(u)).

Output: The updated trees TIIognl(x), V.YE V , from which the PD, the ESTs, the LSTs, and the slack times are recomputed.

Step I : [Update the immediate predecessor or parent of v in each tree Tllognl (x), x = 1,2, . . . , n] For each node .u = 1,2,. . . , n do the

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 13: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

P. CHAUDHURI

following: if W(v I Tpog,,1(x)) < W(U I Trlogrtl(x)) + W(V I To(u)) then P(v ( Tllos,,l(.~)) := U.

Step 2: [Obtain updated rlognl-trees Tllo,,,l(~), x = 1,2, . . . ,n] For each node .Y= 1,2,. . . , I ? do the tree merging as in Steps 3-6 of the start-over algorithm ANET-ANALYSIS once to obtain the updated trees TrIog,,l(x), .Y= 1,2, . . . ,I?. '

Step 3: [Obtain project duration] P D := W(f I Taosnl(s)). Step 4: [Obtain earliest start times] For each (i,j) E EU {(u, v)} set

EST(i,j) := W(i I Tpos.l(s)). Step 5: [Obtain latest start times] For each (i , j) E EU {(u, v)) set

LST(i, j ) = W(f I TrlOg,,l(s)) - W(f I Trlos,,l(j)) - W(j I To(;)). Step 6: [Obtain slack times and identify critical activities] For each

(i,j) E E U {(u, v)} do the following: SLACK(i , j) = LST(i, j ) - EST(i, J]; if SLACK(i,j]=O then mark (i,j) as 'Critical Activity'.

Step 2 of algorithm ACTIVITY-UPDATE can be implemented using an identical procedure as in Steps 3-6 of algorithm ANET-ANALYSIS which requires O(log logn) time with 0(n3/loglogn) processors. Step 1 of algorithm ACTIVITY-UPDATE requires O(1) time using O(n) processors and Step 3 requires O(I) time with a single processor. Finally, each of Steps 4, 5, or 6 takes O(I) time with 0(e) processors. Therefore, we have the following.

THEOREM 4.2.1 Algorit/~t?r ACTIVITY-UPDATE takes O(loglogn) time ,,)hen 0(n3/log log 17) processors are used.

The correctness of these two incremental algorithms, namely EVENT-UPDATE and ACTIVITY-UPDATE, can be established by induction following the same line of reasoning as in the case of the start- over algorithm.

5. DISCUSSIONS

We have presented two incremental parallel algorithms for the event and activity insertion problems for an activity network. The corresponding start-over algorithm discussed in Section 3 runs in O(lognloglogn) time with ~ ( r ~ ' / l o g l o g r ~ ) processors. It may be noted that the parallel algorithm for analyzing activity networks due to Chaudhuri and Ghosh [4] requires O(logr1 log logn) time with 0(n3) processors on the CRCW PRAM model

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14

Page 14: PARALLEL INCREMENTAL ALGORITHMS FOR ANALYZING ACTIVITY NETWORKS

PARALLEL INCREMENTAL ALGORITHMS 165

and hence the cost of the start-over algorithm (ANET-ANALYSIS) presented in this paper is less than that in Chaudhuri and Ghosh [4] by a factor of loglogn. It is also shown that both the incremental algorithms proposed in this paper run in O(1oglogn) time when (n3/loglog~7) pro- cessors are employed on a CRCW PRAM model. Clearly the proposed incremental algorithn~s are log17 times faster than the start-over algorithm on the same computational model using an identical number of processors.

Acknowledgment

I would like to thank the anonymous referees for their detailed and helpful comments on the presentation of this material. Their suggestions have greatly enhanced the readability of the paper. This research is supported in part by the Research Administration, Kuwait University under Grant EE065.

References

[I] P. Chaudhuri, Finding centers and medians of graphs in parallel, Parallel A1gorirhnrn.s arrd Applicariorls 9 (1996), 1 1 1 -1 18.

[2] P. Chaudhuri, Finding and updating depth first spanning trees of acyclic digraphs in par- allel, Corrrpirrer Jourrial33 (1990), 247-25 I.

[3] P. Chaudhuri, Parallel Algorirhnis: Desigrr arrd Anol?.si.r, Prentice-Hall. Australia, 1992. [4] P. Chaudhuri and R.K. Ghosh, Parallel algorithms for analyzing activity networks, B I T

26 (1986). 418-429. [5] G . Cheston, Incremental algorithms in graph theory, Tech. Rep. TR-91, Dept. of Compu-

ter Science, University of Toronto. Ontario (1976). [6] F.Y. Chin and D. Houck. Algorithms for updating minimum spanning trees, J. Conrpurer

arirl Sysrrrrt Sci. 16 (1978), 333-344. [7] H. Jung and K. Mehlhorn, Parallel algorithms for computing maximal independent

sets in trees and for updating minimum spanning trees, In/orrrr. Process. Lerr. 27 (1988). 777-776 --. ---.

[8] S. Pawagi and I.V. Ramakrishnan. An O(logn) algorithm for parallel update of minimum spanning trees, In/orm. Process. Lerr. 22 (1986), 223-229.

[9] Y. Shiloach and U. Vishkin, Finding the maximum, merging and sorting in a parallel computation model, J. Algorirhrns 2 (1982), 88-102.

[lo] P.M. Spira and A. Pan, On linding and updating spanning trees and shortest paths, SIA M J . Conrprrring 4 (1975), 375-380.

Dow

nloa

ded

by [

Uni

vers

ity o

f Y

ork]

at 1

7:13

03

Dec

embe

r 20

14