k Shortest Paths - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

k Shortest Paths

Description:

Path representation (heaps galore) Complexities of Eppstein. The problem ... Search Complexities. Finding k shortest paths from t to s. cost: O(m n log n k) ... – PowerPoint PPT presentation

Number of Views:698
Avg rating:3.0/5.0
Slides: 16
Provided by: pier220
Category:

less

Transcript and Presenter's Notes

Title: k Shortest Paths


1
k Shortest Paths
  • Pierre Fransson

2
Outline
  • Focus on data structures
  • The Problem
  • Notation
  • Path representation (heaps galore)
  • Complexities of Eppstein

3
The problem
  • Find k shortest paths S1, S2, S3, ..., Sk from
    vertex s to vertex t
  • S1 is shortest path from s to t .

w0
w4
v0
v2
w1
t
4
Notation
  • A path p(u, v) uniquely represented by shortest
    path from u to v and sidetracks(p).
  • sidetracks(p) are all edges in G T
  • If e(u, v) then
  • head(e) v
  • tail(e) u

5
Notation cont.
  • l(u, v) cost of edge (u, v)
  • d(s, t) shortest path distance from u to v
  • Cost of detour
  • d(u, v) l(u, v) d(v, t) - d(u, t)
  • Heaps
  • Hout(v), HT(v), HG(v), D(G), P(G)

6
Path Representation (Hout(v))
w0
w4
v0
v2
w1
t
v1
w2
w3
7
Calculating Hout(v)
Hout(t)
Hout(v0)
Hout(v1)
Hout(v2)
outroot(v2)
outroot(v1)
outroot(v0)
t-w1
v0-v1
v1-v2
v2-v0
outroot(t)
d5
d2
d2
d2
t-w4
v0-v2
d2
d5
t-w4
v0-w2
v0-w3
d5
d3
Hout(w1)
Hout(w0)
Hout(w3)
Hout(w4)
w0-v2
w3-w2
outroot(w0)
outroot(w1)
outroot(w3)
outroot(w4)
d2
d3
Hout(w2)
w0-w1
v3-w4
d3
d3
outroot(w2)
d3
w0-w4
8
Calculating HG(v)
HG(v1)
HG(t)
HG(v2)
HG(v0)
h(v1)
v1-v2
d2
h(v2)
v2-v0
d2
t-w1
h(t)
h(v0)
v0-v1
d2
d5
t-w4
t-w1
h(t)
v0-v2
d2
d5
t-w1
h(t)
d5
d5
t-w1
h(t)
d5
t-w4
t-w4
t-w4
v0-w2
v0-w3
d3
d5
d5
d5
t-w4
d5
t-w4
d5
t-w4
d5
t-w4
d5
9
Calculating HG(v)
HG(w0)
HG(w3)
h(v1)
v1-v2
d2
h(v0)
v0-v1
d2
w0-v2
h(w0)
d2
w3-w2
h(w3)
d3
t-w1
h(t)
v0-v2
d2
d5
t-w1
h(t)
d5
t-w4
w0-w1
d3
t-w4
v3-w4
d3
v0-w2
v0-w3
d3
d5
d5
d3
t-w4
d5
w0-w4
t-w4
d5
HG(w1)
HG(w4)
HG(w2)
h(w1)
h(w2)
h(w4)
10
Calculating HG(v)
HG(w1)
HG(w4)
HG(w2)
h(w4)
h(w1)
h(w2)
t-w1
h(t)
h(v2)
v1-v2
v2-v0
d2
h(v0)
h(v1)
d2
d5
t-w1
v0-v1
d2
t-w1
h(t)
d5
h(t)
d5
t-w4
v0-v2
d2
t-w4
t-w4
d5
d5
d5
t-w4
d5
t-w4
v0-w2
v0-w3
d3
t-w4
d5
d5
11
Calculating D(G)
h(w1)
h(w2)
h(w4)
h(v0)
h(v1)
h(v2)
v0-v1
d2
v1-v2
d2
v2-v0
d2
w0-v2
h(w0)
d2
v0-v2
d2
t-w1
h(t)
w3-w2
h(w3)
d3
d5
w0-w1
d3
t-w4
v0-w2
v0-w3
d3
v3-w4
d3
d5
d3
w0-w4
t-w4
d5
12
Calculating P(G)
h(w4)
2
h(w1)
h(w2)
2
5
2
5
5
r(s)
2
h(v0)
h(v2)
d2
d2
h(v1)
v0-v1
d2
v1-v2
v2-v0
0
2
2
2
0
3
3
3
1
0
w0-v2
h(w0)
d2
v0-v2
d2
0
t-w1
h(t)
w3-w2
h(w3)
2
d3
d5
1
1
1
0
0
0
w0-w1
d3
t-w4
v0-w2
v0-w3
d3
v3-w4
0
d5
d3
3
0
0
0
0
d3
w0-w4
t-w4
d5
0
0
13
Building Complexities
  • Building Hout(v) O(m)
  • Building HG(v) O(log n) (without modification)
  • ? O(n log n)
  • Total cost O(m n log n)
  • Total space O(m n log n) ?

14
Search Complexities
  • Finding k shortest paths from t to s
  • cost O(m n log n k)
  • Finding all shortest paths from t to s
  • cost O(m n log n kn)

15
Improving Building Complexities
  • Total cost O(m n k)
  • Total space O(m n k) ?
Write a Comment
User Comments (0)
About PowerShow.com