6.006 Introduction to Algorithms Lecture 13: Dijkstras Algorithm
Lecture 13: Dijkstra's Algorithm. Review. • Single-Source Shortest Paths on weighted graphs. • Previously: O(
Reach for A : an Efficient Point-to-Point Shortest Path Algorithm
MIT 2/17/09 Scanning method and Dijkstra's algorithm. ... Reach-based query algorithm is Dijkstra's algorithm with prun- ing based on reaches.
6.006 Lecture 16: Dijkstra
Dijkstra's Algorithm. Readings. CLRS Sections 24.2-24.3. Review d[v] is the length of the current shortest path from starting vertex s. Through a.
L16 - Dijkstra
5. 4. 2011. Introduction to Algorithms. 6.006. Lecture 16 ... Today: Dijkstra. – O( (V+E)logV ) time ... Dijkstra's algorithm d[s] ? 0.
A Scalable Architecture for Ordered Parallelism
Example: Parallelism in Dijkstra's Algorithm. 4. Finds shortest-path tree on a graph with weighted edges. A. B. C. D. E. 3. 2. 2. 4. 1. 3. 3 source. Page 14
Rubiks Cube
9. 11. 2011. 6.006 Introduction to Algorithms. Recitation 16 ... and on the inner workings of Dijkstra's algorithm. At the time when Dijkstra visits a ...
Lecture 16: Shortest Paths II - Dijkstra
Dijkstra's Algorithm. Readings. CLRS Sections 24.2-24.3. Review d[v] is the length of the current shortest path from starting vertex s. Through a.
Quiz 2 Solutions
13. 4. 2011. Solution: True. Both algorithms are guaranteed to produce the same shortest- path weight but if there are multiple shortest paths
The Knapsack Problem
23. 11. 2011. Let's look at Dijkstra's algorithm for comparison. Dijkstra for Shortest-Paths. Given a graph G with V vertices and E edges
II Link-State Routing Integration Step: Dijkstras Algorithm (Example
15. 11. 2010. shortest path algorithm over its map. • If each node implements computation correctly ... Integration Step: Dijkstra's Algorithm. (Example).
Reach for A?: an Efficient
Point-to-Point Shortest Path Algorithm
Andrew V. Goldberg
Microsoft Research - Silicon Valleywww.research.microsoft.com/≂goldberg/Joint with Haim Kaplan and Renato Werneck
Einstein Quote
Everything should be made as simple as possible, but not simplerReach for A?MIT 2/17/09 1Shortest Paths with Preprocessing
Variants
Nonnegative and arbitrary arc lengths.
Point to point, single source, all pairs.
Directed and undirected.
Here we study
Point to point, nonnegative length, directed problem.Allow preprocessing with limited (linear) space.Many applications, both directly and as a subroutine.Reach for A?MIT 2/17/09 2
Shortest Path Problem
Input:Directed graphG= (V,A), nonnegative length function ?:A→R+, origins?V, destinationt?V.Preprocessing:Limited space to store results.
Query:Find a shortest path fromstot.Interested in exact algorithms that search a (small) subgraph.Related work:reach-based routing
[Gutman 04] , hierarchi- cal decomposition [Schultz, Wagner & Weihe 02] ,[Sanders &Schultes 05, 06]
, geometric pruning [Wagner & Willhalm 03] , arc flags [Lauther 04] ,[K¨ohler, M¨ohring & Schilling 05] ,[M¨ohring et al. 06]Reach for A?MIT 2/17/09 3
Motivating Application
Driving directions
Run on servers and small devices.
Typical production codes≈5 years ago:
◦Use base graph or other heuristics based on road cate-gories; needs hand-tuning. ◦Runs (bidirectional) Dijkstra or A?with Euclidean bounds on "patched" graph. ◦Non-exact and no performance guarantee. We are interested in exact and very efficient algorithms.New results finding their way into products.This talk is not about modeling ... but exact algorithms help.Reach for A?MIT 2/17/09 4
Outline
Scanning method and Dijkstra"s algorithm.
Bidirectional Dijkstra"s algorithm.
A?search.
ALT Algorithm
Definition of reach
Reach-based algorithm
Reach for A?
Demo.
Reach for A?MIT 2/17/09 5
Scanning Method
For each vertexvmaintain its distance labelds(v) and statusS(v)? {unreached,labeled,scanned}.
Unreached
vertices haveds(v) =∞.Ifds(v) decreases,vbecomes
labeledTo
scan a labeled vertexv, for each arc (v,w), ifds(w)> ds(v) +?(v,w) setds(w) =ds(v) +?(v,w).Initially for all vertices are unreached.
Start by decreasingds(s) to 0.
While there are labeled vertices, pick one and scan it. Different selection rules lead to different algorithms.Reach for A?MIT 2/17/09 6
Dijkstra"s Algorithm
[Dijkstra 1959] ,[Dantzig 1963] At each step scan a labeled vertex with the minimum label.Stop whentis selected for scanning.Work almost linear in the visited subgraph size.Reverse Algorithm:Run algorithm fromtin the graph with all
arcs reversed, stop whentis selected for scanning.Bidirectional Algorithm
Run forward Dijkstra fromsand backward fromt.
Maintainμ, the length of the shortest path seen: when scan- ning an arc (v,w) such thatwhas been scanned in the other direction, check if the correspondings-tpath improvesμ. Stop when about to scan a vertexxscanned in the other direction. Outputμand the corresponding path.Reach for A?MIT 2/17/09 7Bidirectional Algorithm: Pitfalls
The algorithm is not as simple as it looks.
5 x2 2 s tba5 5 The searches meat atx, butxis not on the shortest path.Reach for A?MIT 2/17/09 8Example Graph
1.6M vertices, 3.8M arcs, travel time metric.
Reach for A?MIT 2/17/09 9
Dijkstra"s Algorithm
Searched area
Reach for A?MIT 2/17/09 10
Bidirectional Algorithm
forward search reverse searchReach for A?MIT 2/17/09 11
A?Search
[Doran 67] ,[Hart, Nilsson & Raphael 68]Similar to Dijkstra"s algorithm but:
Domain-specific estimatesπt(v) on dist(v,t) ( potentials At each step pick a labeled vertex with the minimumk(v) = d s(v) +πt(v).Best estimate of path length.
In general, optimality is not guaranteed.
Reach for A?MIT 2/17/09 12
Feasibility and Optimality
Potential transformation:Replace?(v,w) by?πt(v,w) =?(v,w)-πt(v) +πt(w) (reduced costs).Fact:Problems defined by?and?πtare equivalent.
Definition:πtisfeasibleif?(v,w)?A, the reduced costs are nonnegative. (Estimates are "locally consistent".) Optimality:Ifπtis feasible, the A?search is equivalent to Dijk- stra"s algorithm on transformed network, which has nonnegative arc lengths. A?search finds an optimal path.Different order of vertex scans, different subgraph searched.Fact:Ifπtis feasible andπt(t) = 0, thenπtgives
lower bounds on distances tot.Reach for A?MIT 2/17/09 13Computing Lower Bounds
Euclidean bounds:[folklore]
,[Pohl 71] ,[Sedgewick & Vitter 86] For graph embedded in a metric space, use Euclidean distance. Limited applicability, not very good for driving directions.We use triangle inequality v wa b dist(v,w)≥dist(v,b)-dist(w,b); dist(v,w)≥dist(a,w)-dist(a,v).Reach for A?MIT 2/17/09 14Lower Bounds (cont.)
Maximum (minimum, average) of feasible potentials is feasible.Select landmarks (a small number). For all vertices, precompute distances to and from each land- mark. For eachs,t, use max of the corresponding lower bounds for t(v).Why this works well(when it does)
s ta x y ?πt(x,y) = 0Reach for A?MIT 2/17/09 15
Bidirectional Lowerbounding
Forward reduced costs:?πt(v,w) =?(v,w)-πt(v) +πt(w).Reverse reduced costs:?πs(v,w) =?(v,w) +πs(v)-πs(w).What"s the problem?Reach for A?MIT 2/17/09 16
Bidirectional Lowerbounding
Forward reduced costs:?πt(v,w) =?(v,w)-πt(v) +πt(w). Reverse reduced costs:?πs(v,w) =?(v,w) +πs(v)-πs(w). Fact:πtandπsgive the same reduced costs iffπs+πt= const.[Ikeda et al. 94] : use ps(v) =πs(v)-πt(v) 2 and pt(v) =-ps(v)Other solutions possible.
Easy to loose correctness.
ALT algorithms useA?search and landmark-based lower bounds.Reach for A?MIT 2/17/09 17
Landmark Selection
Preprocessing
Random selection is fast.
Many heuristics find better landmarks.
Local search can find a good subset of candidate landmarks. We use a heuristic with local search.Preprocessing/query trade-off. Query For a specifics,tpair, only some landmarks are useful.Use only
active landmarks that give best bounds on dist(s,t).If needed,
dynamically add active landmarks (good for the search frontier). Allows using many landmarks with small time overhead.Reach for A?MIT 2/17/09 18Bidirectional ALT Example
Reach for A?MIT 2/17/09 19
Experimental Results
Northwest (1.6M vertices), random queries, 16 landmarks. preprocessing query method minutes MB avgscan maxscan msBidirectional Dijkstra
- 28518723 1197607 340.74
ALT 4 13216276 150389 12.05
Reach for A?MIT 2/17/09 20
Related Systems Work
Network delay estimation:Use delays to beacons to estimate arbitrary node delays.E.g., IDMaps [Francis et al. 01]Theoretical analysis
[Kleinberg, Slivkins & Wexler 04] : for ran- dom beacons and bounded doubling dimension graphs, get good bounds for most node pairs. Good bounds are not enough to prove bounds on ALT.Reach for A?MIT 2/17/09 21Reach Intuition
Identify local intersections and prune them when searchingfar fromsandt.Reach for A?MIT 2/17/09 22Reaches
[Gutman 04]Consider a vertexvthat splits a pathPintoP1andP2. rP(v) = min(?(P1),?(P2)). r(v) = maxP(rP(v)) over all shortest pathsPthroughv.Using reaches to prune Dijkstra:
LB(w,t)
d(s,v) w v t sIfr(w) d(v) +?(v,w) ,LB(w,t) ) then prunew. Reach for A?MIT 2/17/09 23
Obtaining Lower Bounds
Can use landmark lower bounds if available.Bidirectional search gives implicit bounds (Rtbelow). Rt LB(w,t)
d(s,v) w v t s Reach-based query algorithm
is Dijkstra"s algorithm with prun- ing based on reaches. Given a lower-bound subroutine, a small change to Dijkstra"s algorithm. Reach for A?MIT 2/17/09 24
Computing Reaches
A natural
exact computation uses all-pairs shortest paths. Overnight for 0.3M vertex graph, years for 30M vertex graph. Have a heuristic improvement, but it is not fast enough. Can use reach upper bounds for query search pruning. Iterative approximation algorithm:
[Gutman 04] Use
partial shortest path trees of depthO(?) to bound reaches of verticesvwithr(v)< ?. Delete vertices with bounded reaches, add penalties.quotesdbs_dbs17.pdfusesText_23
Reach for A?MIT 2/17/09 23
Obtaining Lower Bounds
Can use landmark lower bounds if available.Bidirectional search gives implicit bounds (Rtbelow). RtLB(w,t)
d(s,v) w v t sReach-based query algorithm
is Dijkstra"s algorithm with prun- ing based on reaches. Given a lower-bound subroutine, a small change to Dijkstra"s algorithm.Reach for A?MIT 2/17/09 24
Computing Reaches
A natural
exact computation uses all-pairs shortest paths. Overnight for 0.3M vertex graph, years for 30M vertex graph. Have a heuristic improvement, but it is not fast enough. Can use reach upper bounds for query search pruning.Iterative approximation algorithm:
[Gutman 04]Use
partial shortest path trees of depthO(?) to bound reaches of verticesvwithr(v)< ?. Delete vertices with bounded reaches, add penalties.quotesdbs_dbs17.pdfusesText_23[PDF] dijkstra algorithm ppt
[PDF] dijkstra algorithm pseudocode
[PDF] dijkstra algorithm python
[PDF] dijkstra algorithm runtime
[PDF] dijkstra algorithm space complexity
[PDF] dijkstra algorithm table
[PDF] dijkstra algorithm time and space complexity
[PDF] dijkstra algorithm time complexity
[PDF] dijkstra algorithm time complexity proof
[PDF] dijkstra algorithm visualization
[PDF] dijkstra pseudocode
[PDF] dijkstra's shortest path algorithm complexity
[PDF] dijkstra's shortest path algorithm explained
[PDF] dijkstra's shortest path algorithm time complexity