Shortest Path Tree Computation in Dynamic Graphs
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Shortest Path Tree Computation
in Dynamic Graphs
Edward P.F.Chan and Yaya Yang
Abstract—Let G¼ðV;E;wÞbe a simple digraph,in which all edge weights are nonnegative real numbers.Let G0be obtained from G by an application of a set of edge weight updates to G.Let s2V and let T s and T0s be Shortest Path Trees(SPTs)rooted at s in G and G0,respectively.The Dynamic Shortest Path(DSP)problem is to compute T0s from T s.Existing work on this problem focuses on either a single edge weight change or multiple edge weight changes in which some of them are incorrect or are not optimized.We correct and extend a few state-of-the-art dynamic SPT algorithms to handle multiple edge weight updates.We prove that these algorithms are correct.Dynamic algorithms may not outperform static algorithms all the time.To evaluate the proposed dynamic algorithms,we compare them with the well-known static Dijkstra algorithm.Extensive experiments are conducted with both real-life and artificial data sets.The experimental results suggest the most appropriate algorithms to be used under different circumstances.
Index Terms—Dynamic shortest path,shortest path trees,dynamic graphs,dynamic algorithms,graph algorithms,routing protocol.
Ç
1I NTRODUCTION
W E call the problem of recomputing Shortest Path Trees (SPTs)with a set of edge weight updates in a dynamic environment the Dynamic Shortest Path(DSP)problem.Let G¼ðV;E;wÞbe a simple digraph,in which all edge weights are nonnegative real numbers.Let G0¼ðV;E;w0Þbe obtained from G by an application of a set of edge weight updates (increases and/or decreases)to G.Let s2V;let T s and T0s be SPTs rooted at s in G and G0,respectively.The DSP problem is to compute T0s from T s.For the DSP problem,the input edge weight changes could come in three forms:increases only, decreases only,and a mixture of both.We denote an algorithm as semidynamic if the input is either a set of edge weight increases or a set of edge weight decreases but not both.An algorithm is said to be fully dynamic if the input is a set of mixed edge weight changes.We shall investigate the performance of both semidynamic and fully dynamic algorithms in this work.The DSP problem finds many important applications,including network optimization, Internet routing,and databases.
To solve the DSP problem,one could apply Dijkstra’s algorithm[8]repeatedly to compute the SPTs.However,this well-studied static algorithm may become ineffective when only a small number of edges in a graph experience weight changes.Therefore,researchers have been studying dynamic algorithms to minimize shortest path recomputation time. Much work has been done on the DSP problem.See,for instance,[6],[7],[10],[12],[16],[17],[18],[19],[20],and[21]. However,existing work focuses on a single edge weight change.See,for example,[6],[7],[10],[12],[19],and[20].If a set of updates is given,then it is handled by these algorithms as a sequence of updates.From the practical viewpoint, solving the DSP as a sequence of changes is not an effective solution,especially when the updated SPT needs to be computed in real time.The noted exceptions are the two approaches proposed in[16],[18],in which the whole set of edge weight changes are processed together.We denote the intelligent semidynamic DSP algorithms in[16]as BallString since they are based on a ball-and-string model.Unfortu-nately,the algorithm BallString for edge weight increases is incorrect.We amend BallString by proposing MBallStringInc, which updates SPTs correctly in the case of multiple edge weight increases.A fully dynamic algorithm called Dyna-micSWSF-FP is proposed in[18].However,a problem with DynamicSWSF-FP is that some of its computation is ineffi-cient.Moreover,DynamicSWSF-FP only computes the short-est distances.We modify DynamicSWSF-FP by applying some optimizations and by adding SPT tree structure maintenance. We call the resulting more efficient algorithm MFP.Existing DSP algorithms are relatively complex.We propose a dynamic version of Dijkstra,which we call DynDijkstra. DynDijkstra are two semidynamic algorithms that can handle multiple edge weight increases and decreases.
For each of the following algorithms:DynDijkstra,MBall-StringInc,and MFP,we prove its correctness.1A drawback in existing work on the DSP problem is the lack of experimental evaluation of different dynamic algorithms.Most existing experimental work is on a single edge weight update.See,for instance,[6],[7],and[10].The experimental evaluation of the aforementioned DSP algorithms is the other contribution of this work.We conduct extensive experiments,with a relatively sparse Connecticut road network and with a relatively dense artificially generated graph,on the above-mentioned algorithms and compare them with the static algorithm Dijkstra.As a result,we identify the preferred
. E.P.F.Chan is with the David Cheriton School of Computer Science, University of Waterloo,Waterloo,ON N2L3G1,Canada.
E-mail:epfchan@uwaterloo.ca
.Y.Yang is with the Department of Alliance&Channel,Oracle China.
E-mail:yaya.yang@.
Manuscript received9June2006;revised23Nov.2007;accepted10Sept. 2008;published online23Oct.2008.
Recommended for acceptance by F.Dehne.
For information on obtaining reprints of this article,please send e-mail to: tc@,and reference IEEECS Log Number TC-0229-0606. Digital Object Identifier no.10.1109/TC.2008.198.
1.From now on,MBallString refers to MBallStringInc and the original BallStringDec.BallStringDec is the BallString algorithm in[16]when the input is a set of edge weight decreases.
0018-9340/09/$25.00ß2009IEEE Published by the IEEE Computer Society
algorithm to compute an SPT in a dynamic environment under different input mixes.
In Section2,we define some basic notation.In Section3, we survey related work and highlight our contributions.In Sections4and5,we describe the proposed semidynamic and fully dynamic algorithms.We give the correctness proofs of some of these algorithms in the Appendix,which can be found on the Computer Society Digital Library at /10.1109/TC.2008.198. In Section6,we present the experimental results and analysis.Finally,we give our conclusion in Section7.
2P RELIMINARY
2.1Definition and Notation
In this section,we examine the definitions of frequently used terms.Terms not defined here are common concepts in graph theory(such as vertices,edges,paths,path length,and trees),which can be found in any graph theory resource[5].
Let G¼ðV;E;wÞbe a simple digraph,where V and E are the sets of vertices and edges,respectively,and w is a function from E to the set of nonnegative real numbers. Sometimes,we use VðGÞand EðGÞto denote the set of vertices and edges in G,respectively.Let e¼ðu;vÞ2E;then, u is the tail of e denoted as tðeÞ,and v is the head of e denoted as hðeÞ.Let u2V;the set of outgoing edges of u is defined as Out u¼f e j e2E and tðeÞ¼u g,and the set of incoming edges of u is defined as In u¼f e j e2E and hðeÞ¼u g.The parents of u are defined as pðuÞ¼f v j v¼tðeÞand e2In u g.For U V,Out U¼f e j e2E and tðeÞ2U and hðeÞ=2U g,a n d In U¼f e j e2E and hðeÞ2U and tðeÞ=2U g.
Let P uv be a path from u to v in G;then,v is reachable from u.All vertices reachable from u in G including itself are u’s descendants,denoted as desðG;uÞor desðuÞif G is understood from the context.A path P uv is said to be a shortest path,denoted as SP uv,if it is not longer than any other possible path PÃuv in G.The shortest distance from u to v in G is denoted as d uv when G is understood from the context.Given a digraph G¼ðV;E;wÞ,an SPT rooted at a vertex or source s,denoted as T s,is a tree with root s,and 8v2desðsÞ,v¼s,T s contains an SP sv.Due to the structure of trees,8v2desðsÞ,v¼s,T s contains only one shortest path SP sv.We assume in this work that all nodes in V are reachable from a source s.Let e2E;e is a tree edge with respect to T s if e2EðT sÞ;otherwise,it is a nontree edge.Given v2VðT sÞ,the subtree rooted at v in T s is denoted as SubT sv. Given G and s2V,let T s be an SPT.Let v2VðT sÞand v¼s. If s is understood in the context,then SP sv,d sv,and SubT sv are simply denoted as SP v,d v,and SubT v,respectively.
Given the simple digraphs G¼ðV;E;wÞand G0¼ðV;E;w0Þsuch that w0¼w,G0is said to be an updated digraph.In this paper,G!G0is achieved by an application of a set"of edge weight updates: "¼fh e i; i ij e i2E andÀwðe iÞ i<1g,8h e i; i i2",and w0ðe iÞ¼wðe iÞþ i.Although only edge weight changes are considered,all proposed algorithms can handle edge insertion/deletion.Edge insertions can be handled as weight decreases by setting the weights from1to the inserted edge weights.Likewise,edge deletions can be processed as weight increases by changing the edge weights from the deleted edge weights to1.
In the DSP problem,let T0s be an SPT rooted at s in G0. Our SPT algorithms compute T0s from T s,and thus,all these are dynamic algorithms.More specifically,they take T s as an input,update the properties of some affected vertices in T s,and then,at the end,return the updated T s,which is T0s.In the description of all the dynamic algorithms discussed in this work and for those objects whose states may be altered during the execution of an algorithm,we use a hatð^Þover an object to indicate the current state of that object.For example,b T denotes any intermediate tree,in which some vertices’properties are being updated during the execution of an algorithm;b d v denotes the shortest distance of v from the source in b T.In addition,we use a primeð0Þwith an object
to indicate its final status in the modified graph G0.For example,d0v is the new shortest distance from the source s to v in G0,and wðeÞ0is the new weight of e in G0.A vertex v is said to be consolidated if the distance assigned by the algorithm equals the final optimal value d0v and the path constructed by the algorithm is an SP0v.
Let T s be an SPT rooted at s in G.Any vertex v2VðT sÞhas the following properties:d v and statusðvÞ.The first property indicates v’s shortest distance from s.The statusðvÞusually has two states:open or closed.Some algorithms use statusðvÞto indicate whether v needs to be processed(open) and whether v is consolidated(closed).
2.2Data Structures
Each vertex v is identified by a key(the ID of v),and so is each edge e.An edge e in a graph is assigned with a weight wðeÞ.An SPT T s is a special kind of graphs,augmented with the vertices’auxiliary information set.The auxiliary in-formationðauxÞfor a vertex v contains d v and statusðvÞ.Let Q be a priority queue.An entry in Q is of the format h ver;data;key i,in which ver is a vertex and is unique among all entries in Q,data contains some useful informa-tion of ver but is optional,and key is the value on which entries are ranked.In these algorithms,key could be a pair of values,h value1;value2i.Entries are ranked on value1first and then on value2.If more than one entry has the same key, then the sequence among them is arbitrary.
Q supports three operations.The instruction ENQUEUEðQ;h ver;data;key iÞadds an entry of vertex ver to Q.If ver is already in Q,then the entry will replace the old ones only if the new key is smaller.In other words,at any instant,only one entry is maintained for each ver in Q.The instruction EXT RACT MINðQÞselects and removes an entry h ver;data;key i with the minimum key.The vertex ver is said to be extracted in this operation.The last instruction REMOV EðQ;verÞremoves the entry of ver from Q.
3R ELATED W ORK
There are many research efforts reported in the literature of maintaining shortest paths on dynamic graphs.We are interested in exact algorithms for graphs of nonnegative edge weights.Among them,some require special properties on the graph,which are less general than what is assumed in our work.For example,some maintain shortest paths in planar graphs[9],[14],some require unweighted graphs such that all edges have a weight of1[4],[11],and some allow only integer edge weights that are less than a certain constant C [3],[13].Over the past few decades,plenty of algorithms, which require no specific properties on graphs,have been proposed for this problem.See,for instance,[6],[7],[10],[12], [16],[17],[18],[19],[20],and[21].In the rest of this section,we review some proposals that related to our work and highlight our contribution at the end.
3.1FMN
Frigioni et al.propose a fully dynamic algorithm,FMN,for maintaining an SPT in a dynamic graph when an edge weight is changed[12].FMN uses the notion of the level of an edge and the notion of the ownership of a vertex.Ownership information is used to bound the number of edges scanned each time a vertex changes its distance from s.Every edge ðx;yÞhas an owner that must be either x or y.FMN follows the similar flow of Dijkstra,except that it tries to visit a smaller number of edges.The authors claim that FMN has the best theoretical complexity,but FMN maintains complex data structures,e.g.,levels of edges,which makes it rather inefficient.It has been shown experimentally in[10]that FMN is outperformed,in most cases,by a fully dynamic algorithm called DynamicSWSF-FP[18].
3.2BallString
Narva´ez et al.[15]propose a general framework for several well-known SPT algorithms when the update is a single edge weight update.The idea is to recompute only the affected part of an SPT.An intelligent approach to recompute shortest paths in the case of multiple edge weight updates is proposed by the same authors in[16].We denote their algorithm as BallString since it is based on a ball-and-string model.This model illustrates how affected balls rearrange themselves in a natural way into their optimal positions when the length of a string is increased or decreased.By simulating the dynamics of the balls in this model,BallString processes affected vertices in the most economical way:it always consolidates the vertex of least distance increase(in the case of edge weight increases)or most distance decrease (in the case of edge weight decreases).In addition,it always tends to consolidate as many vertices as possible in an iteration.2
This approach greatly reduces the number of iterations required for the same set of affected vertices and totally eliminates unnecessary structural changes.Unfortunately, BallString is wrong for some cases of multiple edge weight increases.We will show this with an example in Section4.1.2. Moreover,this algorithm induces“duplicate distance up-dates”in the case of edge weight decreases,which we will illustrate in Section4.2.2.
3.3DynamicSWSF-FP
Ramalingam and Reps in[18]propose a fully dynamic algorithm,DynamicSWSF-FP,that can handle a set of mixed edge weight updates.The main idea is given as follows:At any instant,a“right-hand side”(rhs)value,denoted as rhsðvÞ,is maintained for every vertex v in G.The value records the shortest distance v could get,based on all parents p of v at that time.Given the shortest distance information d v for each vertex v in G,we have d v¼rhsðvÞbefore any input edge weight updates.After the input edge weight updates are applied to G,DynamicSWSF-FP gradually updates the affected vertices’shortest distances,and at the end,all vertices’shortest distances are equal to their rhsðvÞagain.
A disadvantage of DynamicSWSF-FP is that it computes the rhs value too often,which leads to a high number of edge visits.In the same paper[18],the authors suggest some improvement on computing rhs values incrementally.The authors maintain a heap for each affected vertex.The improved algorithm is proven to be correct,but too many heaps may not be practical.3.4Contributions
Our contribution in this work is that we propose a few dynamic SPT algorithms by extending and correcting several state-of-the-art dynamic SPT algorithms.We amend BallString by proposing MBallStringInc,which updates SPTs correctly in the case of multiple edge weight increases.For DynamicSWSF-FP,we suggest MFP by applying some optimizations on recomputing rhs values without main-taining a large number of heaps and to compute an SPT.3In general,existing DSP algorithms are rather complex.In this work,we also propose a simple dynamic version of Dijkstra, which we call DynDijkstra.DynDijkstra can be considered as a generalization of the dynamic version of Dijkstra proposed in[15]by allowing multiple edge weight updates. DynDijkstra are two semidynamic algorithms that can handle multiple edge weight increases and decreases.
For each of the following proposed algorithms: DynDijkstra,MBallStringInc,and MFP,4we prove its correctness.Furthermore,we conduct extensive experi-ments on all proposed algorithms and compare them with the static Dijkstra algorithm.We test our algorithms on the Connecticut road system and on artificially generated dense graphs.We evaluate a few factors that might affect the performances of proposed algorithms.More specifically,we vary the graph size,the percentage of changed edges,and the percentage of weight changed.We first show that the weight changes have a minor effect on the performance of most dynamic algorithms investigated.We then show that for the increase case,MBallStringInc and DynDijkDec have the best performance,among all dynamic algorithms,for the road system and random graphs,respectively.For the decrease case,DynDijkDec outperforms all other dynamic algorithms.However,beyond certain thresholds of changed edges,the static Dijkstra outperforms all dynamic algo-rithms.We then combine MBallStringInc and DynDijkDec together to form a semidynamic algorithm MBSDD.We show that for an input of a set of mixed edge weight changes,MBSDD and DynDijkstra outperform all other dynamic algorithms in the road system and random graph cases,respectively.However,beyond certain thresholds of changed edges,static Dijkstra should be used instead.
4S EMIDYNAMIC A LGORITHMS
In this section,we introduce a few semidynamic SPT algorithms for the DSP problem.In Sections4.1and4.2, algorithms DynDijkstra and MBallString are presented.5The correctness proofs of these algorithms are given in the Appendix,which can be found on the Computer Society Digital Library at /
10.1109/TC.2008.198.
A vertex v in an SPT T s is said to be not locally affected if SP v in T s remains the same as in T0s;otherwise,it is locally affected. As we will soon see,all algorithms in this section only process locally affected vertices.Note that not locally affected vertices in T s all keep their optimal shortest paths and distances as in T s.For any modified edge e,we denote hðeÞas affected head if it is locally affected and as affected miniroot if it is locally affected and it has no locally affected ancestors(except for itself)in T s.
CHAN AND YANG:SHORTEST PATH TREE COMPUTATION IN DYNAMIC GRAPHS543
2.In[16],the authors denote the set of vertices consolidated in an iteration as a branch.
3.In DynamicSWSF-FP,only the shortest distances are computed without maintaining the SPT.
4.Due to space limitation and since MFP is a relatively straightforward modification of DynamicSWSF-FP,its description is not included here.The correctness proof follows from the modification and from[18].
5.The original BallStringDec algorithm will not be repeated in this paper.
At any instant of an algorithm’s execution,a locally affected but nonconsolidated vertex is denoted as a boundary vertex if it has either at least one not locally affected parent or one locally affected but consolidated parent;otherwise,it is an inner vertex.A boundary edge is an incoming edge of a boundary vertex that has either a not locally affected tail or a locally affected but consolidated tail.The candidate parent of a boundary vertex v is the tail uÃof a v’s boundary edge such that d uÃþwðuÃ;vÞis the minimum among all tails of v’s boundary edges.6The candidate distance of a boundary vertex v is provided by d uÃþwðuÃ;vÞ,given that uÃis the candidate parent of v.The candidate path SP vÃfor boundary vertex v is the shortest path SP uÃconcatenated by edgeðuÃ;vÞ.
Both DynDijkstra and MBallString contain two individual algorithms corresponding to weight increases and de-creases,respectively:DynDijkInc and DynDijkDec;MBall-StringInc and BallStringDec.All these algorithms consist of an initialization,followed by n iterations of a number of steps,where n!0.We say an algorithm executes or runs n iterations.Similarly,the i th iteration of an algorithm refers to the i th iteration of these steps.
4.1Algorithms DynDijkstra and MBallString:Edge
Weight Increases
Given a graph G,a source vertex s,an SPT T s,and a set of edges"þsuch that8e2"þ,wðeÞis going to be increased,we are going to compute a new SPT T0s on G0.We propose two algorithms that compute a new valid T0s by only processing locally affected vertices in T s.With T s and"þ,we are able to locate all locally affected vertices first and then compute new shortest paths and distances for them.As proven in Lemma B.1,the set of locally affected vertices is the set of descendants of affected miniroots.We assume that a function named findLocallyAffectedVertices will return cor-rectly the set of locally affected vertices.
4.1.1DynDijkInc
The description of algorithm DynDijkInc is given below.In Step1,DynDijkInc updates edges’weights,removes mod-ified tree edges from b T s,and locates all locally affected vertices by calling findLocallyAffectedVertices.Notice that when findLocallyAffectedVertices is called,some of the tree edges in the input SPT may be deleted,and the current tree is denoted by b T s.Let N be the set of nodes in b T s that are reachable from the root s.The set of vertices N returned by findLocallyAffectedVertices is the complement of N.Or equivalently, N is the union of descendant sets of affected miniroots.In Step2,all locally affected vertices a are examined:if a is a boundary vertex,then d a is updated to its candidate distance,and a is enqueued into Q in the format of h a;candidate parent;candidate distance i;if a is an inner vertex,then d a is set to1.From this point on,whenever a shorter candidate distance is located for any vertex y,b d y and the candidate parent are updated.In Step3,DynDijkInc goes into iterations.Each iteration consolidates one locally affected vertex y of the minimum candidate distance,updates y’s incoming tree edge,and also relaxes y.In the relaxation part,after y is consolidated,for each child q of y,DynDijkInc updates q’s distance and candidate parent information if a shorter distance is computed.The iterations end when Q becomes empty,which indicates no boundary vertices left. Now,we look at an increase example.DynDijkIncðG;s;T s;"þÞ
Input:G is a simple directed graph,s is the source vertex, T s is an SPT rooted at s in G,and"þis a set of edges whose weights are increased such that8e i2"þ,wðe iÞis increased by i>0.
Output:The SPT b T s is a new SPT rooted at s in the updated graph G0.
Notation:For any vertex v,d v is stored in aux in b T s.
Step1:Apply the set of edge weight changes to b G,
remove modified tree edges from b T s and locate all
locally affected vertices.
1:";
2:for each e i2"þdo
3:update e i’s edge weight in b G
4:if e i is an edge in b T s then
5:remove it from b T s and add it to"
6:end if
7:end for
/*Find the set of locally affected vertices based on b T s.*/ 8: N findLocallyAffectedV erticesðb T s;"Þ
Step2:Enqueue boundary vertices with candidate
distances.A vertex a is a boundary vertex iff,after
step10,b d a¼1.
9:for each vertex a2 N do
10:b d a minðf d bþwðb;aÞ0jðb;aÞ2In a and b=2 N g[f1gÞ11:if b d a¼1then
12:ENQUEUEðQ;h a;b;b d a iÞ,where b is the candidate parent of a found in line10
13:end if
14:end for
Step3:Consolidate and relax locally affected vertices one by one.
15:while Q¼;do
16:h y;x;d i EXT RACT MINðQÞ
17:reassign the shortest path parent of y in b T s to x /*Relax outgoing edges of the consolidated vertex y.*/ 18:for each e2Out y do
19:q hðeÞ
20:if b d yþwðeÞ0<b d q then
21:b d q b d yþwðeÞ0
22:ENQUEUEðQ;h q;y;b d q iÞ
23:end if
24:end for
25:end while
26:return b T s
Example4.1.As shown in Fig.1a,the weights of edgesðc;gÞandðg;jÞare increased.In Step1,DynDijkInc removes modified tree edges and locates all locally affected vertices,i.e.,f g;k;o;p;j;i;n g.In Step2,DynDijkInc computes candidate distances for boundary vertices,i.e.,
f g;i;j;k;p g,enqueues one entry for each,and updates the
shortest distances of all inner vertices,i.e.,f o;n g,to1.
After that,DynDijkInc consolidates locally affected vertices by distance,and it also updates the incoming tree edge to each consolidated vertex.Since it is just like Dijkstra,we leave out the detail of intermediate steps.As shown in Fig.1b,all affected vertices are processed.
544IEEE TRANSACTIONS ON COMPUTERS,VOL.58,NO.4,APRIL2009
6.If more than one tail provides the same minimum distance to v,then
any one of them can be taken as the candidate parent of v.
In Figs.1a and1b,we see that vertices f o;p g are extracted despite that they have the same shortest distance and shortest parent in T0s and T s.Also,vertex i is linked to vertex f,even though i could have stayed with its old shortest parent j for the identical new shortest distance24.In the following section,we will see how MBallStringInc gets around the above undesirable results.
4.1.2MBallStringInc
Narva´ez et al.propose an intelligent semidynamic algorithm BallString in[16].Unfortunately,as will be shown later,their algorithm BallStringInc for multiple edge weight increases is not correct.Here,we propose an algorithm MBallStringInc, which is a slight modification of theirs,that correctly and efficiently computes a new SPT for multiple edge weight increases,by adapting the same branch closing idea. MBallStringIncðG;s;T s;"þÞ
Input:G is a simple directed graph,s is the source vertex, T s is an SPT rooted at s in G,and"þis a set of edges whose weights are increased.All vertices in T s are
initially closed.
Output:The SPT b T s is a new SPT rooted at s in the updated graph G0.
Notation:For any vertex v,d v and statusðvÞare stored in aux in b T s.
Step1:Apply the set of edge weight changes to b G;if a modified edge is a tree edge,remove the edge from b T s;
and locate all locally affected vertices.
1:";
2:for each e i2"þdo
3:update e i’s edge weight in b G
4:if e i is an edge in b T s then
5:remove it from b T s and add it to"
6:end if
7:end for
/*Find the set of locally affected vertices based on b T s.*/ 8: N findLocallyAffectedV erticesðb T s;"Þ
Step2:Find candidate distances/parents for boundary vertices.
9:for each vertex a2 N do
10:statusðaÞopen
11:newdist minðf d bþwðb;aÞ0jðb;aÞ2In a and b=2 N g[f1gÞ
12:if newdist¼1then
13: newdistÀd a
14:ENQUEUEðQ;h a;b;h ;newdist iiÞ,where b is the candidate parent of a located in line11
15:end if
16:end for
Step3:Consolidate and relax locally affected vertices set by set.
17:while Q¼;do
18:h y;x;h ;d ii EXT RACT MINðQÞ
19:re-assign the shortest path parent of y in b T s to x /*Consolidate all descendants of y.*/
20:N desðb T s;yÞ
21:for each v2N do
22:b d v d vþ
23:d
statusðvÞclosed
24:if v2Q then
25:REMOV Eðv;QÞ
26:end if
27:end for
/*Relax outgoing edges of just consolidated vertices.*/ 28:for each e2Out N do
29:if d
statusðhðeÞÞ¼open then
30:newdist d
d tðeÞþwðeÞ0
31: newdistÀd
d hðeÞ
32:ENQUEUEðQ;h hðeÞ;tðeÞ;h ;newdist iiÞ
33:end if
34:end for
35:end while
36:return b T s
Unlike DynDijkInc,MBallStringInc conducts branch consolidation by :it consolidates locally affected vertices according to the nondecreasing sequence of distance changes s.For each locally affected vertex v,the distance
CHAN
AND YANG:SHORTEST PATH TREE COMPUTATION IN DYNAMIC GRAPHS545 Fig.1.DynDijkInc on an example.(a)An SPT T s rooted at s in a graph G.A vertex is denoted by a single circle and a letter,an edge is denoted by an
arrow from the tail to the head,and the weight is numbered beside.In an SPT,a tree edge is highlighted by a thick arrow;the vertex’s shortest
distance is inside the vertex.In this example,wðc;gÞis increased by2,and wðg;jÞis increased by3;b T s,which is obtained from T s by removing edges ðc;gÞandðg;jÞ,is a forest of three trees:one rooted at s,one rooted at g,and another rooted at j.The latter two subtrees are circled by a dashed line.
(b)G0and T0s.Legend:a dashed arrow represents a removed tree edge in G,locally affected vertices are lightly shaded,and extracted vertices are doubly circled.。