mikkel thorup 1999 journal of the acm undirected single-source shortest paths with positive integer...
TRANSCRIPT
![Page 1: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/1.jpg)
MIKKEL THORUP1999 Journal of the ACM
Undirected Single-Source Shortest Paths with Positive
Integer Weights in Linear Time
![Page 2: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/2.jpg)
Presenters
資訊四 巨彥霖 資訊四 羅婉嫣 資訊四 許恒瑞
![Page 3: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/3.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 4: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/4.jpg)
Introduction(1)
Mikkel Thorup http://www.diku.dk/~mthorup/
![Page 5: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/5.jpg)
Introduction(2)
Given a positively weighted graph G with a source vertex s,
find the shortest path from s to all other vertices in the graph
ingleS ource hortest ath
problem
S PSS
Shortest path
Shortest path
Shortest path
![Page 6: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/6.jpg)
Introduction(3)History
Since 1959, all developments in SSSP have been based on Dijkstra’s algorithm (1959)
![Page 7: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/7.jpg)
Dijkstra’s algorithm(1)
Notation: G = (V, E)
| v | = n , | E | = m weighted function l : edge positive integer
If (v, w) E , define l(v, w) = ∞ d(v) : distance from s to v D(v) : super distance
D(v) d(v)≧
D(v) : super distance
a set S V
v S : D(v) = d(v)
v S : D(v) = min { d(u) + l(u, v) }
∞
13
80
20
53
d(v) 10
D(v)
v can go to S
v can go to S
u S
![Page 8: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/8.jpg)
Dijkstra’s algorithm(2)
V = {0
v1 v2 v3 v4 v5 v6 v7
S = {
v8}
}4
∞
∞
∞
∞
∞
5
min
4 7
6
6
min
5
7
6
6
77
70
v1 v4v3v2 v7v5 v6 v8
Initially
v1
v5
v3
v6
v2
v8v7
v4
v1v2
v7v4
v8v3
v5
v6
Increasing order
visit
![Page 9: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/9.jpg)
Introduction(3)History
)log( nnmO
Dijkstra’s algorithm
(1959)
Simple : Applying William’s heap :
(1964)
Fredman & Tarjan Fibonacci heaps :
(1987)
Fredman & Willard’s fusion trees :
(1993)O(m)
our target !!
)log( nmO
)( 2 mnO )log( nmO )loglog/log( nnnmO
)log(1
nnmO )logloglog( nnnmO Fredman & Willard’s atmoic heaps :
(1994)
Thorup’s priority queue :
(1996)
Raman :
(1996)
![Page 10: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/10.jpg)
Introduction(4)
In fact, Dijkstra’s algorithm can be implemented in linear time
( [Fredman & Tarjan 1987] , [Thorup 1996] )linear time sorting
Since we do not know how to sort in linear time, this implies that we are deviating from Dijkstra’s algorithm in that we do not visit the vertices in order of increasing distance from s.
Our algorithm is based on a hierarchical bucketing structure.
may visit the vertices in any order
![Page 11: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/11.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 12: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/12.jpg)
Preliminary(1)
Lemma 1 If v S\V minimize D(v) , D(v) = d(v)
Lemma 2 minD(V\S) = mind(V\s) is non-decreasing
![Page 13: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/13.jpg)
Preliminary(2)
Notation: x >> i
is [ x / 2 ] If x y => x >> i y >> i≦ ≦
If W V , minD(W) >> i is (min{ D(w) | w W }) >> i
i
![Page 14: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/14.jpg)
Preliminary(3) Bucket
which elements can be inserted and deleted,and from which we can pick out an unspecified element.
each operation should be supported in constant time.
![Page 15: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/15.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 16: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/16.jpg)
Avoiding the Sorting Bottleneck(1)
Dijkstra’s algorithm visit the vertices in order of increasing D(v)
New approach visit the vertices where D(v) = d(v) D(v) min D(V\S)≧
![Page 17: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/17.jpg)
Avoiding the Sorting Bottleneck(2)
0
∞
∞ ∞
5 ∞
∞4
V3V2V1
δ
For some i, v Vi\S,
D(v) = min D(Vi\S) min D(V\S) + δ≦
d(v) = D(v)
![Page 18: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/18.jpg)
0 1 2 3 4 index
content…
…
Avoiding the Sorting Bottleneck(3)
Criteria on D(v) = d(v) D(v) = min D(Vi\S) ≦ min D(V\S) + δ
<= min D(Vi\S) ≦ min D(V\S) + 2α
<= min D(Vi\S) >> α ≦ min D(V\S) >> α
Bucketing structure
i
min D(Vi\S) >> αix
j
D(v) ≦ Σe l(e)
Δ = Σe l(e) >> αΔ+ 2
∞
![Page 19: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/19.jpg)
Avoiding the Sorting Bottleneck(4)
SSSP algorithm A
0
∞
∞ ∞
∞ ∞
∞∞
V3V2V1
δ
δ = 20 , α = 04
5 0 1 2 3 4
……5 ∞
12 3
ix
B(min D(Vi\S) >> α) = i4
6
7
26 7
min D(V\S) = min d(V\S) is nondecreasing
5
![Page 20: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/20.jpg)
Avoiding the Sorting Bottleneck(5)
SSSP algorithm A
O(m + Δ) + cost of maintaining min D(Vi\S) for each i
Δ = Σe l(e) >> α
δ = 2α
![Page 21: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/21.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 22: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/22.jpg)
The Component Hierarchy(1)
Definition Gi: the subgraph of
G with l(e) < 2i
[v]i: the connected component on level i containing v
children of [v]i: [w]i-1, w [v]i
GoG1G2G3 = G
v
[v]1
v[v]2
w
[w]1
![Page 23: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/23.jpg)
The Component Hierarchy(2)
Definition [v]i is a min-child of [v]i+1
if min D([v]i-) >> i = min D([v]i+1
-) >> i
[v]i is minimal if [v]j is a min-child of [v]j+1 for j = i, …, b-1
[v]2
[v]1
v
![Page 24: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/24.jpg)
The Component Hierarchy(3)
Dijkstra’s algorithm
visit v, if v V\S minimizes D(v)
i, min D([v]i-) >> i = D([v]i+1
-) >> i = D(v) >> i => [v]0 minimal
minimal D(v) = d(v) [v]0 minimal
D(v) = d(v) [v]0 minimal
![Page 25: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/25.jpg)
The Component Hierarchy(4)
lemma 8
If v S and [v]i is minimal, min D([v]i-) = min d([v]i
-). In particular, D(v) = d(v) if [v]0 = {v} is minimal.
![Page 26: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/26.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 27: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/27.jpg)
Visiting Minimal Vertices(1)
Definition visiting a vertex requires that [v]0 = {v} is minimal when v is visited, v is moved to S and relax
Lemma 10 For all [v]i,
max d([v]i\[v]i-) >> i-1 ≦ min d([v]i
-) >> i-1
Lemma 11 min D([v]i
-) >> i = min d([v]i-) >> i, visiting w changes
min D([v]i-) >> i, and the change in min D([v]i
-) >> i is increased by one
![Page 28: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/28.jpg)
Visiting Minimal Vertices(2)
Lemma 12, 13 If [v]i has once been minimal, in all future,
min D([v]i-) >> i = min d([v]i
-) >> i
![Page 29: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/29.jpg)
Visiting Minimal Vertices(3)
SSSP algorithm B,C
[s]3 = G, i = 3
0
∞ ∞
∞5
4
∞
∞d(w) >> i = min D([s]i
-) >> i
min D([w]i-1-) >> i - 1
= min D([s]i-) >> i - 1
Visit([s]i)
Visit([w]i-1)
[s]2, i = 2
s
[s]1, i = 1[s]0, i = 0
4
[w]i minimal
![Page 30: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/30.jpg)
Visiting Minimal Vertices(4)
Towards Linear Time !!
![Page 31: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/31.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 32: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/32.jpg)
Towards Linear Time(1)
Component tree
22)( e
a b c d e f
1 2
3 a b c
d e
f
1 1
12 3
3 212)( e
12 nNumber of nodes
![Page 33: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/33.jpg)
Towards Linear Time(2)
Linear size bucket structure
)1)(min,(in bucket
of children allfor
iwDvBw
vw
hih
ih
0 1 2 3 4 index
content…
…i
ix
j
Δ = Σe l(e) >> αΔ+ 2
∞
1)]([min)]([ ivDvix ii
1)]([max)]([
1)]([min)]([0
ivdvix
ivdvix
ii
ii
ix0 index
content…
… ix∞
![Page 34: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/34.jpg)
Towards Linear Time(3)
Lemma 18. The total number of relevant buckets is < 4m + 4n
Diameter of [v]I is bounded by
=>
Define
=>
ivee
][)(
iveii evdvd][
)()]([min)]([max
)]([)]([)]([ 0 iii vvixvix
1
][2/)()]([
i
veiiev
![Page 35: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/35.jpg)
ii vev
ien][,][
12/)(4
Towards Linear Time(4)
Lemma 18. The total number of relevant buckets is < 4m + 4n
Ee ev
i
i
en][
12/)(4
Ee ev
ij
i
n][
12/24
mnnEe
4444
42
2
2
2
2
22/2
111
j
j
j
j
j
j
ji
ij
1
][2/)()]([
i
veiiev
i ii v ve
i
vi ev
][ ][
1
][
2/)(2)]([1 12 is in node# n
1)(log2 ej
![Page 36: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/36.jpg)
Towards Linear Time(5)
![Page 37: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/37.jpg)
Towards Linear Time(6)
O(m)
![Page 38: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/38.jpg)
Towards Linear Time(7)
![Page 39: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/39.jpg)
Towards Linear Time(8)
1)]([min ivD i )]([)]([0 ii vvix
ix0 index
content…
… ix∞
0 0 0 0 0 0
O(m)
![Page 40: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/40.jpg)
Towards Linear Time(9)
Total: O(m)
Total: O(m)
Total: O(n)
Total: O(m)
![Page 41: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/41.jpg)
Towards Linear Time(10)
Assume that the component tree has been computed in linear time. Then no more than O(m) time and space is needed to solve the SSSP problem
How to construct the component tree ?
![Page 42: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/42.jpg)
Outline
Introduction Preliminary Avoiding the Sorting Bottleneck The Component Hierarchy Visiting Minimal Vertices Towards Linear Time The Component Tree
![Page 43: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/43.jpg)
The Component Tree(1)
ii levelon 2 weight of edges all
xxmsb 2log)(
elinear timin treespanning minimum aconstruct M
})2)(|{,(][
[v]i
iMi
i
eMeVv
G
)]([)]([)()(][][
iMi
veve
vdiametervdiametereeMii
![Page 44: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/44.jpg)
The Component Tree(2)
Use union-find operation
Let e1, …, en-1 be the edges of M sorted according to
))(( iemsb
))(())(( 1 ii emsbemsb
![Page 45: MIKKEL THORUP 1999 Journal of the ACM Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time](https://reader033.vdocuments.net/reader033/viewer/2022051415/56649d6e5503460f94a4f574/html5/thumbnails/45.jpg)
The Component Tree(3)0)(
0)(
v
vc
Xc
vs
,0
0)(
4 3
2
1 1 4
1
22
5
1
v1 v2 v3
v4
v7
v5 v6
v8
v1 v2 v3 v4 v5 v6 v7 v8
1s},{ 54 vvX
),())(())((
)}(),({
uvufindsvfindss
ufindvfindXX
svfinds
uvunion
))((
),(
v4,v5
No! ?))(())(( 1 ii emsbemsb
2 },,,{ 654 svvvX
,v6 v7,v8
},,,,{ 87654 vvvvvX
!Yes! ?))(())(( 1 ii emsbemsb
},{ 74' vvX
v4,v5,v6,v7,v8v3,v2,
v1,v2,v3,v4,v5,v6,v7,v8
12 nodes ofnumber n