Directed Single–Source Shortest–Paths in Linear Average ...

36
Directed Single–Source Shortest–Paths in Linear Average–Case Time Ulrich Meyer MPI–I–2001–1-002 May 2001

Transcript of Directed Single–Source Shortest–Paths in Linear Average ...

Directed Single–SourceShortest–Paths in Linear

Average–Case Time

Ulrich Meyer

MPI–I–2001–1-002 May 2001

Author’s AddressUlri h MeyerMax-Plan k-Institut f�ur InformatikStuhlsatzenhausweg 8566123 Saarbr�u [email protected]

AcknowledgementsPartially supported by the IST Programme of the EU under ontra t numberIST-1999-14186 (ALCOM-FT).

Abstract

The quest for a linear-time single-source shortest-path (SSSP) algorithm on di-rected graphs with positive edge weights is an ongoing hot research topic. WhileThorup recently found anO(n +m) time RAM algorithm for undirected graphswith n nodes,m edges and integer edge weights inf0; : : : ; 2w � 1g wherew de-notes the word length, the currently best time bound for directed sparse graphs ona RAM isO(n+m � log logn).

In the present paper we study the average-case complexity ofSSSP. We givesimple label-setting and label-correcting algorithms forarbitrary directed graphswith random real edge weights uniformly distributed in[0; 1℄ and show that theyneed linear timeO(n+m) with high probability. A variant of the label-correctingapproach also supports parallelization. Furthermore, we propose a general methodto construct graphs with random edge weights which incur large non-linear ex-pected running times on many traditional shortest-path algorithms.

KeywordsGraph Algorithms, Combinatorial Optimization, Shortest Path, Average-Case Analysis.

1 Introduction

Thesingle-source shortest-path problem(SSSP) is a fundamental and well-studied combinato-rial optimization problem with many practical and theoretical applications [1]. LetG = (V;E)be a directed graph,jV j = n, jEj = m, let s be a distinguished vertex of the graph, and be afunction assigning a non-negative realweightto each edge ofG. The objective of the SSSP isto compute, for each vertexv reachable froms, the weight of a minimum-weight (“shortest”)path froms to v, denoted bydist(v); the weight of a path is the sum of the weights of its edges.

Shortest-paths algorithms are typically classified into two groups:label-settingand label-correcting. The basic label-setting approach is Dijkstra’s algorithm[16]. It maintains a partitionof V intosettled, queued, andunreachednodes, and for each nodev a tentative distancetent(v);tent(v) is always the weight of some path froms to v and hence an upper bound ondist(v). Forunreached nodesv, tent(v) = 1. Initially, s is queued,tent(s) = 0, and all other nodes areunreached. In each iteration, the queued nodev with smallest tentative distance is selected anddeclared settled, and all edges(v; w) arerelaxed, i.e.,tent(w) is set tominftent(w); tent(v) + (v; w)g. If w was unreached, it is now queued. It is well known thattent(v) = dist(v), whenv is selected from the queue.

Label-correcting SSSP algorithms may remove nodes from thequeue for whichtent(v) >dist(v) and hence have tore-insertthose nodes until they are finally settled (dist(v) = tent(v)).In spite of poor worst-case running times, implementationsof label-correcting approaches fre-quently outperform label-setting algorithms [9, 55].

1.1 Previous Work

Using Fibonacci heaps [23] Dijkstra’s algorithm can be implemented to run inO(n logn+m)time for positive edge weights. A number of faster algorithms have been developed on themore powerful RAM (random access machine) model which basically reflects what one can usein a programming language such asC. Nearly all of these algorithms are based on Dijkstra’salgorithm and improve the priority queue data structure (see [52] for an overview).

Thorup [52] has given the firstO(n +m) time RAM algorithm forundirectedgraphs withinteger edge weights inf0; : : : ; 2w � 1g for word lengthw. His approach applies label-settingbut significantly deviates from Dijkstra’s algorithm in that it does not visit the nodes in orderof increasing distance froms but traverses a so-calledcomponent tree. Hagerup [29] recentlygeneralized Thorup’s approach to directed graphs, the timecomplexity, however, remains super-linearO(n+m � logw).

The currently fastest RAM algorithm for sparse directed graphs is due to Thorup [53] andneedsO(n+m � log logn) time. Faster approaches for somewhat denser graphs have been pro-posed by Raman [47, 48]: they requireO(m+n�plogn � log logn) andO(m+n�(w �logn)1=3)time, respectively. Further results have been obtained forbounded integer edge weights, see[48] for a recent overview. In particular, there is constant-time integer priority queue [7] thatyields a linear-time SSSP algorithm for directed graphs; however, the priority queue requires aspecial memory architecture with “byte overlap” which is currently not supported by existinghardware.

The classic label-correcting algorithm of Bellman–Ford [4, 21] and all of its improvedderivatives (see [9] for an overview) need(n � m) time in the worst case. Some of these

1

algorithms, however, show very good practical behavior forSSSP on sparse graphs [9, 55].Nevertheless, average-case analysis of shortest paths algorithms mainly focused on theAll–Pairs Shortest Paths(APSP) problem on thecompletegraph with random edge weights [12, 24,32, 43, 51]. Mehlhorn and Priebe [39] proved that for thecompletegraph with random edgeweights, every SSSP algorithm has to check at least(n logn) edges with high probability.Noshita [44] and Goldberg and Tarjan [27] analyzed the expected number ofde reaseKey op-erations in Dijkstra’s algorithm; the time bound, however,does not improve over the worst-casecomplexity of the algorithm. Meyer and Sanders [41] gave a label-correcting algorithm for ran-dom edge weights in[0; 1℄ that runs in average-case timeO(n+m+ d � L) whered denotes themaximum node degree in the graph andL denotes the maximum weight of a shortest path toa node reachable froms, i.e.,L = maxv2G;dist(v)<1 dist(v). However, there are graphs wherem = O(n) butd � E[L℄ = (n2), thus incurring(n2) time on average.

1.2 New Results

In Section 2 we present conceptually simple label-setting and label-correcting SSSP algorithmswith adaptive bucket splitting. To the best of our knowledgethese are the first algorithms whichprovably achieve linear average-case time onarbitrary directed graphswith independent ran-dom edge weights uniformly distributed in[0; 1℄. In Sections 3 and 4 we show that the resultsare also obtained with high probability (whp)1. Section 5 provides some extensions in order toestablish the same bounds for a larger class of random edge weights and improve the worst-caserunning times. We also sketch a parallelization for the label-correcting variant. In Section 6 wepropose a general method to construct graphs with random edge weights which incur large non-linear running times on many traditional label-correctingalgorithms whp. While this problemis interesting in its own right it also stresses the asymptotic superiority of our new algorithms.

Preliminary accounts of the results of the present paper have been published in [40]. Subse-quently, Goldberg obtained the same average-case bound with an alternative algorithm [26]based on radix heaps. For integer edge weights it achieves improved worst-case running times.

2 Adaptive Bucket-Splitting

In this section we present our new algorithms. We first reviewthe bucket concept for priorityqueues in SSSP algorithms (Section 2.1) and then show how it can be made adaptive in orderto yield efficient algorithms (Section 2.2). Section 2.3 sheds light on two algorithmic detailswhich are important to achieve the linear average-case bounds. Finally, Section 2.4 providesthe worst-case bounds.

2.1 Preliminaries

Our algorithms are based on keeping nodes inbuckets. This technique has already been used inDial’s implementation [15] of Dijkstra’s algorithm for integer weights inf0; : : : ; Cg: a queued

1For a problem of sizen, we say that an event occurswith high probability(whp) if it occurs with probabilityat least1�O(n� ) for an arbitrary but fixed constant � 1.

2

nodev is stored in the bucketBi with index i = tent(v). In each iteration Dial’s algorithmremoves a nodev from the first nonempty bucket and relaxes the outgoing edgesof v. In thefollowing we will also use the termcurrent bucket, Bcur, for the first nonempty bucket. Bucketsare implemented as doubly linked lists so that inserting or deleting a node, finding a bucket fora given tentative distance and skipping an empty bucket can be done in constant time. However,in the worst case, Dial’s implementation has to traverseC � n buckets.

Alternatively, a whole interval of tentative distances canbe mapped to a single bucket:v iskept in the bucket with indexbtent(v)=� . The parameter� is called thebucket width. Let �denote the smallest edge weight in the graph. Dinitz [17] andDenardo and Fox [14] observedthat taking� � �, Dijkstra’s algorithm correctly settlesanynode fromBcur. Choosing� > �either requires to repeatedly find a node with smallest tentative distance inBcur or results ina label-correcting algorithm which mayre-insertnodes intoBcur again in case they have beenpreviously removed with non-final distance value: e.g., thealgorithm of [41] uses buckets ofwidth 1=max nodedegree in order to limit the number of re-insertions. However, on sparsegraphs with few high-degree nodes, a large number of bucketsis needed.

2.2 The Algorithms

In this section we present our new algorithms, called SP-S for the label-setting version and SP-C for the label-correcting version. For ease of exposition we assume real edge weights fromthe interval[0; 1℄ (any input with non-negative edge weights meets this requirement after properscaling). The algorithm begins withn buckets at levelL0, B0,0; : : : ; B0,n-1, each of which haswidth �0 = 2�0 = 1, ands 2 B0,0 with tent(s) = 0. BucketB0,j, 0 � j < n, representstentative distances in the range[j; j + 1). A current bucket can besplit, i.e., a new level ofbuckets is created, and the nodes ofBcur are redistributed. After that, the current bucket isreassigned to be the leftmost nonempty bucket in the highestlevel of thebucket hierarchyB.

The two algorithms SP-S and SP-C only differ in the bucket splitting criterion. The label-setting version SP-S aims to have a single node in the currentbucket whereas adaptive splittingin SP-C is applied to achieve a compromise between either scanning too many narrow bucketsor incurring too manyre-insertionsdue to broad buckets. Note the difference betweenredis-tributing a node (into a new bucket of higher level because of a bucket split) and re-insertinga node (into a bucket of the hierarchy after it has already been deleted from a current bucketbefore with a larger distance value; the number of re-insertions of a node equals the numberof times it is removed from current buckets while having a non-final distance value). We firstdescribe the label-correcting approach and then give the modification to obtain the label-settingvariant.

SP-C works inphases: first, it checks the maximum node degreed� (sum of in-degree plusout-degree) among all nodes in the current bucketBcur = Bi,j of width�i at levelLi.

If d� � 1=�i, then the algorithm removesall nodes from the current bucketBcur and relaxestheir outgoing edges. This may result in new nodes enteringBcur which are removed in the nextphase. Furthermore, nodes previously removed fromBcur may re-enter it again in case theirdistances values have been improved by the relaxations. A new phase starts.

Otherwise, i.e.,d� > 1=�i, the algorithm first splitsBcur into� = �i=�i+1 � 2 new bucketshaving width�i+1 = 2�dlog2 d�e each. IfBcur represents a distance range[a; a + �i), thenBi+1,k, 0 � k < �, represents tentative distances in the range[a + k ��i+1; a + (k + 1) ��i+1),

3

SP-C (* SP-S *)

Create levelL0 and inserts intoB0,0i := 0, j := 0, �i := 1while i � 0 do

while nonempty bucket exists inLi dorepeat

go on := truej := min fk � 0 jBi,k 6= ;gd� := max fdegree(v) j v 2 Bi,jg (* b� := # nodes inBi,j *)if d� > 1=�i then (* if b� > 1 then *)

Create levelLi+1 with �i+1 := 2�dlog2 d�e (* with �i+1 := �i � 2�dlog2 b�e *)U1 := fv 2 Bi,j j 8u 2 Bi,j : tent(v) � tent(u)gU2 := fv 2 Bi,j j 8(u; v) 2 E : (u; v) � �igRemoveU1 [ U2 fromBi,j andrelax all outgoing edges from nodes inU1 [ U2Redistribute all remaining nodes fromBi,j toLi+1go on := false, i := i+ 1, j := 0

until go on = trueRemove all nodes ofBi,j and relax their outgoing edges

Remove levelLi, i := i� 1Figure 1: Pseudo-code for SP-C. Modifications for SP-S are given in brackets.

see Figure 2. Those nodes fromBi,j which have surely reached their final distance values areremoved, and their outgoing edges are relaxed (details follow in Section 2.3 and Figure 1).All remaining nodes fromBi,j are redistributed into the new buckets ofLi+1 according to theirtentative distances, i.e., a nodev with tentative distancetent(v), a � tent(v) < a + �i, ismoved up toBi+1,k with k = b(tent(v)� a)=�i+1 . The first nonempty bucket ofLi+1 becomesthe new current bucketB0

cur, and SP-C checks again the maximum node degreed� in B0cur. A

new phase starts ifd� � 1=�i+1; otherwise, a new levelLi+2 is created, the nodes ofB0cur are

redistributed, and so on.The algorithm stays with the current bucket until it is splitor finally remains empty after

a phase. Due to the non-negativity of the edge weights, once acurrent bucket in charge ofdistance range[a; a + �cur) remains empty, it will never be filled again; at that time all nodeswith distances less thana + �cur are settled. After all buckets of the highest level have beenemptied, SP-C deletes this level and continues with the nextnonempty bucket of the previouslevel. Thus, whenever the SP-C starts removing all the nodesfrom Bcur, then the followinginvariant holds:

Invariant 1 For SP-C, letd denote the maximum node degree in the current bucketBcur =Bi,j at levelLi after splitting. Then the bucket width�i of Bcur is at most2�dlog2 de � 2�i.Furthermore, the total level width ofLi, �i-1, is at most2�i+1 for i � 1.

The label-setting version SP-S differs from SP-C in the following aspect: before removingnodes fromBcur, SP-S determines the number of nodesb� in the current bucket (instead of

4

B0,iB0,i-1 B0,i+1

= 1/4∆

B1,3B1,2B1,1

L

L

L

= 1∆

B0,iB0,i-1 B0,i+1

1,0B

= 1∆

empty split unvisitedcurrent

u v

1

0

1

0

0

0

u

v

B0,1B0,0

B1,0 B1,1

B0,0 B0,1

B1,0 B1,1

= 1

1/8 1/8 1/8 1/8

L

L

L

L

= 1/2 = 1/2∆

1/16

1/16

= 1

1/8 1/8 1/8 1/8

L

L

L

= 1/2 = 1/2

∆ ∆

3

2

1

0 0

1 1

0

1

2

0

1 1

Figure 2: (Left) Basic case in the label-correcting approach: detecting a node with degree4 inB0,j of L0 forces a split into buckets of widths2�dlog2 4e = 1=4. Nodesu andv are surely settled(u has smallest tentative distance inBcur, all incoming edges ofv have weight larger thanBcur),they are not redistributed. (Right) General situation: after a bucket split, the first nonemptybucket of the highest level becomes the new current bucket.

the maximum node degree) and splitsBcur into 2dlog2 b�e new buckets in caseb� > 1, compareFigure 1. Hence, SP-S keeps on splitting buckets (while removing surely settled nodes andrelaxing their outgoing edges) until the new current bucketonly stores one nodev. As all edgeweights are non-negative, by thenv has reached its final distance as well and can be safelyremoved. Since each bucket split of SP-S creates at least twonew buckets for the next level, wehave the following invariant:

Invariant 2 For SP-S, buckets at levelLi have width�i � 2�i. The total level width ofLi,�i-1, is at most2�i+1 for i � 1.

2.3 Early Removals and Target Bucket Searches

During a bucket split both approaches do not redistribute nodes which have surely reached theirfinal distance values. This helps to reduce the overhead for transferring nodes to higher andhigher levels. Clearly, the nodeu with minimumtent(u) in Bcur = [a; a + �cur) is settled: alledges out of nodesv with dist(v) < a have already been relaxed with final distance values.Furthermore, as all edge weights are non-negative,tent(u) cannot be decreased by relaxationsof edges out of other nodesv in Bcur havingtent(v) � tent(u); compare nodeu in Figure 2.Additionally, a node is surely settled2 if all of its incoming edges have weight at least�cur, e.g.,nodev in Figure 2.

Lemma 1 Let v be a node in the current bucketBcur of width�cur. The tentative distancetent(v) is final if the lightest incoming edge ofv has weight at least�cur.2This observation was first used in [17] and [14]. Subsequently, it has also been applied in Thorup’s algorithm

[52], and a similar criterion for parallel node removal in heaps has been presented in [13]. Goldberg’s recent paper[26] for SSSP in linear average-case time also relies on thisobservation.

5

Proof: Let [a; a+�cur) denote the interval of tentative distances which belong toBcur. Theoutgoing edges of all nodes with final distances at mosta were already relaxed before, and thecorrect distance values were used for these nodes. Hence, the valuetent(v) can only be reducedvia a pathhu; : : : ; vi with total weight less thantent(v) � a < �cur andu 2 Bcur. However,since all incoming edges ofv have weight at least�cur such a path cannot exist.

For the relaxation of an edgee = (u; v) from a nodeu 2 Bcur which improvestent(v), it isnecessary to find the appropriate target bucket which is in charge oftent(v): eitherBcur or aso far unvisited non-split bucket. The target bucket searchcan be done by a simple bottom-upsearch: fort = tent(v), the search starts at levelL0 and checks whether the bucketB0 =[b0; b0 + �0) = [bt ; bt + 1) has already been split or not. In the latter case,v is movedinto B0, otherwise the search continues in levelL1 and checksB1 = [b1; b1 + �1) whereb1 = b(t� b0)=�1 . Generally, if the target bucketBi = [bi; bi +�i) at levelLi has been splitthen the search proceeds with bucketBi+1 = [bi+1; bi+1 +�i+1) wherebi+1 = b(t� bi)=�i+1 .Each level can be checked in constant time. The maximum number of levels to be checkeddepends on the splitting criterion:

Each splitting reduces�cur by at least a factor of two. For SP-C, buckets are only split inthe presence of a node with degree bigger than1=�cur. Since the maximum node degree inG is at most2 � n, the search for SP-C will be successful after at mostdlog2 2ne levels. Incontrast, all nodes redistributed by a split of SP-S may belong to the same new bucket, causingrepeated splits. However, each split settles at least one node thus limiting the height of thebucket hierarchy ton and hence the search time for relaxations toO(n).2.4 Worst-Case Bounds

In this section we consider the worst-case performance of our approaches.

Theorem 1 Using the simple bottom-up target search routine for relaxations, the worst-casetime of SP-C isO(n �m � logn), SP-S requiresO(n �m) time.

Proof: Initializing global arrays for tentative distances, levelzero buckets, pointers to thequeued nodes, and storing the lightest incoming edge for each node can clearly be done inlinear time for both algorithms.

During the execution of SP-C, if a nodeu 2 Bcur is found that has degreed > 1=�cur, thenBcur is split into at most� � 2 � (d � 1) new buckets. Each node nodeu can cause at mostone splitting sinceu is redistributed to buckets having width at most1=d, andu never movesback to buckets of larger width. Hence, the costs for the following actions can be charged onthe degree of the nodeu that caused the splitting: setting up, visiting and finally removing theat most� buckets of the new level. For all splittings this amounts toO(m) operations in total.Furthermore, each phase or splitting settles at least one node. Thus, there are at mostn phases orsplittings, each of which transfers at mostminfn;mg nodes during a splitting. For SP-C, eachphase or splitting relaxes at mostm edges; since the target buckets can be found inO(logn)time, over all phases and splittings this accounts forO(n �m � logn) operations.

The argumentation for SP-S is slightly different: again there are at mostn splittings buteach of them creates at mostminf2 � (n� 1); mg new buckets (becauseBcur cannot keep morethanminfn;mg nodes and the number of new buckets is less than twice the number of nodes

6

Bcur). This adds up toO(minfn2; n�mg) operations for setting up, visiting and finally removingall buckets and redistributing nodes to higher levels. As SP-S is a label-setting algorithm eachedge is relaxed only once. Having a maximum hierarchy heightof n this accounts for anotherO(n �m) operations.

In Section 5 (Lemma 18) we will give an extension that reducesthe worst-case time fora target bucket search (and hence for a (re-)relaxation) toO(1). After this modification, theasymptotic worst-case times of SP-S and SP-C will beO(minfn2; n � mg) andO(n � m), re-spectively.

3 Average–Case Complexity

Now we show that both SP-C and SP-S achieve linear average-case time under the assumptionof randomreal edge weights which are independent and uniformly distributed in the interval[0; 1℄. It turns out that SP-S also succeeds in linear time with highprobability whereas SP-Crequires some modifications in order to reach the same high probability bound.

3.1 Redistributions

First we will bound the average-case overhead due to node redistributions during bucket splitsof the label correcting approach SP-C.

Lemma 2 For any nodev, the average number of redistributions ofv in SP-C is bounded fromabove by a constant.

Proof: Let v be an arbitrary node with degreed andBcur the first current bucket that is splitwith v being involved. Let�cur, 0 denote the width ofBcur, and letd� > 1=�cur, 0 denote themaximum node degree inBcur, i.e., a redistribution is required. If all incoming edges of v haveweight at least�cur, 0, thenv can be removed according to the criterion of Lemma 1 (and neverre-enters a bucket)3. Otherwise, after the first redistribution,v is stored in a bucket of width1=d� or less. After thei-th timev was moved to a higher level, it is reconsidered in a currentbucketBcur, i of width�cur, i � 1=(2i�1 � d�).

For the analysis we use the principle of deferred decisions:in order to decide whethervneeds to be redistributed from the current bucket of width�cur, we query the incoming edgesof v one by one. However, instead of checking their concrete weights, we just reveal whetherthey are smaller than�cur or not. We stop after detecting the first edgee� = (u; v) with weightless than�cur. The only knowledge we gained is that (e�) is uniformly distributed in[0;�cur).Possible further redistributions ofv are due to splits of buckets with even smaller widths. Thus,the edges intov which were tested prior toe� (and therefore have weight at least�cur) do notneed to be queried again later. The weights of the (at mostd� 1) remaining edges that have notyet been tested are uniformly distributed in[0; 1℄.

Now assume thatv was already redistributedi times and that the current bucketBcur, i itresides in is split: thenBcur, i has width�cur, i � 1=(2i�1 � d�). Furthermore,P[ (e�) < �cur, i℄ <

3Note that this criterion is independent oftent(v) within Bcur.

7

1=2 since�cur, i � 1=2 � �cur, i-1, and (e�) is uniformly distributed in[0;�cur, i-1). Hence, theprobability thatv is not redistributed any more is at least12 � (1��cur, i)d�1 > 12 � (1� d ��cur, i) > 12 � 12i :Therefore, the expected number of redistributions forv can be bounded by1 + 1Xj=1 jYi=1(1� (12 � 12i )) < 1 + 1Xj=0(34)j = 5 :

Similarly, we consider the average-case overhead for node redistributions during bucketsplits of the label-setting variant SP-S:

Lemma 3 For any nodev with degreed, the average number of redistributions ofv in SP-S isbounded from above byO(1 + log d).Proof: Every split reduces the current bucket width by at least a factor of two. Hence, if a nodev with degreed takes part ini + dlog de splittings for SP-S then we are in a similar situationas in the proof of Lemma 2 for SP-C afteri splittings:v is reconsidered in a current bucket ofwidth �cur, i � 1=(2i�1 � d). Therefore, after at mostdlog de initial splittings the analysis forSP-C completely carries over to SP-S: the redistribution ofv stops after anotherO(1) splittingson the average.

We combine the results of the previous two lemmas with observations made in Section 2 inorder to obtain the following partial result:

Lemma 4 All bucket splittings of SP-C and SP-S can be done in average-case timeO(n +m)in total.

Proof: For SP-C, as already discussed for the worst-case bound, setting up, visiting and finallyremoving the buckets of the new level can be charged on the degree of the node which causedthe splitting. As each node can cause at most one splitting this sums up toO(m) operations.The remaining operations involved in splittings are due to node redistributions; by Lemma 2is amounts toO(1) for each node on the average, hence all splittings of SP-C canbe done inO(n+m) average-case total time.

The number of new buckets created by a bucket splitting of SP-S is proportional to the num-ber of nodes in the split bucket. Therefore, the total average-case costs for all split operationsof SP-S are proportional to the total number of redistributed nodes, and this number can bebounded byO(n+Pv2G logdegree(v)) = O(n+m) using Lemma 3.

8

3.2 Target Bucket Search

Now we address the complexity to find the appropriate target bucket for node (re-)insertions or(re-)relaxations. A modification presented in Section 5 reduces the worst-case search time fromO(max. hierarchy height) toO(1), thus immediately yielding a linear time average-case boundfor SP-S (there are no node re-insertions and each edge is relaxed at most once). However, forrandom edge weights, the simple bottom-up search strategy of Section 2.3 is equally suited forboth SP-C and SP-S.

Lemma 5 The target bucket for an (re-)insertion or (re-)relaxationvia an edgee = (u; v) canbe found in constant time on average.

Proof: The weight ofe is uniformly distributed in[0; 1℄. Therefore, looking at a specific levelLi, the probability thattent(v) = tent(u) + (u; v) with u 2 Bcur belongs toLi is at most thetotal width ofLi, �i-1. By Invariants 1 and 2,�i-1 � 2�i+1 for i � 1. Thus, for maximumhierarchy heighth, the expected search time when checking levels in bottom-upfashion isbounded by O(1 + hXi=1 i � 2�i+1) = O(1 + 1Xi=1 i � 2�i+1) = O(1):The average-case search time is maximal if the bucket hierarchy has been build by recursivelysplitting the first bucket of the topmost level into two new buckets and nodeu represents thesmallest possible distance in the topmost level, see Figure3.

12345

B0,1B0,0

B1,0 B1,1

= 1

L

L

L

L

= 1/2 = 1/2∆

1/8 1/8

1/16

1/16

1/41/4

L

L

3

2

1

0 0

1 1

4

5

Figure 3: A worst-case setting for edge relaxations with bottom-up search.

3.3 The Label-Setting Bounds

We are ready to state the first result for SP-S:

Theorem 2 SP-S runs on arbitrary directed graphs with random edge weights that are inde-pendent and uniformly drawn from[0; 1℄ in O(n +m) average-case time.

Proof: As shown in Section 2, the initialization for SP-S can be donein O(n + m) time. ByLemma 4 all bucket splits together requireO(n+m) time on average. Due to the label-settingapproach each edge is relaxed at most once: this accounts forO(m) target bucket searches eachof which takesO(1) time on average by Lemma 5.

9

It is surprisingly simple to show that the average-case timebound of Theorem 2 for SP-S also holds with high probability. Our basic tool is a variant of the well-known Chernoff-Hoeffding bounds:

Lemma 6 ([19, 33]) Let the random variablesX1; : : : ; Xn be independent, withak � Xk � bkfor eachk, for some arbitrary realsak, bk. LetX =PkXk. Then for anyt � 0,P [jX � E [X℄j � t℄ � 2 � exp � �2 � t2Pk(bk � ak)2� : (1)

We have to reconsider the total number of nodes redistributions (Lemmas 3 and 4) and the totalnumber of operations for target bucket searches (Lemma 5):

Lemma 7 SP-S incursO(n+m) node redistributions with high probability.

Proof: By Lemma 3 (and Lemma 2) the probability that a nodev with degreed is redistributedduring bucket splittings on levelsLdlog de+j or higher is bounded from above by

P1j (3=4)j.Hence, we can choosej = �(logn) to see thatv is redistributed at mostr(v) � dlog de +j = �(logn) = r times with probability at least1 � n� �1 for an arbitrary constant > 0.Furthermore, by Boole’s inequality, no node is redistributed more thanr times with probabilityat least1 � n� . Note that the argumentation above also bounds the maximum height of thebucket hierarchy byr = �(logn) whp.

Let Xv be the random variable denoting the upper bound of redistributions for nodev asgiven in Lemma 3. Recall that only weights of edges entering nodev have been used to deriveXv, i.e., these random variables are independent. LetX = PvXv. By Lemma 3 we haveE[X℄ = O(n +m). We defineX 0v = minfXv; rg andX 0 = Pv X 0v. Hence,E[X 0℄ � E[X℄.Now we can apply the Chernoff-Hoeffding bound (1) from Lemma6 forX 0:P[X � E[X℄ + t℄ � P[X 0 � E[X℄ + t℄ + n� � P[X 0 � E[X 0℄ + t℄ + n� � 2 � exp ��t2n � r�+ n� � 2 � n� for t = n :Lemma 8 All target bucket searches of SP-S can be performed in totalO(n + m) time withhigh probability.

Proof: LetXe be the random variable denoting the upper bound on the level checks needed toperform a target bucket search for edgee as given in Lemma 5. Recall thatXe has been derivedindependently from all other edge weights,E[Xe℄ = O(1), and thatXe takes values from one upto the maximum hierarchy height which in turn is bounded byr = �(logn) whp according toLemma 7. In complete analogy to the proof of that lemma we boundP[PeXe � E[PeXe℄+n℄from above byO(n� ), � 1, using Boole’s inequality and the Chernoff-Hoeffding bound forrandom variablesX 0e = minfXe; rg.

10

The linear time high probability bound for SP-S immediatelyfollows from Theorem 2 andthe two last lemmas. The worst-case time�(n � m) can be trivially avoided by monitoringthe actual resource usage of SP-S and starting the computation from scratch with Dijkstra’salgorithm after SP-S has consumed�(n�logn+m) operations. Similarly, SP-S can be combinedwith other algorithms in order to obtain improved worst-case bounds for non-negative integeredge weights [48].

Theorem 3 Using the label-setting approach SP-S, single-source shortest-paths on arbitrarydirected graphs with random independent edge weights uniformly drawn from[0; 1℄ can besolved inO(n+m) time with high probability while preserving anO(n � logn+m) worst-casetime bound.

3.4 Average-Case Complexity of the Label-Correcting Approach

For the label-correcting version SP-C we still have to boundthe overhead due to node re-insertions. Each nodev reachable from the single sources will be inserted into the bucketstructureB and removed from a current bucket at least once. A re-insertion of v into B occursif v had already been deleted from some current bucket with non-final distance valuetent(v)before, and the relaxation of an edge intov improvestent(v). A re-insertion ofv subsequentlytriggers another deletion ofv from a current bucket involving re-relaxation ofv’s outgoingedges. Hence, a re-insertion ofv has to be clearly distinguished from aredistributionof v toa higher level bucket because of a bucket split. Furthermore, if v is already present in a so farunvisited bucket andv is moved to another bucket because of a relaxation, this is alsonot con-sidered a node re-insertion ofv. The two latter operations do not incur additional relaxations ofv’s outgoing edges.

We will map node re-insertions on paths between nodes (Lemma10) using the observationthat long paths with small total weight are unlikely for random edge weights (Lemma 9). In thefollowing, a path without repeated edges and total weight atmost� will be called a�-path.

Lemma 9 ([41]) Given a pathP of l non-repeated edges with independent and uniformly dis-tributed edge weights in[0; 1℄. The probability thatP is a �-path is bounded by�l=l! for� � 1.

Proof: Let Xi denote the weight of thei-th edge on the path. The total weight of the path is

thenPli=1Xi. We prove by induction overl thatP hPli=1Xi � �i = �l=l! for � � 1: ifl = 1 then due to the uniform distribution the probability that a single edge weight is at most� � 1 is given by� itself:P [X1 � �℄ = �. Now we assume thatP hPli=1Xi � �i = �l=l!

for � � 1 is true for somel � 1. In order to prove the result for a path ofl + 1 edges, we splitthe path into a first part ofl edges and a second part of one edge. For a total path weight at most� we have to consider all combinations for0 � z � � � 1 such that the first part ofl edgeshas weight at most�� z and the second part (one edge) has weightz. Thus,P hPl+1i=1Xi � �i = R �0 P hPli=1Xi � �� xi dx = R �0 (��x)ll! dx = �l+1(l+1)!

After having formalized the observation that long paths with small total weight are unlikelywe now map re-insertions on such paths. In the following, we will distinguishlocal re-insertions

11

where the re-inserted node is put to the current bucket andfar re-insertions where the targetbucket is not the current bucket.

Lemma 10 For any nodev, SP-C incurs at most10 re-insertions on average.

Proof: Consider an arbitrary reachable nodev with degreed. We first discuss re-insertions intoa current bucket due to node removals from this very bucket (local re-insertions). According toInvariant 1, SP-C tries to settlev for the first time (say in phaset) by removing it from a currentbucketBi0;j0 of levelLi0 having width�i0 = 2�I0 � 2�dlog2 de � 2�i0. The nodev can onlybe re-inserted for phaset + 1 in the following situation:v has an incoming edgee = (u; v)of length at most�i0 , u is removed fromBi0;j0 in phaset and the relaxation ofe gives animprovement fortent(v); compare Figure 4. Another re-insertion for the phaset + 2 needs anincoming pathhu1; u2; vi of two edges with sufficiently small total weight (at most�i0) suchthatu1 is removed fromBi0;j0 in phaset andu2 is removed fromBi0;j0 in phaset + 1 andtent(v) improves. And so on. We defineGi to be the subgraph ofG which is induced by allvertices with degree at most2i. All nodes inBi0;j0 have degree at most2I0, hence the pathsrequired for re-insertions ofv in Bi0;j0 are simple(2�I0)-paths intov in GI0.

Phase:

t

t+1

t+2

t+3

v

v

v

v

cur

u

u u

u u u

1 2

1 2 3

Figure 4: Local re-insertions of nodev in phasest + 1 andt + 3. There is no re-insertion ofvin phaset + 2 becausetent(v) is not improved.

If Bi0;j0 is split andv is not filtered out and settled by an early removal, thenv may beremoved again from current bucketsBi1;j1; : : : ; Bik;jk of levels i1 < : : : < ik which coversmaller and smaller parts ofBi0;j0. As above, all nodes inBix;jy have degree at most2Ix Thus,after thek-th phase of emptyingBix;jy , v can (re-)enter the current bucketBix;jy for the nextphase via a(2�Ix)-path ofk edges intov in GIx provided that its total path weight is sufficientlysmall.

Therefore, an upper bound on the total number of paths identified above (which in turnbound the number of local re-insertions ofv) is given by4dlog2 2ne�1Xi=dlog2 de # simple(2�i)-paths intov in Gi = dlog2 2ne�1Xi=0 # simple(2�i)-paths intov in Gi (2)

Since all nodes inGi have degree at most2i, no more thand � (2i)(l�1) simple paths ofl edgeseach enter nodev in Gi. Taking into account the probability that these paths are(2�i)-paths

4Note that the two sums are equivalent sincev is not part of the subgraphsG0; : : : ; Gdlog2 de�1.

12

(Lemma 9), the average-case number of these paths intov over all levels is bounded from aboveby dlog2 2neXi=k 1Xl=1 d � 2i�(l�1) � 2�i�l=l! = dlog2 2neXi=k d2i � 1Xl=1 1l!! � dlog2 2neXi=k 2�i+k � e � 2 � e :

We still have to deal with those re-insertions ofv into the bucket hierarchyB where the targetbucket isnot the current bucket (far re-insertions). Note that such a re-insertion ofv will takeplace in a bucketBk;l which covers a fraction from the distance range of that current bucketBi;j,i < k, from whichv was deleted for the last time. The nodev will be eventually encountered:either after the algorithm changed the current bucket or – after an update oftent(v) – nodevmoved into the current bucket from where it will be deleted inthe next phase. After that, furtherre-insertions ofv will take place in the current bucket as local re-insertions, until eitherv issettled or the current bucket is split again. Therefore, a far re-insertion ofv can happen at mostonce per level.

However, after the very first removal ofv at all, from a bucketBi0;j0, tent(v) is alreadycorrect up to at most�i0 = 2�I0 � 2�dlog2 de. The first far re-insertion ofv may only happenfor some levelLi1 , i1 > i0, having total level width at most�i0 = 2�I0 � 2�dlog2 de: a farre-insertion ofv intoBi1;j1 requires a nodeu which is removed from some current bucketBx;y,x > j0 and an edge(u; v) with weight less than the total width ofLi1 . Hence, the probabilitythat the weight of(u; v) is sufficiently small is bounded from above by�i0 � 2�dlog2 de. Thewidths of higher levels decrease geometrically,�ik � 2�dlog2 de�k. See Figure 5 for an example.Once all incoming edges ofv have weight larger than the level width under consideration, no

L

L

L

L i

v

v

v

v

i

i

i

0

1

2

3

Figure 5: Far re-insertions for nodev at higher levels require smaller edge weights.

further far re-insertions ofv can happen for higher levels. Therefore, in complete analogy tothe number of redistributions of a nodev during bucket splits (Lemma 2) we can give an upperbound on the average number of far re-insertions ofv by just examining the weights of incomingedges ofv in piecemeal fashion and exploit that after each level thereis a constant probabilitythat no further far re-insertions ofv will happen; we conclude that the average number of farre-insertions ofv is bounded by1Xj=1 jYi=1(1� (12 � 12i )) < 1Xj=0(34)j = 4 :Summing up the two bounds for local and far re-insertions we find thatv is re-inserted at most2 � e+ 4 < 10 times on average.

13

Corollary 1 The expected number of re-insertions of SP-C is bounded byE[n+℄ = O(n) andthe expected number of re-relaxations is bounded byE[m+℄ � 10 �Xv2G out-degree(v) = O(m) :Theorem 4 SP-C runs on arbitrary directed graphs with random edge weights that are inde-pendent and uniformly drawn from[0; 1℄ in O(n +m) average-case time.

Proof: Similar to SP-S, the initialization of SP-C can be done inO(n+m) time. By Lemma 4,all bucket splits require accumulatedO(n + m) time on average. According to Corollary 1there areO(n + m) (re-)insertions and (re-)relaxations on average each of them involving atarget bucket search. The proof of Lemma 5 upper-bounds the average-case search time for anedge(v; w) independent of the placement ofv in the bucket hierarchy and the number of timesv is re-inserted. On the other hand, the weights of edges leaving v are not used to bound thenumber of re-insertions forv in the proof of Lemma 10. Hence, we can combine Corollary 1and Lemma 5 to obtain the average-case linear time bound.

4 A High–Probability Bound for SP-C

In order to prove a linear time bound that holds with high probability, the label correctingapproach SP-C has to be changed in some aspects. In its current form – even though the totalnumber of re-insertions is bounded byO(n) on average – some nodes may be re-inserted alogarithmic number of times with non-negligible probability. If such a node has out-degree�(n) then SP-C incurs a super-linear number of re-relaxations since each time all outgoingedges are relaxed.

In Section 4.1 we give the modifications for SP-C* to cope withthat problem; Section 4.2provides the adapted analysis for the high probability bounds.

4.1 Modified Algorithm

Our refined version which we will call SP-C* applies deferrededge relaxations: Only edgesof weight at most the current bucket width are immediately relaxed. Due to the correlation ofbucket widths and maximum node degrees this means that for each deleted node only a con-stant number of edges will be immediately relaxed in expectation and not much more with highprobability. Correctness is preserved since larger edge weights cannot influence the tentativedistances in the current bucket. Edges with larger weight are relaxed (with proper distancevalues) once their source node is guaranteed to be settled. We first give the appropriate modifi-cations of SP-C:

1. For each nodeu create a listOu, that keeps the outgoing edges ofu in semi-sorted order5

according to their weights, i.e.,Ou consists of at mostdlog2 2ne+1 groups where groupgi,5The semi-sorted order can be obtained in linear time by integer sorting for small values; edge weights (ek) >2�dlog2 2ne are mapped toblog2 1= (ek) thus creating integers from0 to dlog2 2ne � 1, smaller edge weights are

mapped to the integerdlog2 2ne. After the sorting, the order is reversed such that large integers (which account forsmall edge weights) appear first.

14

0 � i < dlog2 2ne holds all outgoing edgesek with 2�i�1 < (ek) � 2�i in arbitraryorder,gdlog2 2ne keeps all edges with weight at most2�dlog2 2ne in arbitrary order, andgiappears beforegj for all j < i.

2. Let u be a node which is removed fromBcur. Unlessu is removed fromBcur during abucket split (i.e.,tent(u) is final by Lemma 1), only edges(u; v) with weight at most�cur are relaxed. They always constitute the first groups inOu due to the semi-sorting.The remaining edges are relaxed once and for all afterBcur and its refining buckets (ifpresent) finally remain empty. By then, all involved nodes are surely settled.

In order to remember those edges which still have to be relaxed, every bucketBi,j is equippedwith an additional edge listEi,j . Whenever a nodeu is deleted fromBcur = Bi,j (either byremoving or redistributing) we move all remaining edgesek satisfying (ek) > �cur from Outo Ei,j . Note that these edges constitute the last groups inOu. Hence, ifu is re-inserted intoBcur no transferable edges are left inOu, and this can be checked in constant time. All edgesin Ei,j are relaxed once afterBi,j finally remains empty or – in caseEi,j has been split – after itsrefining levelLi+1 is removed. It is easy to check by induction that this schedule of deferrededge relaxations does not affect the correctness of the algorithm since all potentially relevantedges are relaxed in time.

4.2 Modified Average-Case Analysis

In the following we will give separate high probability bounds on the total number of local re-insertions (re-relaxations),n0+ (m0+), and the total number of far re-insertions (re-relaxations),n00+ (m00+). By Boole’s inequality, the combined bounds,n+ = n0+ + n00+ andm+ = m0+ +m00+also hold with high probability.

In Section 4.2.1 we start with an alternative proof ofE[n0+℄ = O(n) that is applicable to bothSP-C and SP-C* (Lemma 11 and Corollary 2). We extend the idea of this proof to show that themodifications of SP-C* reduceE[m0+℄ fromO(m) toO(n) as well (Corollary 3). Section 4.2.2provides some observations concerning the number of edges on paths with small total weight(Lemma 12) and the number of nodes reachable via such paths (Lemma 13). Using these obser-vations together with the alternative proof scheme of Lemma11 we can apply Azuma’s Mar-tingale tail inequality [38] to yield whp-bounds onn0+ andm0+ for local re-insertions and theirassociated edge re-relaxations in Section 4.2.3. Equivalent whp-bounds for far re-insertions andtheir re-relaxations are given in Section 4.2.4. Finally, re-considering the overhead for node re-distributions during bucket splits and target bucket searches (Section 4.2.5) completes the prooffor the whp-bound of SP-C*.

4.2.1 Mapping Local Re-Insertions to Connection Pairs

Our average-case analysis of Section 3.4 applied a pretty intuitive mapping of local node re-insertions to paths of small weight in induced subgraphs. For the whp-bound we want to useAzuma’s Martingale tail inequality [38] in order to show that a modification of edge weightsout of some arbitrary node will not dramatically change the total number of local re-insertions.However, – given our crude estimates on the maximum number ofpaths with small total weight,Lemma 10, (2) – a modification of an edge weight could affect too many of these paths. There-fore, we will map the local re-insertions onconnection pairsbetween nodes deleted from the

15

same bucket. This mapping is also valid for the basic algorithm SP-C. Some parts of the fol-lowing analysis extend proofs from the full version6 of [41].

As before, a path with total weight at most� which does not follow any edge more thanonce (a path “without edge repetition”) will be called a�-path. We defineGi to be the subgraphof G which is induced by all vertices with degree at most2i. LetCi be the set of all node pairs[u; v℄i connected by some(2�i)-pathhu; : : : ; vi in Gi, hence all nodes on the pathhu; : : : ; vihave degree at most2i. Furthermore, letCvi be the set of those pairs inCi whose secondcomponent isv. We give an injective mapping from the set of local re-insertions ofv into theset of connection pairsCv = [iCvi .

Lemma 11 For both SP-C and SP-C*, the total number of local re-insertions of a nodev isbounded by

Pdlog2 2ne�1i=dlog2 degree(v)e jCvi j.Proof: Consider a local node re-insertion ofv into a fixed current bucketBcur = [a; a+�cur)for phaset. Hence, all nodes with final distance less thana have already been assigned theircorrect label, they are settled;tent(v) is correct up to at most�cur. Due to Invariant 1,�cur =2�j � 2�k, for some integerj � k, wherek = dlog2 degree(v)e. UnlessBcur is split or finallyremains empty, both SP-C and SP-C* explore paths withinGj.

Let us fix a (constrained)shortest pathA(v; Bcur) = hs; : : : ; v0; v1; : : : ; vl; vi from s to vsuch that all nodess; : : : ; v0 are reached in optimal shortest path distance less thana (they aresettled inG), andv1; : : : ; vl with distance at leasta have degree at most2j. Hence,hv1; : : : ; vl; viis a shortest path fromv1 to v in Gj. UnlessBcur is split, the nodevi will be removed fromBcur

when for thei-th time all nodes are removed from this bucket; after thatvi will never re-enterBcur. However, note that in caseBcur is split and paths fromGj0, j 0 > j are considered inthe suffix of the shortest path froms to v, the distance ofvi may improve. In that caseviwill appear again in some higher level bucket of width2�j0. Therefore, after thei-th phase ofemptyingBcur, vi is only locally settled whereas all nodes on the sub-pathhs; : : : v0i are alreadygloballysettled.

Since we are considering a local re-insertion ofv there must be a most recent phaset0 < twhenv was removed from this particularBcur and no split happened since then. Letv0 be thefirst locally unsettled node onA(v; Bcur) immediately before phaset0. Hence, according to theconstraints given above,v0 has reached its local shortest path distance forGj after the edgerelaxations of phaset0 � 1. It will be removed fromBcur in phaset0, locally settled, and willnever re-enter this current bucket. By definition,v is removed fromBcur in phaset0 as well,but it will re-enterBcur in phaset, thereforev0 6= v. The sub-pathA0(v0; v) = hv0; : : : ; vi ofA(v; Bcur) is a shortest path fromv0 to v in Gj. Since bothv0 andv are removed together fromBcur with bucket width2�j in phaset0, A0(v0; v) is also a(2�j)-path, i.e.,[v0; v℄j 2 Cvj . As v0becomes locally settled for bucket width(2�j), the re-insertion ofv in phaset can be uniquelymapped to[v0; v℄j.Corollary 2 For both SP-C and SP-C*, the total number of local re-insertions is bounded byn0+ �Pdlog2 2ne�1i=0 jCij, andjCij is bounded by the number of simple(2�i)-paths inGi. Hence,by Lemma 10,E[n0+℄ = O(n).

6http://www.mpi-sb.mpg.de/�umeyer/dps/delta-long.ps.gz

16

According to our modifications listed above, re-relaxations of e = (v; w) for v 2 Bcur canonly occur if (e) � �cur. Therefore, arguing along the lines of Lemma 11, re-relaxations dueto local re-insertions (in the following calledlocally caused re-relaxations) can be uniquelymapped to the setC� = [i C�i whereC�i holds triples[u; v; w℄i with [u; v℄i 2 Ci ande = (v; w)having weight at most2�i. Thus, an upper bound on the total number of locally caused re-relaxations,m0+ is given bym0+ � jC�j. Similarly to Lemma 10, the number of locally causedre-relaxation for edges out of nodev wherekv = dlog2 degree(v)e can be bounded bydlog2 2ne�1Xi=kv �

# simple(2�i)-paths intov within Gi � # edgese = (v; w) with (e) � 2�i � (3)

Furthermore,m0+, does not exceedXv2G dlog2 2ne�1Xi=kv # (2�i+1)-paths without repeated edges intov in Gi (4)

since any pathhu; : : : v; wi in Gi with non-repeated edges wherehu; : : : vi is a (2�i)-path andthe edge(v; w) has weight at most2�i is also a(2�i+1)-path inGi, but not the other way round.

Corollary 3 By Lemma 9, Formula (4) and the observation that there are at most2i�l paths withnon-repeated edges of lengthl into each node ofGi, it follows that the total expected number oflocally caused re-relaxations in SP-C* is bounded byE[m0+℄ = O(n).4.2.2 Some Observations for Random Edge Weights

The actual values of our boundsn0+ andm0+ can be regarded as functions of then independentrandom variablesXv := f(v; w; (v; w)) : (v; w) 2 E)g, i.e.,Xv describes all edges leavingnodev including their weight. On the other hand,n0+ andm0+ are bounded by the setsjCj andjC�j, respectively, and the sizes of these sets in turn are bounded by certain numbers of paths(Formulae (2) and (4)).

In the following we will show that all these paths consist ofO(logn= log logn) edges whp(Lemma 12) and that number of nodes reached from some arbitrary nodev via such paths israther limited whp (Lemma 13). Therefore, the modification of a single random variableXvcan only affect a limited number of entries of the setsC andC�. These observations will beused in Section 4.2.3. to yield the desired high-probability bound onn0+ andm0+ using Azuma’sMartingale inequality.

Lemma 12 Each(2�i+1)-path without repeated edges inGi contains no more thanl� = O( lognlog log n)edges for all0 � i < dlog2 2ne whp.

Proof: There are at most2i�l paths without edge repetitions of lengthl into each node ofGi. ByLemma 9, the probability for the presence of any(2�i+1)-path inGi with l edges can be boundedby n � (2�i+1 � 2i)l=l! = n � 2l=l!. Hence, by Boole’s inequality there are no(2�i+1)-paths ofl � l� edges inGi for all 0 � i < dlog2 2ne with probability at least1�Xl�l� n � dlog2 2ne � 2l=l! � 1� n � dlog2 2ne � 2l�=l�! �Xl�0 2l=l!� 1� n � dlog2 2ne � 2l�=�((l�=e)l� � pl�) � e2 � 1�O(n � logn) � (2 � el� )l� � 1� n� for some arbitrary positive constant andl� = �( log nlog log n).

17

Clearly, the bound of Lemma 12 also holds for(2�i)-paths without edge repetitions inGi.Now we bound the number of nodes that are either reached from agiven nodev via (2�i)-pathswithout repeated edges inGi or reach nodev via such paths. Similarly, we consider reachabilityin Gi via (2�i+1)-paths that consist of a(2�i)-path plus a terminal edge of weight at most2�i:Lemma 13 For any nodev,jfu : [v; u℄i 2 C _ [u; v℄i 2 C; 0 � i < dlog2 2negj � nO(1= log log n)and jfu : [v; w; u℄i 2 C� _ [u; w; v℄i 2 C�; 0 � i < dlog2 2negj � nO(1= log log n)with high probability.

Proof: Consider the nodes reached fromv via (2�i+1)-paths inGi. We argue that the numberof nodes reachable by connections inCi of length l can be bounded by the offspring in thel-th generation of the following branching process ([3, 31] provide an introduction to branchingprocesses): An individual (a node)u has its offspring defined by the numberYu of edges withweight at most2�i+1 leaving it. LetZl denote the total offspring afterl generations whenbranching from nodev (i.e.,Z1 = Yv). Thebranching factorof a branching process is given by� = E[Z1℄. Furthermore, for branching processes with identical and independent probabilitiesfor the generation of new nodes,E[Zl℄ = �l. Additionally, it is shown in [2] (as cited in [35,Theorem 1]) thatZl = O��l logn� whp.

As long as new edges are encountered when following paths outof v, the offspring of thebranching process is an exact model for the number of paths leaving v which use only edgeswith weight at most2�i+1. After a node has been reached from multiple paths, the events onthose paths are no longer independent. However, all but one of the multiple paths produce onlyduplicate entries intoCi. The additional paths can therefore be discarded. All remaining eventsare independent.

For independent edge weights uniformly distributed in[0; 1℄, we haveE[Yu℄ � degree(u) �2�i+1 � 2 and by the discussion above,E[Zl℄ � (max-degree(Gi) � 2�i+1)l � 2l andZl = O((max-degree(Gi) � 2�i+1)l � logn) = O(2l � logn) whp.

In order to asymptotically bound the sumPj�l Zj we can concentrate on termZl since a grow-

ing exponential sum is dominated by its last summand:Pj�l Zj = O(2l � logn) whp. By

Lemma 12 we havel � l� = O( log nlog log n) whp. Therefore, the number of nodes reached fromv via (2�i+1)-paths inGi is at mostO(2l� � logn) whp. Since the number of nodes reachedfrom v via (2�i)-paths inGi can only be smaller we obtain the boundjfu : [v; u℄i 2 Cigj =O(2l� � logn) whp. Similarly, we obtainjfu : [u; v℄i 2 Cigj = O(2l� � logn) whp by justtraversing the edges during the branching process in opposite direction. Finally, using Boole’sinequality we getjfu : [v; u℄i 2 C _ u : [u; v℄i 2 C; 0 � i < dlog2 2negj = O �2 � dlog2 2ne � 2O( lognlog logn ) � logn�= nO( 1log logn ) whp

for any nodev. For the elements ofC�i note thatjfu : [v; w; u℄i 2 C�i gj is bounded by the set ofnodes reached fromv via (2�i+1)-paths inGi which in turn we have shown to be bounded byO(2l� � logn) whp. Repeating the argument above yields the statement for elements inC�.

18

4.2.3 Local Re-Insertions

Equipped with the observations from Section 4.2.2 we are nowready to show

Lemma 14 SP-C* incurs at mostn0+ = O(n) local re-insertions andm0+ = O(n) locallycaused re-relaxations with high probability.

Proof: Let Q stand for the event that the whp-bounds of Lemma 13 hold for all nodesv andthat at mosta � logn edges with weight at most(2�i+1) leave any nodev in Gi for all i �d2 � logne. By Boole’s inequality and Chernoff bounds [38],Q holds whp for some constanta and sufficiently largen. If Q does not hold thenn0+ � n2 � logn andm0+ � n3 � lognby the definitions of the setsC andC�. Therefore,E[n0+jQ℄ � E[n0+℄ + o(n) = O(n) andE[m0+jQ℄ � E[m0+℄ + o(n) = O(n). It suffices to boundP[n0+ > E[n0+jQ℄ + t jQ℄ andP[m0+ > E[m0+jQ℄ + t jQ℄ for somet = O(n).

By our definition of then independent random variablesXv := f(v; w; (v; w)) : (v; w) 2E)g we can apply Azuma’s Martingale tail inequality [38] to showP[n0+ > E[n0+jQ℄ + t jQ℄ � exp

� �t22 �Pv2G 2v�where v is defined such that (givenQ) changing the value of variableXv (while maintainingQ) could change

Pj jCjj � n0+ by at most v.Now we determine v for the bound onn0+: as Q holds, there are at mostna= log log n

connection pairs[u; v℄i 2 Ci with second componentv. Furthermore, the number of edgeswith weight at most2�i leavingv is at mosta � logn, and their target nodes in turn reach atmostna= log log n nodes each via(2�i)-paths inGi. Therefore, multiplying these three quan-tities gives an upper bound for the number of elements affected in Ci by a modification ofXv while maintainingQ. Since the argument is valid for all subgraphsGi, we have v �dlog2 2ne � (na= log log n)2 � a � logn = nO(1= log log n). Applying this argument to all nodes we get2 �Pv2G 2v � 2 � n � (nO(1= log log n))2 = n � nO(1= log log n) andP[n0+ > E[n0+jQ℄ + n jQ℄ � e�n(1�O( 1log log n )):SinceE[n0+jQ℄ � E[n0+℄+o(n) = O(n) becauseQ holds whp, the last bound can be simplifiedtoP[n0+ > O(n)℄ � n� for any positive constant > 1. Analogously,P[m0+ > E[m0+jQ℄ + t jQ℄ � exp

� �t22 �Pv2G ~ v2�where ~ v is defined such that changing the value of variableXv respectingQ could influencePj jC�j j � m0+ by at most~ v. As shown above, such a modification ofXv changes

Pj jCjj byat mostnO(1= log log n). By Q, there are at mosta � logn edges with weight2�i out of nodewfor each affected node pair[u; w℄i 2 Ci. Hence, at mostnO(1= log log n) � a � logn = nO(1= log log n)entries of

Pj jC�j j are affected, i.e.,~ v � nO(1= log log n). The rest of the argument for the whp-bound onm0+ is the same as for the bound onn0+.

19

4.2.4 Far Re-Insertions and Redistributions

So far we have shown that the bounds on the total number of local reinsertions,n0+, and the totalnumber of locally caused re-relaxations,m0+, do not significantly deviate from their expectedvalues whp. Now we do the same for the total number of far re-insertions,n00+, and the totalnumber of re-relaxations caused by them,m00+:

Lemma 15 SP-C* incurs at mostn00+ = O(n) far re-insertions andm00+ = O(n) far causedre-relaxations with high probability.

Proof: We define then independent random variablesX 0w := f(v; w; (v; w)) : (v; w) 2 E)gas sets of edge weightsinto nodew. Lemma 10 derives an upper boundf(X 0v) for the numberof far re-insertions for any nodev by exclusively taking into consideration the weights of theedges enteringv. In particular,E[f(X 0v)℄ = O(1) andE[n00+℄ = O(n). There is at most onefar re-insertion ofv for each level, and the number of levels is bounded byO(logn). Hence,we can give a high probability bound on the sum of all far re-insertions, using the Chernoff-Hoeffding bound (Fomula (1)) withak = 0, bk = O(logn) and t = n in order to shown00+ =Pv f(X 0v) � E[n00+℄ +O(n) = O(n) whp.

For the number of far caused re-relaxations we use a similar argument as in the proof ofLemma 14: letQ0 be the event that inGi at mosta � logn edges with weight at most2�i leaveany node. GivenQ0, the far re-insertion of a nodev into a bucket of width2�i triggers at mosta � logn re-relaxations whenv is deleted (recall that the algorithm relaxes edges(v; w) withweight larger than the current bucket width only afterv is surely settled).Q0 holds whp for an appropriate constanta and sufficiently largen (Chernoff bounds). IfQ0 is not true (this happens with probability less thann� for some arbitrarily large positiveconstant � 3) each node can take part in at mostO(logn) far re-insertions each of whichrelaxes at mostn edges. Therefore,E[m00+jQ℄ � E[m00+℄+o(n) and it suffices to boundP[m00+ >E[m00+jQ0℄ + t jQ0℄ for somet = O(n). Again we apply Azuma’s Martingale tail inequality toshow P[m00+ > E[m00+jQ0℄ + t jQ0℄ � exp

� �t22 �Pv2G 02v �where changing the value of variableX 0v could changem00+ by at most 0v (givenQ0). By thediscussion above, modifyingX 0v will changen00+ by at mostO(logn), and each such far re-insertion triggers at mostO(logn) edge re-relaxations (givenQ0). Therefore 0v = O(log2 n),i.e., P[m00+ > E[m0+jQ℄ + n jQ℄ � e�n=O(log4n). Using E[m00+jQ0℄ = E[m00+℄ + O(n) =O(E[n00+℄) +O(n) = O(n) we getP[m00+ > O(n)℄ � n� for any positive constant > 1.

By now we have obtained whp-bounds on the total number of bothtypes of node re-insertions and edge re-relaxations. We still have to check the overhead due to node redistri-butions during bucket splits:

Lemma 16 All node redistributions can be done in totalO(n) time whp.

Proof: As the number of node redistributions is bounded in the same way as the number offar node re-insertions (compare Lemma 10), the proof is equivalent to the proof for the highprobability bound ofn00+ in Lemma 15.

20

4.2.5 Target Bucket Searches

Finally, we will show a that the target bucket searches involved in all (re-) insertions and (re-)relaxations can be done with high probability using a linearnumber operations in total:

Lemma 17 SP-C* performs all target bucket searches in totalO(n+m) time whp.

Proof: LetXi be the weight of thei-th edge inG. Let r(X) denote an upper bound on the totaltime for all target bucket searches by assuming for each source node a worst-case position inthe bucket hierarchy as presented in Lemma 5. We haveE[r℄ = O(E[m+℄ +m) = O(n +m)since the expected time for a single target bucket search with worst-case source node positionisO(1).

LetR be the proposition that the statements of Lemma 12, Lemma 14,and Lemma 15 hold(this happens whp). Otherwise there are at mostO(m � n) relaxations each of which takesO(logn) time. Hence,E[r jR℄ � E[r℄ + o(n+m) = O(n+m).

In the best case an edge does not have to be relaxed at all. On the other hand by Lemma 12and propositionR, each edge can be relaxed at mostO(logn= log logn) times per level, thusaltogetherO(log2 n) times, and each relaxation takes at mostO(logn) operations. By thedefinition of r(X) the changes of node placements induced by a modification ofei will notaffect r(X) for edgesej 6= ei. Thus, modifyingXi will changer(X) by at mostO(log3 n),givenR. We apply Azuma’s inequality and getP[r(X) > E[rjR℄ + n jR℄ � e� nO(log6 n) :Finally, usingE[r jR℄ � E[r℄ + o(n+m) = O(n+m) we obtainP[r(X) > O(n+m)℄ � n� for any positive constant > 1.

Now we are ready to state the final result for SP-C*. CombiningLemmas 14 to 17 immediatelyyields:

Theorem 5 SSSP on arbitrary directed graphs with random edge weights which are indepen-dent and uniformly drawn from[0; 1℄ can be solved inO(n+m) time with high probability.

5 Extensions

In this section we sketch a few extensions: we consider a larger class of random edge weights,show ways to improve the worst-case performance and investigate a simple parallelization.

5.1 Other Edge Weight Distributions

The uniform distribution used in the previous sections is just a special case of the followingmuch more general class: let us consider independent randomvalues in[0; 1℄ having a commondistribution functionF with the properties thatF (0) = 0 and thatF 0(0) > 0 exists. Theseproperties ofF imply that the distribution in the neighborhood of0 can be approximated by auniform distribution. Hence, our key property – long paths of small total weight are unlikely –is still valid. Lemma 9 can be restated [12] as follows:

21

There are constants� � 1, � � 1 such that the probability thatP is a�-path for� � � isbounded by(� ��)l=l!. Shrinking all bucket widths of SP-C and SP-C* by the constant factor�=�, the average number of re-insertions and re-relaxations still remains linear. The sameholds true for the bounds on redistributions and target bucket searches. Therefore, incurringsome constant factor loss, both the label-setting and the label-correcting version achieve lineartime average-case complexity on the extended edge weight class, too.

5.2 Worst-Case Performance

In the following we describe an alternative for the simple bottom-up search in order to find targetbuckets in worst-case constant time. Using this guided search routine improves the total worst-case time for SP-S and SP-C (or SP-C*) without automatic fall-back to Dijkstra’s algorithm toO(minfn2; n �mg) andO(n �m), respectively.

Lemma 18 The target bucket search for an edge relaxation can be performed in worst-caseconstant time.

Proof: For the relaxation of an edgee = (u; v) whereu is in the current bucketBcur = Bi,j withbucket width�i of top-levelLi we have to find the highest levelLr, r � i, that can contain theun-split target bucket forv. We distinguish two cases: (e) � �i-1 and (e) > �i-1.

Firstly, if (e) � �i-1 (recall that�i-1 is the total level width ofLi) then the target bucketof v is either located inLi, hencer = i, or it is the immediate successor bucket~Bi of therightmost bucket inLi. Note that~Bi is located in some level belowLi and has width at least�i-1. Upon creation of the new top-levelLi, a pointer to~Bi can be maintained as follows: ifLiis a refinement of a bucketBi-1,j which is not the rightmost bucket inLi�1, then ~Bi = Bi-1,j+1,otherwise~Bi = ~Bi-1. See Figure 6 for an example.

L

L

L

L

empty split unvisited

3

2

1

0

Figure 6: Example for pointers to the immediate successor buckets.

Secondly, consider the case (e) > �i-1 where the target bucket is definitely located in alevel belowLi. Let xe = blog2 1= (e) . For each levelLk, k � 1, we maintain an additionalarraySk[�℄ with log2 1=�k�1 entries: Si[xe℄ = r < i denotes the highest levelLr possiblycontaining the target bucket ofv for a relaxation ofe = (u; v) with u 2 Bcur = Bi,j . As before,if v does not belong toLr, then it will fit into the immediate successor bucket~Br of Lr. Thecorrectness follows inductively from the construction:S1[�℄ is an empty array.Si[�℄, i � 2, can be easily created fromSi�1[�℄: the highest possiblelevel for a target bucket of an edgee = (u; v) with (e) � �i-2 will be in a levelLr belowLi�1

22

independent of the position ofu in Li�1. Again, this is an immediate consequence of the factthat the total width ofLi�1 is given by�i-2 � (e). The proper search levelLr can be identifiedin O(1) time by looking upSi�1[blog2 1= (e) ℄ = r. AsLi is just a refinement of some bucketfrom Li�1 and because for (e) > �i-2 all targets are located in a level belowLi�1 we haveSi[k℄ = Si�1[k℄ for 0 � k < log2 1=�i�2. Hence, these entries can simply be copied fromSi�1[�℄ to Si[�℄.

New entries are needed forSi[log2 1=�i-2℄, : : :, Si[log2 1=�i-1 � 1℄, accounting for edgeweights�i-1 � (e) < �i-2. These weights are too large for a target withinLi (which hastotal level width�i-1) but the target may be located inLi�1, thereforeSi[log2 1=�i-2℄ = i � 1,: : :, Si[log2 1=�i-1 � 1℄ = i � 1. On the other hand, if the target does not lie inLi�1 then thetarget bucket is definitely given by the immediate successorbucket ofLi�1, ~Bi-1, because~Bi-1

has width at least�i-2 > (e).Hence, all required lookups in the additional data structures for a relaxation ofe can be done

in constant time. For SP-C and SP-C*, the costs to buildSi[�℄ and the pointer to~Bcur can becharged on the degree of the nodev that caused the creation ofLi by a bucket split. For SP-S*the costs are charged on the number of nodes in the split bucket.

As already mentioned in Section 2.4 for SP-S, both the label-correcting and the label-settingversion can keep track of the actual resource usage and startthe computation from scratch withDijkstra’s algorithm after�(n�logn+m) operations, thus limiting the worst-case total executiontime toO(n logn+m).5.3 Parallelization

In the following we sketch the result of a simple parallelization for SP-C and SP-C* on the par-allel random access machine (PRAM) [22, 34]. This is one of the most widely studied abstractmodels of a parallel computer. A PRAM consists ofp independent processors (processingunits, PUs) and a shared memory, which these processors can synchronously access in unittime. We assume thearbitrary CRCW (concurrent read concurrent write) PRAM, i.e., in caseof conflicting write accesses to the same memory cell, an adversary can choose which accessis successful. A fast and efficient parallel algorithm minimizes bothtimeandwork (product oftime and number of processors). Ideally, the work bound matches the complexity of the best(known) sequential algorithm.

5.3.1 Previous Work on Parallel SSSP

So far, there is no parallelO(n � logn+m) work PRAM SSSP algorithm with sublinear runningtime for arbitrary digraphs with non-negative edge weights. TheO(n � logn+m) work solutionby Driscoll et. al. [18] (refining a result of Paige and Kruskal [45]) has running timeO(n�logn).An O(n) time algorithm requiringO(m � log n) work was presented by Brodal et. al. [6]. Thesealgorithms settle the nodes one by one in the order of Dijkstra’s algorithm and only performedge relaxations in parallel. All known faster algorithms require more work, some are tuned forspecial graph classes, see for example [6, 8, 11, 25, 30, 37, 36, 50, 54].

Parallel SSSP onrandom graphs[5, 20] has been considered by several authors [10, 13,25, 28, 41, 42, 49]. Under the assumption of independent random edge weights uniformlydistributed in the interval[0; 1℄, the fastest work-efficient label-correcting approach [41, 42]

23

requiresO(log2 n) time and linear work on average; furthermore,O(d � L � logn+ log2 n) timeandO(n+m+d �L � logn) work on average is achieved for arbitrary graphs with randomedgeweights whered denotes the maximum node degree in the graph andL denotes the maximumweight of a shortest path to a node reachable froms, i.e.,L = maxv2G;dist(v)<1 dist(v). Thealgorithm fails if the productd � L is large.

5.3.2 Improved Results for Moderate Diameter and Maximum Node Degree

Similar to the algorithm of [42] each phase of SP-C and SP-C* can be parallelized by con-currently removing the nodes from the current bucket and relaxing their outgoing edges withseveral PUs in parallel.

Theorem 6 Assuming independent random edge weights uniformly distributed in[0; 1℄, paral-lel SSSP on a CRCW PRAM for graphs with maximum shortest path weightL can be solved inaverage-case timeT = O0�mini 8<:2i � L+ Xv2G;degree(v)>2i degree(v)9=; � polylogn1A (5)

usingO(n+m + T ) work.

Let us first demonstrate the improvement over [42] with an example: consider a graphG withE[L℄ = �(pn) where all nodes have degree at most = O(1) with the exception of one nodethat has degreed = �(pn), hencem = O(n). The algorithm of [42] requires(d � L) =(n) average-case time, i.e., no speedup can be obtained, whereas our new approach needsO(pn � polylogn) time on average using linear work (the minimum in (5) is obtained fori = dlog2 e). Hence, the existence of a few high-degree nodes will not necessarily slow downthe whole computation since those nodes do not impose aglobally fixed small step width (asopposed to the�-stepping of [41, 42]).

We sketch the proof for the parallel time bound (5): Our parallelization mainly follows theconcepts presented in [41, 42]. However, we do not spread each bucket overp local buckets (onefor each PU) but implement each bucket by a single array with dynamic space adjustment. Con-current access to the arrays is realized by semi-sorting of the requests as in [42], the processorsare scheduled using standard prefix-sum computations. A phase can be performed in polyloga-rithmic time. As each of the paths followed by the algorithm in a non-split bucket consists of atmostO(logn= log logn) edges whp (Lemma 12), each bucket of the hierarchy is emptiedduringat mostO(logn= log logn) phases whp. Then the algorithm steps forward to the next nonemptybucket and stops after encountering an empty bucket ofL0. For maximum shortest path weightL it visits at most

Pij=0 2j�L = O(2i�L) buckets in charge of nodes with degree at most2i. Eachnodev with degree(v) > 2i can create at mostO(degree(v)) extra buckets ifv causes a bucketsplit. Therefore, altogether there are at mostx = O(minif2i �L+Pv2G;degree(v)>2i degree(v)g)buckets to be visited. Hence, there are at mostO(x � logn= log logn) phases whp, and each ofthem can be performed in polylogarithmic time.

24

6 Constructing Difficult Inputs with Random Edge Weights

In this section we demonstrate that random edge weights do not automatically result in goodalgorithmic performance.

Deterministic worst-case inputs for label-correcting algorithms are usually based on theprinciple that paths with few edges are found first but longerpaths have smaller total weightsand hence lead to improvements on the tentative distances. Each such improvement triggersre-insertions which eventually make the computation expensive.

Figure 7 provides an example for the Bellman–Ford algorithm[4, 21] with a FIFO queue:the shortest path betweens andq follows the node sequencea, b, . The algorithm improvestent(q) for each node on this path, re-insertsq and re-relaxes the outgoing edges ofq. Ingeneral, let the path froms to q consist of�(n) nodes and letq have out-degree�(n). Then theBellman–Ford algorithm requires�(n2) time on this graph class withm = O(n) edges.

s q1111

357

a b c

Figure 7: Bad input graph for the Bellman–Ford algorithm.

For random edge weights it is unlikely that a given long path has a small path weight, com-pare Lemma 9; the expected path weight is linear in the numberof edges. In fact, if we replacethe fixed edge weights in the above graph class by random edge weights then the expected num-ber of re-insertions forq is constant and therefore the expected time for Bellman-Ford is linearin that case.

6.1 Emulating Fixed Edge Weights

Our main idea for the construction of difficult graphs with random edge weights is to emulatesingle edgesei with fixed weight bywhole subgraphsSi with random edge weights. EachSicontains exactly one sourcesi and one sinkti. Furthermore, the subgraphs are pairwise edge-disjoint and can only share sources and sinks. EachSi is built by a chain ofl = (logn)so-called(u; v; k)-gadgets. An (u; v; k)-gadget consists ofk+2 nodesu, v,w1; : : : ; wk and the2 � k edges(u; wi) and(wi; v). The parameterk is called theblow-up factorof a gadget. Asbefore, we will assume that random edge weights are independent and uniformly drawn from[0; 1℄.Lemma 19 The expected shortest path weight betweenu andv in a (u; v; 1)-gadget is1, in a(u; v; 2)-gadget it is23=30.

Proof: Fork = 1, there is only oneu-v path in the(u; v; 1)-gadget and its expected total weightis clearly2 � 1=2 = 1.

For k = 2, let X1 andX2 be the random variables which denote the weight of the pathshu; w1; vi and hu; w2; vi, respectively. The density function forXi is given byf(x) = x, if0 � x � 1, andf(x) = 2�x, 1 < x � 2. The distribution function for the shortest path weight

25

in a (u; v; 2)-gadget is W (z) = 1� �1� Z z0 f(x) dx�2 :The expected value of the shortest path is calculated via thederivative ofW (z) as

R 20 x �w(x) dx = 23=30.

The largest fixed edge weight is emulated by a chain ofl gadgets each of which has blow-upfactor one. Shorter fixed weights are emulated by choosing higher blow-up factors for some orall of the l gadgets in their respective subgraphs. If we take the parameter l large enough thenthe actual shortest path weights inSi will just slightly deviate from their expected values withhigh probability. In case the gradations between these expected values are much higher than thedeviations then the emulated behavior will be as desired.

6.2 Example for Bellman–Ford

Now we provide a concrete conversion example for the Bellman-Ford algorithm with a FIFOqueue. As a basis we use the input class of Figure 7. The fixed weight edges entering thenodeq are replaced byr = �(n1=3��) subgraphsSi, each of which consists of a chain withl = �(n2=3+�) gadgets for some arbitrary constant0 < � < 1=3. More specifically,Si includes(i �n1=3+�) (�; �; 2)-gadgets, the remaining gadgets have blow-up factor one. Figure 8 shows theprinciple.

s qS

S0

r−1

Figure 8: Modified bad input graph with random edge weights.

The shortest pathPi from s to q via Si has expected total weightE[wi℄ = l � i � 7=30 � n1=3+� +O(n1=3��):Using Chernoff bounds [38] it turns out that eachwi deviates from its expected value by at mostO(n1=3+�=2 � logn) = o(n1=3+�) whp.

Hence,w0 > w1 > : : : > wr�1 whp. On the other hand the number of edges on the pathsPiincreases ini. Consequently, the nodeq is re-insertedr times whp. Ifq has out-degree�(n)this means Bellman-Ford requires non-linear�(n4=3��) operations on these inputs whp.

26

Lemma 20 There are input graphs withn nodes andm = O(n) edges and random edgeweights such that the Bellman-Ford algorithm with a FIFO queue requires�(n4=3��) opera-tions whp for any constant0 < � < 1=3.

The above input class also yields poor performance on other SSSP label-correcting ap-proaches like Pallottino’s algorithm [46] which has worst-case execution timeO(n2 � m) butperforms very well on many practical inputs [9, 55]. Pallottino’s algorithm maintains two FIFOqueuesQ1 andQ2. The next node to be removed is taken from the head ofQ1 if this queue isnot empty and from the head ofQ2 otherwise. A node with improved distance value is addedto the tail ofQ1 if it had been queued before, or to the tail ofQ2 otherwise.

Due to the structure of our graph class the only nodes which can ever appear in queueQ1are the nodeq and its immediate successors nodes. Similar to the Bellman-Ford algorithmthe FIFO queues in Pallottino’s algorithm enforce thatq is reached via pathsPi in order ofincreasingi. Sincew0 > w1 > : : : > wr�1 whp, Pallottino’s algorithm frequently putsq intoQ1 and thus relaxes the�(n) outgoing edges ofq before the computation carries on. Altogetherthe algorithm incurs�(n4=3��) operations whp.

Conclusions

We have presented SSSP algorithms which require linear timewhp on arbitrary directed graphswith random edge weights. To the best of our knowledge these are the first algorithms whichprovably achieve this time bound. Worst-case time�(n logn + m) can still be guaranteedby monitoring the actual time usage and switching back to Dijkstra’s algorithm if required.The proofs for the label-setting version turned out to be significantly easier, especially for thehigh probability bound. However, the label-correcting scheme also supports parallelization.Furthermore, we have shown how to construct difficult non-deterministic input graphs for manytraditional label-correcting algorithms.

Acknowledgements

The author would like to thank Torben Hagerup and Volker Priebe for valuable discussions andcomments. After reading a preliminary version of this paperfor the label-correcting approach,Torben Hagerup also suggested to examine a label-setting variant that splits the current bucketaccording to the number of nodes instead of node degrees.

References

[1] R. K. Ahuja, T. L. Magnanti, and J. B. Orlin.Network flows : Theory, Algorithms and Applications.Prentice Hall, Englewood Cliffs, NJ, 1993.

[2] K. B. Athreya. Large deviation rates for branching processes- I, single type case.Annals of AppliedProbability, 4(3):779–790, 1994.

[3] K. B. Athreya and P. Ney.Branching Processes. Springer, 1972.

[4] R. Bellman. On a routing problem.Quart. Appl. Math., 16:87–90, 1958.

27

[5] B. Bollobas.Random Graphs. Academic Press, 1985.

[6] G. S. Brodal, J. L. Traff, and C. D. Zaroliagis. A parallel priority queue with constant time opera-tions. Journal of Parallel and Distributed Computing, 49(1):4–21, 1998.

[7] A. Brodnik, S. Carlson, J. Karlsson, and J. I. Munro. Worst case constant time priority queues. InProc. 12th Annual Symposium on Discrete Algorithms, pages 523–528. ACM–SIAM, 2001.

[8] S. Chaudhuri and C. D. Zaroliagis. Shortest paths in digraphs of small treewidth. Part II : Optimalparallel algorithms.Theoretical Computer Science, 203(2):205–223, 1998.

[9] B. V. Cherkassky, A. V. Goldberg, and T. Radzik. Shortestpath algorithms: Theory and experi-mental evaluation.Math. Programming, 73:129–174, 1996.

[10] A. Clementi, J. Rolim, and E. Urland. Randomized parallel algorithms. InSolving CombinatorialProblems in Parallel, volume 1054 ofLNCS, pages 25–50, 1996.

[11] E. Cohen. Using selective path-doubling for parallel shortest-path computations.Journal of Algo-rithms, 22(1):30–56, January 1997.

[12] C. Cooper, A. Frieze, K. Mehlhorn, and V. Priebe. Average-case complexity of shortest-pathsproblems in the vertex-potential model.Random Structures & Algorithms, 16:33–46, 2000.

[13] A. Crauser, K. Mehlhorn, U. Meyer, and P. Sanders. A parallelization of Dijkstra’s shortest pathalgorithm. In23rd Symp. on Mathematical Foundations of Computer Science, volume 1450 ofLNCS, pages 722–731. Springer, 1998.

[14] E. V. Denardo and B. L. Fox. Shortest route methods: 1. reaching pruning and buckets.OperationsResearch, 27:161–186, 1979.

[15] R. B. Dial. Algorithm 360: Shortest-path forest with topological ordering.Communications of theACM, 12(11):632–633, 1969.

[16] E. W. Dijkstra. A note on two problems in connexion with graphs.Num. Math., 1:269–271, 1959.

[17] E. A. Dinic. Economical algorithms for finding shortestpaths in a network. InTransportationModeling Systems, pages 36–44, 1978.

[18] J. R. Driscoll, H. N. Gabow, R. Shrairman, and R. E. Tarjan. Relaxed heaps: An alternative tofibonacci heaps with applications to parallel computation.Communications of the ACM, 31, 1988.

[19] D. P. Dubhashi and A. Panconesi. Concentration of measure for the analysis of randomized algo-rithms. Draft Manuscript,http://www.brics.dk/˜ale/papers.html , October 1998.

[20] P. Erdos and A. Renyi. On the evolution of random graphs. Publ. Math. Inst. Hungar. Acad. Sci.,5(A):17–61, 1960.

[21] L. R. Ford and D. R. Fulkerson.Flows in Networks. Princeton Univ. Press, Princeton, NJ, 1963.

[22] S. Fortune and J. Wyllie. Parallelism in random access memories. InProc. 10th Symp. on theTheory of Computing, pages 114–118. ACM, 1978.

[23] M. L. Fredman and R. E. Tarjan. Fibonacci heaps and theiruses in improved network optimizationalgorithms.Journal of the ACM, 34:596–615, 1987.

28

[24] A. M. Frieze and G. R. Grimmett. The shortest-path problem for graphs with random arc-lengths.Discrete Applied Mathematics, 10:57–77, 1985.

[25] A. M. Frieze and L. Rudolph. A parallel algorithm for all-pairs shortest paths in a random graph.In Proc. 22nd Allerton Conference on Communication, Control and Computing, pages 663–670,1985.

[26] A. V. Goldberg. A simple shortest path algorithm with linear average time. Technical report STAR-TR-01-03, InterTrust Technologies Corporation, Santa Clara, CA, 2001.

[27] A. V. Goldberg and R. E. Tarjan. Expected performance ofDijkstra’s shortest path algorithm.Technical Report TR-96-062, NEC Research, 1996.

[28] Q. P. Gu and T. Takaoka. A sharper analysis of a parallel algorithm for the all pairs shortest pathproblem.Parallel Computing, 16(1):61–67, 1990.

[29] T. Hagerup. Improved shortest paths on the word RAM. In27th Colloquium on Automata, Lan-guages and Programming (ICALP), volume 1853 ofLNCS, pages 61–72. Springer, 2000.

[30] Y. Han, V. Pan, and J. Reif. Efficient parallel algorithms for computing all pair shortest paths indirected graphs.Algorithmica, 17(4):399–415, 1997.

[31] T. Harris. The Theory of Branching Processes. Springer, 1963.

[32] R. Hassin and E. Zemel. On shortest paths in graphs with random weights.Math. Oper. Res.,10(4):557–564, 1985.

[33] W. Hoeffding. Probability inequalities for sums of bounded random variables.Journal of theAmerican Statistical Association, 58:13–30, 1964.

[34] J. Jaja.An Introduction to Parallel Algorithms. Addison-Wesley, Reading, 1992.

[35] R. M. Karp and Y. Zhang. Bounded branching process and AND/OR tree evaluation.RandomStructures & Algorithms, 7(2):97–116, 1995.

[36] P. Klein and S. Subramanian. A randomized parallel algorithm for single-source shortest paths.Journal of Algorithms, 25(2):205–220, November 1997.

[37] P. N. Klein and S. Subramanian. A linear-processor polylog-time algorithm for shortest paths inplanar graphs. InProc. 34th Annual Symposium on Foundations of Comptuer Science, pages 259–270. IEEE, 1993.

[38] C. McDiarmid. Concentration. In Michel Habib, Colin McDiarmid, Jorge Ramirez-Alfonsin, andBruce Reed, editors,Probabilistic Methods for Algorithmic Discrete Mathematics, volume 16 ofAlgorithms Combin., pages 195–248. Springer, 1998.

[39] K. Mehlhorn and V. Priebe. On the all-pairs shortest-path algorithm of Moffat and Takaoka.Ran-dom Structures & Algorithms, 10:205–220, 1997.

[40] U. Meyer. Single-source shortest-paths on arbitrary directed graphs in linear average-case time. InProc. 12th Annual Symposium on Discrete Algorithms, pages 797–806. ACM–SIAM, 2001.

[41] U. Meyer and P. Sanders.�-stepping: A parallel shortest path algorithm. In6th European Sympo-sium on Algorithms (ESA), volume 1461 ofLNCS, pages 393–404. Springer, 1998.

29

[42] U. Meyer and P. Sanders. Parallel shortest path for arbitrary graphs. InProc. Euro-Par 2000Parallel Processing, volume 1900 ofLNCS, pages 461–470. Springer, 2000.

[43] A. Moffat and T. Takaoka. An all pairs shortest path algorithm with expected timeO(n2 log n).SIAM Journal on Computing, 16:1023–1031, 1987.

[44] K. Noshita. A theorem on the expected complexity of Dijkstra’s shortest path algorithm.Journalof Algorithms, 6:400–408, 1985.

[45] R. C. Paige and C. P. Kruskal. Parallel algorithms for shortest path problems. InInternationalConference on Parallel Processing, pages 14–20. IEEE Computer Society Press, 1985.

[46] S. Pallottino. Shortest-path methods: Complexity, interrelations and new propositions.Networks,14:257–267, 1984.

[47] R. Raman. Priority queues: Small, monotone and trans-dichotomous. In4th Annual EuropeanSymposium on Algorithms (ESA), volume 1136 ofLNCS, pages 121–137. Springer, 1996.

[48] R. Raman. Recent results on the single-source shortestpaths problem. ACM SIGACT News,28(2):81–87, June 1997.

[49] J. Reif and P. Spirakis. Expected parallel time and sequential space complexity of graph and digraphproblems.Algorithmica, 7:597–630, 1992.

[50] H. Shi and T. H. Spencer. Time–work tradeoffs of the single-source shortest paths problem.Journalof Algorithms, 30(1):19–32, 1999.

[51] P. M. Spira. A new algorithm for finding all shortest paths in a graph of positive arcs in averagetimeO(n2 log2 n). SIAM Journal on Computing, 2:28–32, 1973.

[52] M. Thorup. Undirected single-source shortest paths with positive integer weights in linear time.Journal of the ACM, 46:362–394, 1999.

[53] M. Thorup. On RAM priority queues.SIAM Journal on Computing, 30:86–109, 2000.

[54] J. L. Traff and C. D. Zaroliagis. A simple parallel algorithm for the single-source shortest pathproblem on planar digraphs.Journal of Parallel and Distributed Computing, 60(9):1103–1124,2000.

[55] F. B. Zhan and C. E. Noon. Shortest path algorithms: An evaluation using real road networks.Transportation Science, 32:65–73, 1998.

30

������ kI N F O R M A T I K

Below you find a list of the most recent technical reports of the Max-Planck-Institut fur Informatik. They areavailable by anonymous ftp fromftp.mpi-sb.mpg.de under the directorypub/papers/reports . Mostof the reports are also accessible via WWW using the URLhttp://www.mpi-sb.mpg.de . If you have anyquestions concerning ftp or WWW access, please [email protected] . Paper copies (which arenot necessarily free of charge) can be ordered either by regular mail or by e-mail at the address below.

Max-Planck-Institut fur InformatikLibraryattn. Anja BeckerStuhlsatzenhausweg 8566123 SaarbruckenGERMANYe-mail: [email protected]

MPI-I-2001-4-003 K. Daubert, W. Heidrich, J. Kautz, J. Dischler,H. Seidel

Efficient Light Transport Using Precomputed Visibility

MPI-I-2001-4-002 H.P.A. Lensch, J. Kautz, M. Goesele, H. Seidel A Framework for the Acquisition, Processing, Transmission, andInteractive Display of High Quality 3D Models on the Web

MPI-I-2001-4-001 H.P.A. Lensch, J. Kautz, M.G. Goesele,W. Heidrich, H. Seidel

Image-Based Reconstruction of Spatially Varying Materials

MPI-I-2001-2-002 P. Maier A Set-Theoretic Framework for Assume-Guarantee Reasoning

MPI-I-2001-2-001 U. Waldmann Superposition and Chaining for Totally Ordered DivisibleAbelian Groups

MPI-I-2001-1-002 U. Meyer Directed Single-Source Shortest-Paths in Linear Average-CaseTime

MPI-I-2001-1-001 P. Krysta Approximating Minimum Size 1,2-Connected Networks

MPI-I-2000-4-003 S.W. Choi, H. Seidel Hyperbolic Hausdorff Distance for Medial Axis Transform

MPI-I-2000-4-002 L.P. Kobbelt, S. Bischoff, K. Kahler,R. Schneider, M. Botsch, C. Rossl, J. Vorsatz

Geometric Modeling Based on Polygonal Meshes

MPI-I-2000-4-001 J. Kautz, W. Heidrich, K. Daubert Bump MapShadows for OpenGL Rendering

MPI-I-2000-2-001 F. Eisenbrand Short Vectors of Planar Lattices Via Continued Fractions

MPI-I-2000-1-005 M. Seel, K. Mehlhorn Infimaximal Frames A Technique for Making Lines Look LikeSegments

MPI-I-2000-1-004 K. Mehlhorn, S. Schirra Generalized and improved constructive separation bound for realalgebraic expressions

MPI-I-2000-1-003 P. Fatourou Low-Contention Depth-First Scheduling of ParallelComputations with Synchronization Variables

MPI-I-2000-1-002 R. Beier, J. Sibeyn A Powerful Heuristic for Telephone Gossiping

MPI-I-2000-1-001 E. Althaus, O. Kohlbacher, H. Lenhof, P. Muller A branch and cut algorithm for the optimal solution oftheside-chain placement problem

MPI-I-1999-4-001 J. Haber, H. Seidel A Framework for Evaluating the Quality of Lossy ImageCompression

MPI-I-1999-3-005 T.A. Henzinger, J. Raskin, P. Schobbens Axioms for Real-Time Logics

MPI-I-1999-3-004 J. Raskin, P. Schobbens Proving a conjecture of Andreka on temporal logic

MPI-I-1999-3-003 T.A. Henzinger, J. Raskin, P. Schobbens Fully Decidable Logics, Automata and Classical Theories forDefining Regular Real-Time Languages

MPI-I-1999-3-002 J. Raskin, P. Schobbens The Logic of EventClocks

MPI-I-1999-3-001 S. Vorobyov New Lower Bounds for the Expressiveness and the Higher-OrderMatching Problem in the Simply Typed Lambda Calculus

MPI-I-1999-2-008 A. Bockmayr, F. Eisenbrand Cutting Planes and the Elementary Closure in Fixed Dimension

MPI-I-1999-2-007 G. Delzanno, J. Raskin Symbolic Representation of Upward-closed Sets

MPI-I-1999-2-006 A. Nonnengart A Deductive Model CheckingApproach for Hybrid Systems

MPI-I-1999-2-005 J. Wu Symmetries in Logic Programs

MPI-I-1999-2-004 V. Cortier, H. Ganzinger, F. Jacquemard,M. Veanes

Decidable fragments of simultaneous rigid reachability

MPI-I-1999-2-003 U. Waldmann Cancellative SuperpositionDecides the Theory of DivisibleTorsion-Free Abelian Groups

MPI-I-1999-2-001 W. Charatonik Automata on DAG Representations of Finite Trees

MPI-I-1999-1-007 C. Burnikel, K. Mehlhorn, M. Seel A simpleway to recognize a correct Voronoi diagram of linesegments

MPI-I-1999-1-006 M. Nissen Integration of Graph Iterators into LEDA

MPI-I-1999-1-005 J.F. Sibeyn Ultimate Parallel List Ranking ?

MPI-I-1999-1-004 M. Nissen, K. Weihe How generic language extensions enable “open-world” desing inJava

MPI-I-1999-1-003 P. Sanders, S. Egner, J. Korst Fast Concurrent Access to Parallel Disks

MPI-I-1999-1-002 N.P. Boghossian, O. Kohlbacher, H.-. Lenhof BALL: Biochemical Algorithms Library

MPI-I-1999-1-001 A. Crauser, P. Ferragina A Theoretical and Experimental Study on the Construction ofSuffix Arrays in External Memory

MPI-I-98-2-018 F. Eisenbrand A Note on the Membership Problem for the First ElementaryClosure of a Polyhedron

MPI-I-98-2-017 M. Tzakova, P. Blackburn Hybridizing Concept Languages

MPI-I-98-2-014 Y. Gurevich, M. Veanes Partisan Corroboration, and Shifted Pairing

MPI-I-98-2-013 H. Ganzinger, F. Jacquemard, M. Veanes Rigid Reachability

MPI-I-98-2-012 G. Delzanno, A. Podelski Model Checking Infinite-state Systems in CLP

MPI-I-98-2-011 A. Degtyarev, A. Voronkov Equality Reasoning in Sequent-Based Calculi

MPI-I-98-2-010 S. Ramangalahy Strategies for ConformanceTesting

MPI-I-98-2-009 S. Vorobyov The Undecidability of the First-Order Theories of One StepRewriting in Linear Canonical Systems

MPI-I-98-2-008 S. Vorobyov AE-Equational theory of context unification is Co-RE-Hard

MPI-I-98-2-007 S. Vorobyov The Most Nonelementary Theory (A Direct Lower Bound Proof)

MPI-I-98-2-006 P. Blackburn, M. Tzakova Hybrid Languages and Temporal Logic

MPI-I-98-2-005 M. Veanes The Relation Between Second-Order Unification andSimultaneous RigidE-Unification

MPI-I-98-2-004 S. Vorobyov Satisfiability of Functional+Record Subtype Constraints isNP-Hard

MPI-I-98-2-003 R.A. Schmidt E-Unification for Subsystems of S4

MPI-I-98-2-002 F. Jacquemard, C. Meyer, C. Weidenbach Unification in Extensions of Shallow Equational Theories

MPI-I-98-1-031 G.W. Klau, P. Mutzel Optimal Compaction of Orthogonal Grid Drawings

MPI-I-98-1-030 H. Bronniman, L. Kettner, S. Schirra,R. Veltkamp

Applications of the Generic Programming Paradigm in theDesign of CGAL

MPI-I-98-1-029 P. Mutzel, R. Weiskircher Optimizing Over All Combinatorial Embeddings of a PlanarGraph

MPI-I-98-1-028 A. Crauser, K. Mehlhorn, E. Althaus, K. Brengel,T. Buchheit, J. Keller, H. Krone, O. Lambert,R. Schulte, S. Thiel, M. Westphal, R. Wirth

On the performance of LEDA-SM