HOME

TheInfoList



OR:

A central problem in algorithmic
graph theory In mathematics, graph theory is the study of '' graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of '' vertices'' (also called ''nodes'' or ''points'') which are conn ...
is the
shortest path problem In graph theory, the shortest path problem is the problem of finding a path between two vertices (or nodes) in a graph such that the sum of the weights of its constituent edges is minimized. The problem of finding the shortest path between t ...
. One of the generalizations of the shortest path problem is known as the single-source-shortest-paths (SSSP) problem, which consists of finding the shortest path between every pair of vertices in a graph. There are classical
sequential algorithm In computer science, a sequential algorithm or serial algorithm is an algorithm that is executed sequentially – once through, from start to finish, without other processing executing – as opposed to concurrently or in parallel. The term is pri ...
s which solve this problem, such as
Dijkstra's algorithm Dijkstra's algorithm ( ) is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years ...
. In this article, however, we present two
parallel algorithm In computer science, a parallel algorithm, as opposed to a traditional serial algorithm, is an algorithm which can do multiple operations in a given time. It has been a tradition of computer science to describe serial algorithms in abstract machine ...
s solving this problem. Another variation of the problem is the all-pairs-shortest-paths (APSP) problem, which also has parallel approaches: Parallel all-pairs shortest path algorithm.


Problem definition

Let G=(V,E) be a directed graph with , V, =n nodes and , E, =m edges. Let s be a distinguished vertex (called "source") and c be a function assigning a non-negative real-valued weight to each edge. The goal of the single-source-shortest-paths problem is to compute, for every vertex v reachable from s, the weight of a minimum-weight path from s to v, denoted by \operatorname(s,v) and abbreviated \operatorname(v). The weight of a path is the sum of the weights of its edges. We set \operatorname(u,v):=\infty if v is unreachable from u. Sequential shortest path algorithms commonly apply iterative labeling methods based on maintaining a tentative distance for all nodes; \operatorname(v) is always \infty or the weight of some path from s to v and hence an upper bound on \operatorname(v). Tentative distances are improved by performing edge relaxations, i.e., for an edge (v,w)\in E the algorithm sets \operatorname(w):=\min\. For all parallel algorithms we will assume a
PRAM Pram or PRAM may refer to: a bulbous growth on senior canines, varying in size, usually benign and painless. If it bursts, it will ooze pus and blood. Places * Pram, Austria, a municipality in the district of Grieskirchen in the Austrian state of ...
model with concurrent reads and concurrent writes.


Delta stepping algorithm

The delta stepping algorithm is a label-correcting algorithm, which means the tentative distance of a vertex can be corrected several times via edge relaxations until the last step of the algorithm, when all tentative distances are fixed. The algorithm maintains eligible nodes with tentative distances in an array of buckets each of which represents a distance range of size \Delta. During each phase, the algorithm removes all nodes of the first nonempty bucket and relaxes all outgoing edges of weight at most \Delta. Edges of a higher weight are only relaxed after their respective starting nodes are surely settled. The parameter \Delta is a positive real number that is also called the "step width" or "bucket width". Parallelism is obtained by concurrently removing all nodes of the first nonempty bucket and relaxing their outgoing light edges in a single phase. If a node v has been removed from the current bucket B /math> with non-final distance value then, in some subsequent phase, v will eventually be reinserted into B /math> , and the outgoing light edges of v will be re-relaxed. The remaining heavy edges emanating from all nodes that have been removed from B /math> so far are relaxed once and for all when B /math> finally remains empty. Subsequently, the algorithm searches for the next nonempty bucket and proceeds as described above. The maximum shortest path weight for the source node s is defined as L(s):=\max\, abbreviated L. Also, the size of a path is defined to be the number of edges on the path. We distinguish light edges from heavy edges, where light edges have weight at most \Delta and heavy edges have weight bigger than \Delta . Following is the delta stepping algorithm in pseudocode: 1 foreach v \in V do \operatorname(v):=\infty 2 relax(s, 0); (*Insert source node with distance 0*) 3 while \lnot isEmpty(B) do (*A phase: Some queued nodes left (a)*) 4 i:=\min\ (*Smallest nonempty bucket (b)*) 5 R:=\emptyset (*No nodes deleted for bucket B yet*) 6 while B neq \emptyset do (*New phase (c)*) 7 Req:=findRequests(B light) (*Create requests for light edges (d)*) 8 R:=R\cup B /math> (*Remember deleted nodes (e)*) 9 B =\emptyset (*Current bucket empty*) 10 relaxRequests(Req) (*Do relaxations, nodes may (re)enter B (f)*) 11 Req:=findRequests(R,heavy) (*Create requests for heavy edges (g)*) 12 relaxRequests(Req) (*Relaxations will not refill B (h)*) 13 14 function findRequests(V',kind:\):set of Request 15 return \ 16 17 procedure relaxRequests(Req) 18 foreach (w, x)\in Req do relax(w,x) 19 20 procedure relax(w,x) (*Insert or move w in B if x<\operatorname(w)*) 21 if x < \operatorname(w) then 22 B lfloor \operatorname(w)/\Delta\rfloor=B lfloor \operatorname(w)/\Delta\rfloorsetminus \ (*If in, remove from old bucket*) 23 B lfloor x/\Delta\rfloor=B lfloor x/\Delta\rfloorcup \ (*Insert into new bucket*) 24 \operatorname(w):=x


Example

Following is a step by step description of the algorithm execution for a small example graph. The source vertex is the vertex A and \Delta is equal to 3. At the beginning of the algorithm, all vertices except for the source vertex A have infinite tentative distances. Bucket B /math> has range ,2/math>, bucket B /math> has range ,5/math> and bucket B /math> has range ,8/math>. The bucket B /math> contains the vertex A. All other buckets are empty. The algorithm relaxes all light edges incident to B /math>, which are the edges connecting A to B, G and E. The vertices B,G and E are inserted into bucket B /math>. Since B /math> is still empty, the heavy edge connecting A to D is also relaxed. Now the light edges incident to B /math> are relaxed. The vertex C is inserted into bucket B /math>. Since now B /math> is empty, the heavy edge connecting E to F can be relaxed. On the next step, the bucket B /math> is examined, but doesn't lead to any modifications to the tentative distances. The algorithm terminates.


Runtime

As mentioned earlier, L is the maximum shortest path weight. Let us call a path with total weight at most \Delta and without edge repetitions a \Delta-path. Let C_\Delta denote the set of all node pairs \langle u,v \rangle connected by some \Delta-path (u,\dots, v) and let n_\Delta:=, C_, . Similarly, define C_ as the set of triples \langle u,v',v \rangle such that \langle u,v' \rangle \in C_\Delta and (v',v) is a light edge and let m_\Delta:=, C_, . The sequential delta-stepping algorithm needs at most\mathcal (n+m + n_\Delta + m_\Delta + L/\Delta) operations. A simple parallelization runs in time \mathcal \left(\frac\cdot d\ell_\Delta \log n\right) . If we take \Delta = \Theta(1/d) for graphs with maximum degree d and random edge weights uniformly distributed in ,1/math>, the sequential version of the algorithm needs \mathcal(n+m+dL) total average-case time and a simple parallelization takes on average \mathcal(d^2 L \log^2n).


Graph 500

The third computational kernel of the Graph 500 benchmark runs a single-source shortest path computation. The reference implementation of the Graph 500 benchmark uses the delta stepping algorithm for this computation.


Radius stepping algorithm

For the radius stepping algorithm, we must assume that our graph G is undirected. The input to the algorithm is a weighted, undirected graph, a source vertex, and a target radius value for every vertex, given as a function r : V \rightarrow \mathbb_+. The algorithm visits vertices in increasing distance from the source s. On each step i, the Radius-Stepping increments the radius centered at s from d_ to d_i , and settles all vertices v in the annulus d_. Following is the radius stepping algorithm in pseudocode: Input: A graph G=(V,E,w), vertex radii r(\cdot), and a source node s. Output: The graph distances \delta(\cdot) from s. 1 \delta(\cdot)\leftarrow +\infty, \delta(s)\leftarrow 0 2 foreach v \in N(s) do \delta(v)\leftarrow w(s,v), S_0\leftarrow \, i \leftarrow 1 3 while , S_, <, V, do 4 d_i\leftarrow \min_\ 5 repeat 6 foreach u \in V\setminus S_ s.t \delta(u) \leq d_i do 7 foreach v \in N(u)\setminus S_ do 8 \delta(v) \leftarrow \min\ 9 until no \delta(v)\leq d_i was updated 10 ''S_i=\'' 11 i=i+1 12 return \delta(\cdot) For all S\subseteq V, define N(S)=\bigcup_\ to be the neighbor set of S. During the execution of standard
breadth-first search Breadth-first search (BFS) is an algorithm for searching a tree data structure for a node that satisfies a given property. It starts at the tree root and explores all nodes at the present depth prior to moving on to the nodes at the next d ...
or
Dijkstra's algorithm Dijkstra's algorithm ( ) is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years ...
, the frontier is the neighbor set of all visited vertices. In the Radius-Stepping algorithm, a new round distance d_i is decided on each round with the goal of bounding the number of substeps. The algorithm takes a radius r(v) for each vertex and selects a d_i on step i by taking the minimum \delta(v) + r(v) over all v in the frontier (Line 4). Lines 5-9 then run the Bellman-Ford substeps until all vertices with radius less than d_i are settled. Vertices within d_i are then added to the visited set S_i .


Example

Following is a step by step description of the algorithm execution for a small example graph. The source vertex is the vertex A and the radius of every vertex is equal to 1. At the beginning of the algorithm, all vertices except for the source vertex A have infinite tentative distances, denoted by \delta in the pseudocode. All neighbors of A are relaxed and S_0=\. The variable d_1 is chosen to be equal to 4 and the neighbors of the vertices B, E and G are relaxed. S_1=\ The variable d_2 is chosen to be equal to 6 and no values are changed. S_2=\. The variable d_3 is chosen to be equal to 9 and no values are changed. S_3=\. The algorithm terminates.


Runtime

After a preprocessing phase, the radius stepping algorithm can solve the SSSP problem in \mathcal(m\log n) work and \mathcal(\frac\log n\log pL) depth, for p\leq \sqrt. In addition, the preprocessing phase takes \mathcal(m\log n + np^2) work and \mathcal(p^2) depth, or \mathcal(m\log n + np^2\log n) work and \mathcal(p\log p) depth.


References

{{Reflist Graph algorithms