• 沒有找到結果。

Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time

N/A
N/A
Protected

Academic year: 2022

Share "Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time"

Copied!
84
0
0

加載中.... (立即查看全文)

全文

(1)

Undirected Single-Source Shortest Paths with Positive Integer Weights in Linear Time

MIKKEL THORUP 1999 Journal of ACM

(2)

Presenters

• 資工四 陳代樾

• 資工四 張愈敏

• 資工四 胡升鴻

• 資工四 呂哲安

• 資工四 陳縕儂

• 資工四 黃鈞愷

(3)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(4)

Introduction(1)

• Mikkel Thorup

– http://www.diku.dk/~mthorup/

(5)

Introduction(2)

Single Sorce Shortest Path Problem (SSSP)

• Given a positively weighted graph G with a source vertex s, find the shortest path from s to all other vertices in the graph

(6)

Introduction(3)

• Since 1959, all developments in SSSP have been based on Dijkstra’s algorithm O(n2 + m)

• Our target is toward linear time and linear space algorithm.

• The algorithm avoids the sorting bottleneck by building a hierarchical bucketing structure,

identifying vertex pairs that may be visited in any order.

(7)

b

4 1

7

4 1

2

1 1

1

4 4

3 a

c d e

f

g h i

4

min

7

0

7 9

4

min

min

min

min

Initial

5 7

5 7

8

8

min

8 8

9

8

min min

8

Introduction(4)

Non-Decreasing Order

119

(8)

Introduction(5)

• 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)

(9)

Introduction(6)

• For each vertex we have We have a set such that

and

(10)

Introduction(7)

In fact, Dijkstra’s algorithm can be implemented in linear time  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

(11)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(12)

Preliminary(1)

• Lemma 1.

If v ∈ V\S minimize D(v) , D(v) = d(v) Proof: D(v) ≥ d(v) ≥ d(u) = D(u) ≥ D(v)

• Lemma 2.

– min D(V\S) = min d(V\S) is non-decreasing

(13)

Preliminary(2)

• Notation:

x >> i : x / 2i

If x y => x >> i y >> i

If W ⊆ V , min D(W) >> i : (min{ D(w) | w ∈ W }) >> i

(14)

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 O(1).

(15)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(16)

Avoiding the Sorting Bottleneck(1)

• Dijkstra’s algorithm

– visit the vertices in order of increasing D(v) – Sorting bottleneck

• New approach

– visit the vertices where D(v) = d(v) , but possibly D(v) > min D(V\S)

– Using bucket to maintain

(17)

Avoiding the Sorting Bottleneck(2)

Lemma 3.

Suppose the vertex set V divides into disjoint subsets V1, … , Vk and all edges between the subsets have length at least δ.

Further suppose for some i, v ∈ Vi\S that D(v)=min D(Vi\S) min D(V\S)+δ.≦

Then d(v)=D(v).

(18)

Avoiding the Sorting Bottleneck(3)

• For some i, v ∈ Vi\S, D(v) = min D(Vi\S)

min D(V\S) + δ

i=3, δ =1

• Then, d(v) = D(v)

4 1

7

4 1

2

1 1

1

4 4

3

V1 V2 V3

4

0 1

7

δ

(19)

Avoiding the Sorting Bottleneck(4)

• 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) >> α≦

(20)

Avoiding the Sorting Bottleneck(5)

• Bucket number: ∆+2 【 Δ = Σe l(e) >> α 】

• bucket each i ∈ {1, . . . , k} according to min D(Vi\S) >> α.

• i belongs in bucket B(min D(Vi\S) >> α)

• Index: min D(Vi\S) >> α

• Content: i : 1,2,…,k

• Ix: smallest index of a nonempty bucket

0 1 2 3 4 index

content

Δ+ 2

j i

ix

(21)

Avoiding the Sorting Bottleneck(6)

• suppose ix is maintained as the smallest index of a nonempty bucket

• If i B(ix) and v Vi\S minimizes D(v),

then D(v) = min D(Vi\S) min D(V\S) +δ , so D(v) = d(v) by Lemma 3,

and hence v can be visited

0 1 2 3 4 index

content

Δ+ 2

j i

ix

(22)

Avoiding the Sorting Bottleneck(7)

4 1

7

4 1

2

1 1

1 4 4

3

V1 V2 V3

4

1 0

7

δ

0 1 4 5 6

7

1 2

3 ix

δ = 20 , α = 0

B(min D(Vi\S) >> α) = i

min D(V\S) = min d(V\S) is nondecreasing

5 3

(23)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(24)

Component Hierarchy(1)

Introduction

• 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

4 1

7

4 1

2

1 1

1

4 4

3

G G

01

v

[v]1

G

2

v [v]2

w [w]1

G

3

=G

(25)

Component Hierarchy(2)

Introduction

• [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

(26)

Component Hierarchy(3)

• Dijkstra’s algorithm

visit v, if v ∈ V\S minimizes D(v)

• For all i , min D([v]i-) >> i = min D([v]i+1-) >> i = D(v) >> i

 [v]0 minimal

• min D(v) = d(v)  [v]0 minimal

• D(v) = d(v)  [v]0 minimal

(27)

Component Hierarchy(4)

• Lemma 5.

If v S ,[v] i is minimal, and i ≤ j ≤ w, min D([v]i-) >> j-1 = min D([v]j-) >> j-1 .

if j = i  trivial

if j > i, min D([v]i-) >> j - 1 = min D([v]j-1-) >> j - 1 = min D([v]j-) >> j - 1 .

(28)

Component Hierarchy(5)

• 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.

• Lemma 6.

Suppose v S and there is a shortest path to v where the first vertex u outside S is in [v]i .

Then d(v) ≥ min D([v]i-) .

• Lemma 7.

Suppose v S and [v] i+1 is minimal. If there is no shortest path to v where the first vertex outside S is in [v]i . Then d(v) >> i >

min D([v]i+1-) >> i .

(29)

Component Hierarchy(6)

• Lemma 6.

Suppose v S and there is a shortest path to v where the first vertex u outside S is in [v]i .

Then d(v) ≥ min D([v]i-) .

u is th first vertex outside S  D(u) ≤ d(v) u [v] i-  d(v) ≥ D(u) ≥ min D([v]i-)

(30)

Component Hierarchy(7)

• Lemma 7.

Suppose v S and [v] i+1 is minimal. If there is no shortest path to v where the first vertex outside S is in [v]i . Then d(v) >> i >

min D([v]i+1-) >> i .

If u [v] i+1, d(v) >> i + 1 > min D([v]i+2-) >> i + 1 = min D([v]i+1-) >> i+1 (induction)

 d(v) >> i > min D([v]i+1-) >> i

If u [v] i+1, D(u) >> i ≥ min D([v]i+1-) >> i but u [v] i, dist(u , v) ≥ 2i.

d(v) >> i = (D(u)+ dist(u , v)) >> i ≥ min D([v]i+1-) >> i + 1

(31)

Component Hierarchy(8)

• 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.

D(w) ≥ d(w) for all w  min D([v]i-) ≥ min d([v]i-) v is an arbitrary vertex in [v]i,

show that d(v) ≥ min D([v]i-) If u [v] i  Lemma 6

If u [v] i  Lemma 7 d(v) i > min D([v]i+1-) i . = min D([v]i-) i

(32)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(33)

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

 By lemma 5

D(w) >> i – 1 = min D([w]0-) >> i – 1 = min D([w]i-) >> i – 1

 By lemma 8

D(w) = d(w) and min D([w]i-) = min d([w]i-)

 d(w) >> i – 1 = min d([v]i-) >> i – 1

(34)

Visiting Minimal Vertices (2)

• Lemma 11.

min D([v]i-) >> i = min d([v]i-) >> i, visiting w ∈ V\S changes min D([v]i-) >> i

 w ∈ [v]i- , and the change in min D([v]i-) >> i is increased by one

min D([v]i-) = min d([v]i-) is nondecreasing

(35)

Visiting Minimal Vertices (3)

• Lemma 12.

– If [v]i is minimal, it remains minimal until min D([v]i-) >> i is increased.

(min d([v]i-) >> i is increased)

• min D([v]i-) >> i = min D([v]i+1-) >> i

• j is the smallest number such that [v]j+1 is minimal (j ≥ i)

〈 e 〉 b and 〈 e 〉 a denote the expression e should be evaluated before or after the event of visiting some vertex

〈 min d([v]i-) >> ja

≥ 〈 min d([v]j-) >> j a (j ≥ i)

> 〈 min D([v]j+1-) >> ja (Lemma 9)

≥ 〈 min D([v]j+1-) >> j b (nondecreasing)

= 〈 min D([v]i-) >> jb ([v]i is minimal)

= 〈 min d([v]i-) >> jb ([v]i is minimal)

(36)

Visiting Minimal Vertices (4)

• Lemma 13.

– If [v]i has once been minimal, in all future, min D([v]i-) >> i = min d([v]i-) >> i.

• First time [v]i turns minimal (by lemma 8)

• Visiting some vertex w

• [v]i is minimal (by lemma 8)

• [v]i is nonminimal (lemma 11, 12, D(v) ≥ d(v))

• [v]i- is emptied (both D and d -> ∞)

(37)

Visiting Minimal Vertices (5)

A recursive call for Visit([v]i) where [v]i is minimal

(38)

Visiting Minimal Vertices (6)

• Visit([g]3)

• min D([h]2-) >> 2

= min D([g]3-) >> 2

• Visit([h]2)

• min D([h]1-) >> 1

= min D([h]2-) >> 1

• Visit([h]1)

• min D([h]0-) >> 0

= min D([h]1-) >> 0

• Visit([h]0)

4 2

4 4

2 1

a b

c

1

e 1

d

1 f

h

s

1 i

0

4 7

4 g

7

(39)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(40)

Towards Linear Time (1)

• Component Tree

 Number of nodes ≤ 2n-1

4 1

7

4 1

2

1 1

1

4 4

2

a b

c d e

f

g h i

c d e f h i a b g

l(e) < 21

l(e) < 22

l(e) < 23

(41)

Towards Linear Time (2)

• Linear-Sized Bucket Structure

for all children [w]h of [v]i,

bucket [w]h in B([v]i, min D([w]h-) >> i - 1)

• ix0([v]i) = min D([v]i) >> i – 1 = min d([v]i) >> i – 1 ix([v]i) = ix0([v]i) + ∆([v]i)

≥ max d([v]i) >> i – 1

[v]i

ix([v]i)

=min D([v]i) >> i -1

ix0 ix index

content

∑ l(e)/ 2i-1

(42)

Towards Linear Time (3)

• Lemma 18.

The total number of relevant bucket is < 4m + 4n

(43)

Towards Linear Time (4)

(44)

Towards Linear Time (4)

Visit([v]i, j)

(45)

Towards Linear Time (4)

Visit(v) Visit([v]i, j)

(46)

Towards Linear Time (4)

Visit([v]i, j)

(47)

Towards Linear Time (4)

Expand([v]i)

Ix0 ix

[v]i

Min D([v]i) >> i - 1 ix0([v]i) +

∆([v]i)

(48)

Towards Linear Time (4)

Visit([v]i, j)

(49)

Towards Linear Time (4)

• Source: g

• S ← {g}

• Visit([g]3)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

Ix0

4 >> 2 = 1

ix

1 + 8 = 9

[g]3

∆([g]3) = 33 >> 2 = 8

(50)

Towards Linear Time (4)

• Source: g

• S ← {g}

• Visit([g]3)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

4

0

Ф Ф Ф Ф Ф Ф

Ix0 4 >> 2 = 1

... ix

1 + 8 = 9

[g]3

∆([g]3) = 33 >> 2 = 8

(51)

Towards Linear Time (4)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

4

0

Ф Ф Ф Ф Ф

Ix0 4 >> 2 = 1

... ix

1 + 8 = 9

[g]3

[c]2

[a]1

[g]0

[c]Ф2 [a]1

(52)

• ix([g]3) ← 1

• Visit([a]1, 3)

Towards Linear Time (4)

Ф Ф Ф Ф Ф

Ix0 4 >> 2 = 1

... ix

1 + 8 = 9

[g]3 [a]1 [c]2

(53)

Towards Linear Time (4)

• Visit([a]1, 3)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

Ix0

7 >> 0 = 7

ix

7 + 1 = 8

[a]1

∆([a]1) = 1 >> 0 = 1

[a]0 [b]0

(54)

Towards Linear Time (4)

• ix([a]1) ← 7

• Visit([a]0, 1)

• Visit(a)

Ix0

7 >> 0 = 7

ix

7 + 1 = 8

[a]1

∆([a]1) = 1 >> 0 = 1

[a]0 [b]0

(55)

Towards Linear Time (4)

• Visit(a)

• S ← S U {a} = {g, a}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

7

0 4

c d e f h i a b g

8

11

Ix0

7 >> 0 = 7

ix

7 + 1 = 8

[a]1

∆([a]1) = 1 >> 0 = 1

[a]0 [b]0

(56)

Towards Linear Time (4)

• ix([a]1) ← ix([a]1) + 1 (7  8) ix([a]1) >> 3 – 1 (1  2)

• [a]1 ≠ Ф

• Visit([c]2, 3)

Ф Ф Ф Ф

ix0

4 >> 2 = 1 2 ... ix

1 + 8 = 9

[g]3 [c]2 [a]1

Ix0 7 >> 0 = 7

ix 7 + 1 = 8

[a]1 [b]0

Stop while()!

(57)

Towards Linear Time (4)

• Visit([c]2, 3)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11

8

ix0

4 >> 1 = 2

5 ix

2 + 4 = 6

[c]2

∆([c]2) = 9 >> 1 = 4

[h]1 [c]1

(58)

Towards Linear Time (4)

• ix([c]2) ← 2

• Visit([h]1, 2)

Ф Ф Ф Ф

ix0 4 >> 1 = 2

5 ix

2 + 4 = 6

[c]2 [h]1 [c]1

(59)

Towards Linear Time (4)

• Visit([h]1, 2)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11

8

ix0

4 >> 0 = 4

ix

4 + 1 = 5

[h]1

∆([c]2) = 1 >> 0 = 1

[h]0 [i]0

(60)

Towards Linear Time (4)

• ix([h]1) ← 4

• Visit([h]0, 1)

• Visit(h)

ix0 4 >> 0 = 4

ix 4 + 1 = 5

[h]1 [h]0 [i]0

(61)

Towards Linear Time (4)

• Visit(h)

• S ← S U {h} = {g, a, h}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11

8

5 7

Ф Ф

ix0

4 >> 1 = 2 3 4 5 ix

2 + 4 = 6

[c]2 [c]1

ix0 4 >> 0 = 4

ix 4 + 1 = 5

[h]1 [h]0 [i]0

[c]1

(62)

Towards Linear Time (4)

• ix([h]1) ← ix([h]1) + 1 (4  5)

• Ix([h]1) >> 2 – 1 (2  2)

• Visit([i]0, 1)

• Visit(i)

ix0 4 >> 0 = 4

ix 4 + 1 = 5

[h]1 [i]0

(63)

Towards Linear Time (4)

• Visit(i)

• S ← S U {i} = {g, a, h, i}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11

8

5 7

ix0 4 >> 0 = 4

ix 4 + 1 = 5

[h]1 [i]0

(64)

Towards Linear Time (4)

• [h]1- = Ф, [h]1 is not the root of T

• ix([c]2) ← ix([c]2) + 1 (2  3) Ix([c]2) >> 3 – 2 (1  1)

• Visit([c]1, 2)

Ф Ф Ф

ix0

4 >> 1 = 2 3 4 5 ix

2 + 4 = 6

[c]2 [h]1 [c]1

(65)

Towards Linear Time (4)

• Visit([c]1, 2)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11

8

5 7

ix0

7 >> 0 = 7

ix

7 + 3 = 10

[c]1

∆([c]1) = 3 >> 0 = 3

[e]0

[f]0 [d]0 [c]0

(66)

Towards Linear Time (4)

• ix([c]1) ← 7

• Visit([f]0, 1)

• Visit(f)

ix0

7 >> 0 = 7

ix

7 + 3 = 10

[c]1 [f]0 [e]0 [d]0 [c]0

(67)

Towards Linear Time (4)

• Visit(f)

• S ← S U {f} = {g, a, h, i, f}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11

8

5 7

ix0

7 >> 0 = 7 8 9 ix

7 + 3 = 10

[c]1 [f]0 [e]0 [d]0 [c]0

8 8

(68)

Towards Linear Time (4)

• ix([c]1) ← ix([c]1) + 1 (7  8) Ix([c]1) >> 2 – 1 (3  4)

• [c]1- ≠ Ф

• ix([c]2) ← ix([c]2) + 1 (3  4) Ix([c]2) >> 3 – 2 (1  2)

• [c]2- ≠ Ф

Ф Ф

ix0

4 >> 1 = 2 3 4 5 ix

2 + 4 = 6

[c]2 [c]1

Ф Ф Ф

ix0

4 >> 2 = 1 2 ix

1 + 8 = 9

[g]3 [c]2 [a]1

(69)

Towards Linear Time (4)

• Visit([c]2, 3)

• Visit([c]1, 2)

• Visit([e]0, 1)

• Visit(e)

Ф Ф Ф

ix0

4 >> 2 = 1 2 ... ix

1 + 8 = 9

[g]3 [c]2

Ф Ф Ф

ix0

4 >> 1 = 2 3 4 5 ix

2 + 4 = 6

[c]2 [c]1

ix0

7 >> 0 = 7 8 9 ix

7 + 3 = 10

[c]1 [e]0[d]0 [c]0

[a]1

(70)

Towards Linear Time (4)

• Visit(e)

• S ← S U {e} = {g, a, h, i, f, e}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

11 8

8

5 7

8 10

ix0

7 >> 0 = 7 8 9 ix

7 + 3 = 10

[c]1 [e]0[d]0 [c]0 • Visit([d]0, 1)

• Visit(d)

(71)

Towards Linear Time (4)

• Visit(d)

• S ← S U {d} = {g, a, h, i, f, e, d}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

8

8

5 7

8 10

ix0

7 >> 0 = 7 8 9 ix

7 + 3 = 10

[c]1 [d]0 [c]0

9

(72)

Towards Linear Time (4)

• ix([c]1) ← ix([c]1) + 1 (8  9) Ix([c]1) >> 2 – 1 (4  4)

• Visit([c]0, 1)

• Visit(c)

ix0

7 >> 0 = 7 8 9 ix

7 + 3 = 10

[c]1 [c]0

(73)

Towards Linear Time (4)

• Visit(c)

• S ← S U {c}

= {g, a, h, i, f, e, d, c}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

8

8

5 7

8

ix0

7 >> 0 = 7 8 9 ix

7 + 3 = 10

[c]1 [c]0

9

(74)

Towards Linear Time (4)

• Visit([a]1, 3)

• Visit([b]0, 1)

• Visit(b)

Ф Ф Ф

ix0

4 >> 1 = 2 3 4 5 ix

2 + 4 = 6

[c]2 [c]1

Ф Ф Ф

ix0

4 >> 2 = 1 2 ... ix

1 + 8 = 9

[g]3 [c]2[a]1

Ix0 7 >> 0 = 7

ix 7 + 1 = 8

[a]1 [b]0

(75)

Towards Linear Time (4)

• Visit(b)

• S ← S U {b}

= {g, a, h, i, f, e, d, c, b}

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

7

0 4

8

8

5 7

8 9

Ix0 7 >> 0 = 7

ix 7 + 1 = 8

[a]1 [b]0

(76)

Towards Linear Time (4)

• Finish!!!!

Ф Ф Ф

ix0

4 >> 2 = 1 2 ... ix

1 + 8 = 9

[g]3 [a]1

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

7

0 4

8

8

5 7

8 9

(77)

Total: O(n + m)

Total: O(n+

m)

Total: O(n)

Total: O(n + m)

Towards Linear Time (5)

(78)

Outline

• Introduction

• Preliminary

• Avoiding the Sorting Bottleneck

• The Component Hierarchy

• Visiting Minimal Vertices

• Towards Linear Time

• The Component Tree

(79)

The Component Tree(1)

Notations:

First step: construct a minimum spanning tree M

- From the paper of Fredman and Willard [1994]

- Can be done deterministically in linear time

) ] ([

) ] ([

) ( )

(

] ] [

[

i M

i v

v e e

v diameter v

diameter e

e

Mi i

}) 2 )

(

| {

, ( ]

[ [v]i

i M

i

i

e M

e V v

G

Ο

loglog2 x2 x

(80)

The Component Tree(2)

• Redefine Δ as

• Note that M has only n-1 edges

• Reduce algorithm D 、 E from Ο(m) to Ο(n)

(81)

The Component Tree(3)

• We can process a tree in linear time and space

– From the paper of Gabow and Tarjan [1985]

– Support union-find operations at constant cost

• Find(v) returns the canonical vertex

• Let e1, …, en-1 be the edges of M sorted

according to by packed merging

- From the paper of Alberts and Hagerup 1997; Andersson et al. 1995

)) (

( ei msb 

)) (

( ))

(

( ei msb ei1

msb

(82)

The Component Tree(4)

Roughly, Algorithm G is:

• Sequentially, for i = 1, … , n-1 , call union(ei)

• If msb(l(ei)) < msb(l(ei+1)) ,

collect all the new component of S

• s(v) = sum of the weight of the edges X : old canonical elements

(83)

The Component Tree(5)

4 1

7

4 1

2

1 1

1

4 4

3

a b

c d e

f

g h i

c d e f h i a b g

1 2

nodes of

number  n

0 )

( ) (

v

v v

c

X c

v s

, 0

0 )

(

s v

find s

u v union

 ))

( (

) ,

(

) , ( ))

( (

)) (

(

)}

( ),

( {

u v u

find s

v find s

s

u find v

find X

X

 

1

} s

, { dc X

No!

? )) (

( ))

(

( eimsb ei1

msb  

2

}, ,

,

{

c d f s

X {c,d,e, f }, s 3

X

! Yes!

? )) (

( ))

(

( e

i

msb e

i1

msb  

} , , , , , , ,

{a b c d e f h i X

} , ,

' {a c h

X

(84)

Thanks for your listening! 

參考文獻

相關文件

Which keywords below shall have large positive weights in a good perceptron for the task. 1 coffee, tea,

Which keywords below shall have large positive weights in a good perceptron for the task.. 1 coffee, tea,

Here, a deterministic linear time and linear space algorithm is presented for the undirected single source shortest paths problem with positive integer weights.. The algorithm

Sometimes called integer linear programming (ILP), in which the objective function and the constraints (other than the integer constraints) are linear.. Note that integer programming

More precisely, it is the problem of partitioning a positive integer m into n positive integers such that any of the numbers is less than the sum of the remaining n − 1

Since we use the Fourier transform in time to reduce our inverse source problem to identification of the initial data in the time-dependent Maxwell equations by data on the

In Paper I, we presented a comprehensive analysis that took into account the extended source surface brightness distribution, interacting galaxy lenses, and the presence of dust

Given an undirected graph with nonnegative edge lengths and nonnegative vertex weights, the routing requirement of a pair of vertices is assumed to be the product of their weights.