A central problem in algorithmic graph theory is the shortest path problem. 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 paths from a source vertex
s
Another variation of the problem is the all-pairs-shortest-paths (APSP) problem, which also has parallel approaches: Parallel all-pairs shortest path algorithm.
Let
G=(V,E)
|V|=n
|E|=m
s
c
v
s
s
v
\operatorname{dist}(s,v)
\operatorname{dist}(v)
\operatorname{dist}(u,v):=infty
v
u
Sequential shortest path algorithms commonly apply iterative labeling methods based on maintaining a tentative distance for all nodes;
\operatorname{tent}(v)
infty
s
v
\operatorname{dist}(v)
(v,w)\inE
\operatorname{tent}(w):=min\{\operatorname{tent}(w),\operatorname{tent}(v)+c(v,w)\}
For all parallel algorithms we will assume a PRAM model with concurrent reads and concurrent writes.
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
\Delta
\Delta
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
B[i]
v
B[i]
v
B[i]
B[i]
The maximum shortest path weight for the source node
s
L(s):=max\{\operatorname{dist}(s,v):\operatorname{dist}(s,v)<infty\}
L
We distinguish light edges from heavy edges, where light edges have weight at most
\Delta
\Delta
Following is the delta stepping algorithm in pseudocode: 1 foreach
v\inV
\operatorname{tent}(v):=infty
relax(s,0)
lnotisEmpty(B)
i:=min\{j\geq0:B[j] ≠ \emptyset\}
R:=\emptyset
B[i] ≠ \emptyset
Req:=findRequests(B[i],light)
R:=R\cupB[i]
B[i]:=\emptyset
relaxRequests(Req)
Req:=findRequests(R,heavy)
relaxRequests(Req)
findRequests(V',kind:\{light,heavy\})
\{(w,\operatorname{tent}(v)+c(v,w)):v\inV'\land(v,w)\inEkind\}
relaxRequests(Req)
(w,x)\inReq
relax(w,x)
relax(w,x)
x<\operatorname{tent}(w)
x<\operatorname{tent}(w)
B[\lfloor\operatorname{tent}(w)/\Delta\rfloor]:=B[\lfloor\operatorname{tent}(w)/\Delta\rfloor]\setminus\{w\}
B[\lfloorx/\Delta\rfloor]:=B[\lfloorx/\Delta\rfloor]\cup\{w\}
\operatorname{tent}(w):=x
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
At the beginning of the algorithm, all vertices except for the source vertex A have infinite tentative distances.
Bucket
B[0]
[0,2]
B[1]
[3,5]
B[2]
[6,8]
The bucket
B[0]
B[0]
The vertices B,G and E are inserted into bucket
B[1]
B[0]
B[1]
B[2]
B[1]
B[2]
The algorithm terminates.
As mentioned earlier,
L
Let us call a path with total weight at most
\Delta
\Delta
Let
C\Delta
\langleu,v\rangle
\Delta
(u,...,v)
n\Delta:=|C\Delta|
C\Delta+
\langleu,v',v\rangle
\langleu,v'\rangle\inC\Delta
(v',v)
m\Delta:=|C\Delta+|
The sequential delta-stepping algorithm needs at most
l{O}(n+m+n\Delta+m\Delta+L/\Delta)
l{O}\left( | L |
\Delta |
⋅ d\ell\Deltalogn\right)
If we take
\Delta=\Theta(1/d)
d
[0,1]
l{O}(n+m+dL)
l{O}(d2Llog2n)
The third computational kernel of the Graph 500 benchmark runs a single-source shortest path computation.[2] The reference implementation of the Graph 500 benchmark uses the delta stepping algorithm for this computation.
For the radius stepping algorithm, we must assume that our graph
G
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 → R+
s
i
s
di-1
di
v
di-1<d(s,v)\leqdi
Following is the radius stepping algorithm in pseudocode: Input: A graph
G=(V,E,w)
r( ⋅ )
s
\delta( ⋅ )
s
\delta( ⋅ )\leftarrow+infty
\delta(s)\leftarrow0
v\inN(s)
\delta(v)\leftarroww(s,v)
S0\leftarrow\{s\}
i\leftarrow1
|Si-1|<|V|
di\leftarrow
min | |
v\inV\setminusSi-1 |
\{\delta(v)+r(v)\}
u\inV\setminusSi-1
\delta(u)\leqdi
v\inN(u)\setminusSi-1
\delta(v)\leftarrowmin\{\delta(v),\delta(u)+w(u,v)\}
\delta(v)\leqdi
Si=\{v | \delta(v)\leqdi\}
i=i+1
\delta( ⋅ )
S\subseteqV
N(S)=cupu\in\{v\inV\midd(u,v)\inE\}
In the Radius-Stepping algorithm, a new round distance
di
r(v)
di
i
\delta(v)+r(v)
v
Lines 5-9 then run the Bellman-Ford substeps until all vertices with radius less than
di
di
Si
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
All neighbors of A are relaxed and
S0=\{A\}
d1
S1=\{A,B,E,G\}
d2
S2=\{A,B,C,D,E,G\}
The variable
d3
S3=\{A,B,C,D,E,F,G\}
The algorithm terminates.
After a preprocessing phase, the radius stepping algorithm can solve the SSSP problem in
l{O}(mlogn)
|
nlogpL)
p\leq\sqrt{n}
l{O}(mlogn+np2)
l{O}(p2)
l{O}(mlogn+np2logn)
l{O}(plogp)