Point-to-Point Shortest Path Algorithms with Preprocessing

Similar documents
Reach for A : an Efficient Point-to-Point Shortest Path Algorithm

Highway Dimension and Provably Efficient Shortest Paths Algorithms

Point-to-Point Shortest Path Algorithms with Preprocessing

Reach for A : Efficient Point-to-Point Shortest Path Algorithms

Reach for A : Efficient Point-to-Point Shortest Path Algorithms

Route Planning. Reach ArcFlags Transit Nodes Contraction Hierarchies Hub-based labelling. Tabulation Dijkstra Bidirectional A* Landmarks

Bidirectional search and Goal-directed Dijkstra

Highway Hierarchies Star

Experimental Study on Speed-Up Techniques for Timetable Information Systems

Computing the Shortest Path: A Search Meets Graph Theory

Highway Hierarchies Hasten Exact Shortest Path Queries

Simon Peyton Jones (giving the talk) Andrew Goldberg (who did all the work) Microsoft Research

Bidirectional search and Goal-directed Dijkstra

Computing Many-to-Many Shortest Paths Using Highway Hierarchies

Accurate High-Performance Route Planning

Combining Hierarchical and Goal-Directed Speed-Up Techniques for Dijkstra s Algorithm

Highway Hierarchies Star

Experimental Study on Speed-Up Techniques for Timetable Information Systems

Speed-Up Techniques for Shortest-Path Computations

Accurate High-Performance Route Planning

Algorithm Engineering for Route Planning: An Update International Symposium on Algorithms and Computation 2011 Dorothea Wagner December 6, 2011

Landmark-Based Routing in Dynamic Graphs

SHARC: Fast and Robust Unidirectional Routing

arxiv: v1 [cs.ds] 5 Oct 2010

Route Planning in Road Networks

Exploring Graph Partitioning for Shortest Path Queries on Road Networks

Robust, Almost Constant Time Shortest-Path Queries in Road Networks

Route Planning in Transportation Networks

arxiv: v1 [cs.ds] 3 Mar 2016

Using Multi-Level Graphs for Timetable Information. Frank Schulz, Dorothea Wagner, and Christos Zaroliagis

Shortest Paths: Algorithms for standard variants. Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender

Highway Hierarchies (Dominik Schultes) Presented by: Andre Rodriguez

Understanding Subgoal Graphs by Augmenting Contraction Hierarchies

Engineering Highway Hierarchies

Customizable Route Planning

Alternative Routes in Road Networks

Combining Hierarchical and Goal-Directed Speed-Up Techniques for Dijkstra s Algorithm

R. Kalpana #1 P. Thambidurai *2. Puducherry, India. Karaikal, Puducherry, India

Transit Nodes Lower Bounds and Refined Construction

Engineering Route Planning Algorithms

Dynamic Arc-Flags in Road Networks

Partitioning Graphs to Speed Up Dijkstra s Algorithm

Time-Dependent Contraction Hierarchies

Shortest Paths: Basics. Algorithms and Networks 2016/2017 Johan M. M. van Rooij Hans L. Bodlaender

Car or Public Transport Two Worlds

Fast and Compact Oracles for Approximate Distances in Planar Graphs

Contraction Hierarchies: Faster and Simpler Hierarchical Routing in Road Networks

Dynamic Highway-Node Routing

Hierarchical Hub Labelings for Shortest Paths

Location-Based Services & Route Planning

Customizable Route Planning in Road Networks

Combining Speedup Techniques based on Landmarks and Containers

Hub Label Compression

Parallel Hierarchies for Solving Single Source Shortest Path Problem

Route Planning for Bicycles Exact Constrained Shortest Paths made Practical via Contraction Hierarchy

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

Construction of Minimum-Weight Spanners Mikkel Sigurd Martin Zachariasen

SILC: Efficient Query Processing on Spatial Networks

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

Engineering Multi-Level Overlay Graphs for Shortest-Path Queries

Efficient Verification of Shortest Path Search via Authenticated Hints. Presented by: Nuttiiya Seekhao

Mobile Route Planning

Core Routing on Dynamic Time-Dependent Road Networks

A Goal-Directed Shortest Path Algorithm Using Precomputed Cluster Distances

Graph Indexing of Road Networks for Shortest Path Queries with Label Restrictions

Lecture 3: Totally Unimodularity and Network Flows

Shortest-Path Indices: Establishing a Methodology for Shortest-Path Problems

Advanced Route Planning and Related Topics Freiburg Update

Homework 4 Solutions

Feasibility Study: Subgoal Graphs on State Lattices

Route Planning with Flexible Objective Functions

CAD Algorithms. Categorizing Algorithms

Optimal Routing Algorithms

Engineering Time-Expanded Graphs for Faster Timetable Information

2) Multi-Criteria 1) Contraction Hierarchies 3) for Ride Sharing

Engineering Route Planning Algorithms

CSE 331: Introduction to Algorithm Analysis and Design Graphs

A Multi-Source Label-Correcting Algorithm for the All-Pairs Shortest Paths Problem

Objective of the present work

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 14: Combinatorial Problems as Linear Programs I. Instructor: Shaddin Dughmi

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Combining Speed-up Techniques for Shortest-Path Computations

Local Algorithms for Sparse Spanning Graphs

I/O Efficient Algorithms for Exact Distance Queries on Disk- Resident Dynamic Graphs

Module 6 NP-Complete Problems and Heuristics

L3 Network Algorithms

Geometric data structures:

Module 6 NP-Complete Problems and Heuristics

Programming, numerics and optimization

Theorem 2.9: nearest addition algorithm

Clustering. Informal goal. General types of clustering. Applications: Clustering in information search and analysis. Example applications in search

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

and 6.855J. The Successive Shortest Path Algorithm and the Capacity Scaling Algorithm for the Minimum Cost Flow Problem

Engineering shortest-path algorithms for dynamic networks

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch.

Searching for Shortest Path in A Large, Sparse Graph under Memory Limitation: A Successive Mixed Bidirectional Search Method

Performance Analysis of Parallel Speedup Techniques for Shortest Path Queries in Networks of Random and Planar Types

(Refer Slide Time: 00:18)

Lecture 5 Heuristics. Last Time: A* Search

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

Transcription:

Point-to-Point Shortest Path Algorithms with Preprocessing Andrew V. Goldberg Microsoft Research Silicon Valley www.research.microsoft.com/ goldberg/ Joint work with Chris Harrelson, Haim Kaplan, and Retato Werneck

Einstein Quote Everything should be made as simple as possible, but not simpler SOFSEM 07 1

Shortest Path Problem Variants Non-negative and arbitrary arc lengths. Point to point, single source, all pairs. Directed and undirected. Here we study Point to point, non-negative length, directed problem. Allow preprocessing with limited (linear) space. Many applications, both directly and as a subroutine. SOFSEM 07 2

Shortest Path Problem Input: Directed graph G = (V, A), non-negative length function l : A R +, source s V, terminal t V. Preprocessing: Limited space to store results. Query: Find a shortest path from s to t. Interested in exact algorithms that search a subgraph. Related work: reach-based routing [Gutman 04], hierarchical decomposition [Schultz, Wagner & Weihe 02], [Sanders & Schultes 05, 06], geometric pruning [Wagner & Willhalm 03], arc flags [Lauther 04], [Köhler, Möhring & Schilling 05], [Möhring et al. 06]. SOFSEM 07 3

Motivating Application Driving directions Run on servers and small devices. Current implementations Use base graph based on road categories and manually augmented. Runs (bidirectional) Dijkstra or A with Euclidean bounds on patched graph. Non-exact. Interested in exact and very efficient algorithms. Big graphs: Western Europe, USA, North America: 18 to 30 million vertices. SOFSEM 07 4

Outline Scanning method and Dijkstra s algorithm. Bidirectional Dijkstra s algorithm. A search. ALT Algorithm Definition of reach Reach-based algorithm Combining reach and A SOFSEM 07 5

Scanning Method For each vertex v maintain its distance label d s (v) and status S(v) {unreached, labeled, scanned}. Unreached vertices have d s (v) =. If d s (v) decreases, v becomes labeled. To scan a labeled vertex v, for each arc (v, w), if d s (w) > d s (v) + l(v, w) set d s (w) = d s (v) + l(v, w). Initially for all vertices are unreached. Start by decreasing d s (s) to 0. While there are labeled vertices, pick one and scan it. Different selection rules lead to different algorithms. SOFSEM 07 6

Dijkstra s Algorithm [Dijkstra 1959], [Dantzig 1963]. At each step scan a labeled vertex with the minimum label. Stop when t is selected for scanning. Work almost linear in the visited subgraph size. Reverse Algorithm: Run algorithm from t in the graph with all arcs reversed, stop when t is selected for scanning. Bidirectional Algorithm Run forward Dijkstra from s and backward from t. Maintain µ, the length of the shortest path seen: when scanning an arc (v, w) such that w has been scanned in the other direction, check if the corresponding s-t path improves µ. Stop when about to scan a vertex x scanned in the other direction. Output µ and the corresponding path. SOFSEM 07 7

Bidirectional Algorithm: Pitfalls The algorithm is not as simple as it looks. s 2 a 5 b 2 5 x 5 t The searches meat at x, but x is not on the shortest path. SOFSEM 07 8

Example Graph 1.6M vertices, 3.8M arcs, travel time metric. SOFSEM 07 9

Dijkstra s Algorithm Searched area SOFSEM 07 10

Bidirectional Algorithm forward search/ reverse search SOFSEM 07 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 minimum k(v) = d s (v) + π t (v). Best estimate of path length through v. In general, optimality is not guaranteed. SOFSEM 07 12

Feasibility and Optimality Potential transformation: Replace l(v, w) by l πt (v, w) = l(v, w) π t (v) + π t (w) (reduced costs). Fact: Problems defined by l and l πt are equivalent. Definition: π t is feasible if (v, w) A, the reduced costs are nonnegative. (Estimates are locally consistent.) Optimality: If π t is feasible, the A search is equivalent to Dijkstra 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 π t is feasible and π t (t) = 0, then π t gives lower bounds on distances to t. SOFSEM 07 13

Computing 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 a 01 00 11 0 1 01 0000 1111 0000 1111 01 1100000 11111 00000 1111100 00 11 00000 11111 00000 11111 00 11 00 11 00000 11111 00000 11111 00 11 00 110 10000 1111 0000 1111 01 01 01 v w b dist(v, w) dist(v, b) dist(w, b); dist(v, w) dist(a, w) dist(a, v). SOFSEM 07 14

Lower Bounds (cont.) Maximum (minimum, average) of feasible potentials is feasible. Select landmarks (a small number). For all vertices, precompute distances to and from each landmark. For each s, t, use max of the corresponding lower bounds for π t (v). Why this works well (when it does) a s x y t l πt (x, y) = 0 SOFSEM 07 15

Bidirectional Lower-bounding Forward reduced costs: l πt (v, w) = l(v, w) π t (v) + π t (w). Reverse reduced costs: l πs (v, w) = l(v, w) + π s (v) π s (w). What s the problem? SOFSEM 07 16

Bidirectional Lower-bounding Forward reduced costs: l πt (v, w) = l(v, w) π t (v) + π t (w). Reverse reduced costs: l πs (v, w) = l(v, w) + π s (v) π s (w). Fact: π t and π s give the same reduced costs iff π s + π t = const. [Ikeda et at. 94]: use p s (v) = π s(v) π t (v) 2 and p t (v) = p s (v). Other solutions possible. Easy to lose correctness. ALT algorithms use A search and landmark-based lower bounds. SOFSEM 07 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 specific s, t pair, 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). Only three active landmarks on the average. Allows using many landmarks with small time overhead. SOFSEM 07 18

Bidirectional ALT Example SOFSEM 07 19

Experimental Results Northwest (1.6M vertices), random queries, 16 landmarks. preprocessing query method minutes MB avgscan maxscan ms Bidirectional Dijkstra 28 518 723 1 197 607 340.74 ALT 4 132 16 276 150 389 12.05 SOFSEM 07 20

Reaches [Gutman 04] Consider a vertex v that splits a path P into P 1 and P 2. r P (v) = min(l(p 1 ), l(p 2 )). r(v) = max P (r P (v)) over all shortest paths P through v. Using reaches to prune Dijkstra: d(s,v) v w LB(w,t) s t If r(w) < min(d(v) + l(v, w), LB(w, t)) then prune w. SOFSEM 07 21

Obtaining Lower Bounds Can use landmark lower bounds if available. Bidirectional search gives implicit bounds (R t below). d(s,v) v w LB(w,t) s Rt t Reach-based query algorithm is Dijkstra s algorithm with pruning based on reaches. Given a lower-bound subroutine, a small change to Dijkstra s algorithm. SOFSEM 07 22

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 depth O(ǫ) to bound reaches of vertices v with r(v) < ǫ. Delete vertices with bounded reaches, add penalties. Increase ǫ and repeat. Query time does not increase much; preprocessing faster but still not fast enough. SOFSEM 07 23

Reach Algorithm SOFSEM 07 24

Experimental Results Northwest (1.6M vertices), random queries, 16 landmarks. preprocessing query method minutes MB avgscan maxscan ms Bidirectional Dijkstra 28 518 723 1 197 607 340.74 ALT 4 132 16 276 150 389 12.05 Reach 1 100 34 53 888 106 288 30.61 SOFSEM 07 25

Shortcuts Consider the graph below. Many vertices have large reach. 1000 1000 s 10 10 10 10 10 10 10 10 1000 1010 1020 1030 1040 1030 1020 1010 1000 t SOFSEM 07 26

Shortcuts Consider the graph below. Many vertices have large reach. Add a shortcut arc, break ties by the number of hops. 1000 80 1000 s 10 10 10 10 10 10 10 10 t SOFSEM 07 27

Shortcuts Consider the graph below. Many vertices have large reach. Add a shortcut arc, break ties by the number of hops. Reaches decrease. s 1000 60 50 40 30 40 50 60 1000 t SOFSEM 07 28

Shortcuts Consider the graph below. Many vertices have large reach. Add a shortcut arc, break ties by the number of hops. Reaches decrease. Repeat. s 1000 20 10 20 30 20 10 20 1000 t SOFSEM 07 29

Shortcuts Consider the graph below. Many vertices have large reach. Add a shortcut arc, break ties by the number of hops. Reaches decrease. Repeat. A small number of shortcuts can greatly decrease many reaches. s 1000 0 10 0 30 0 10 0 1000 t SOFSEM 07 30

Shortcuts [Sanders & Schultes 05]. During preprocessing we shortcut degree 2 vertices every time ǫ is updated. Shortcuts greatly speed up preprocessing. Shortcuts speed up queries. Shortcuts require more space (extra arcs, auxiliary info.) SOFSEM 07 31

Reach with Shortcuts SOFSEM 07 32

Experimental Results Northwest (1.6M vertices), random queries, 16 landmarks. preprocessing query method minutes MB avgscan maxscan ms Bidirectional Dijkstra 28 518 723 1 197 607 340.74 ALT 4 132 16 276 150 389 12.05 Reach 1 100 34 53 888 106 288 30.61 Reach+Short 17 100 2 804 5 877 2.39 SOFSEM 07 33

Reaches and ALT ALT computes transformed and original distances. ALT can be combined with reach pruning. Careful: Implicit lower bounds do not work, but landmark lower bounds do. Shortcuts do not affect landmark distances and bounds. SOFSEM 07 34

Reach with Shortcuts and ALT SOFSEM 07 35

Experimental Results Northwest (1.6M vertices), random queries, 16 landmarks. preprocessing query method minutes MB avgscan maxscan ms Bidirectional Dijkstra 28 518 723 1 197 607 340.74 ALT 4 132 16 276 150 389 12.05 Reach 1 100 34 53 888 106 288 30.61 Reach+Short 17 100 2 804 5 877 2.39 Reach+Short+ALT 21 204 367 1 513 0.73 SOFSEM 07 36

The North America Graph North America (30M vertices), random queries, 16 landmarks. preprocessing query method hours GB avgscan maxscan ms Bidirectional Dijkstra 0.5 10 255 356 27 166 866 7 633.9 ALT 1.6 2.3 250 381 3 584 377 393.4 Reach impractical Reach+Short 11.3 1.8 14 684 24 618 17.4 Reach+Short+ALT 12.9 3.6 1 595 7 450 3.7 SOFSEM 07 37

Recent Improvements Better shortcuts [Sanders & Schultes 06]: replace small degree vertices by cliques. For constant degree bound, O(n) arcs are added. Improved locality (sort by reach). For RE, factor of 3 12 improvement for preprocessing and factor of 2 4 for query times. SOFSEM 07 38

Recent Improvements (cont.) Reach-aware landmarks: Store landmark distances only for high-reach vertices (e.g., 5%). For low-reach vertices, use the closest high-reach vertex to compute lower bounds. Can use freed space for more landmarks, improve both space and time. Practical even on the North America graph (30M vertices): 1ms. query time on a server. 6sec. query time on a Pocket PC with 4GB flash card. Better for local queries. SOFSEM 07 39

The North America Graph North America (30M vertices), random queries, 16 landmarks. preprocessing query method hours GB avgscan maxscan ms Bidirectional Dijkstra 0.5 10 255 356 27 166 866 7 633.9 ALT 1.6 2.3 250 381 3 584 377 393.4 Reach impractical Reach+Short 11.3 1.8 14 684 24 618 17.4 Reach+Sh(new) 2.5 1.9 3 390 6 103 3.2 Reach+Short+ALT 12.9 3.6 1 595 7 450 3.7 Reach+Sh+ALT(new) 2.7 3.7 523 4 015 1.2 SOFSEM 07 40

Grid Graphs Grid with uniform random lengths (0.5M vertices), 16 landmarks. No highway structure. preprocessing query method min MB avgscan maxscan ms Bidirectional Dijkstra 13.9 171 341 401 623 91.87 ALT 1.9 50.2 4 416 40 568 5.25 Reach+Short 232.1 41.4 23 201 39 433 17.47 Reach+Short (new) 28.2 43.3 4 605 7 326 4.55 Reach+Short+ALT 234.1 77.7 1 172 7 702 1.61 Reach+Sh+ALT (new) 28.5 82.2 592 2983 1.02 Reach preprocessing expensive, but (surprise!) helps queries. SOFSEM 07 41

Demo SOFSEM 07 42

Concluding Remarks Recent progress [Bast et. al 06], improvements with Sanders and Schultes. Preprocessing heuristics work well on road networks. How to select good shortcuts? (Road networks/grids.) For which classes of graphs do these techniques work? Need theoretical analysis for interesting graph classes. Interesting problems related to reach, e.g. Is exact reach as hard as all-pairs shortest paths? Constant-ratio upper bounds on reaches in Õ(m) time. Dynamic graphs. SOFSEM 07 43