Bidirectional search and Goal-directed Dijkstra

Similar documents
Bidirectional search and Goal-directed Dijkstra

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

Point-to-Point Shortest Path Algorithms with Preprocessing

Computing the Shortest Path: A Search Meets Graph Theory

Highway Dimension and Provably Efficient Shortest Paths Algorithms

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

Introduction to Parallel & Distributed Computing Parallel Graph Algorithms

Online Dial-A-Ride Problem with Time Windows: an exact algorithm using status vectors

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

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

Point-to-Point Shortest Path Algorithms with Preprocessing

Accurate High-Performance Route Planning

Efficient Algorithms for Solving Shortest Paths on Nearly Acyclic Directed Graphs

Basics of Graph Theory

Combining Speed-up Techniques for Shortest-Path Computations

Topic: Local Search: Max-Cut, Facility Location Date: 2/13/2007

Algorithms (VII) Yijia Chen Shanghai Jiaotong University

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

Algorithms (VII) Yijia Chen Shanghai Jiaotong University

Algorithms (V) Path in Graphs. Guoqiang Li. School of Software, Shanghai Jiao Tong University

Scribe from 2014/2015: Jessica Su, Hieu Pham Date: October 6, 2016 Editor: Jimmy Wu

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

CMU-Q Lecture 2: Search problems Uninformed search. Teacher: Gianni A. Di Caro

Highway Hierarchies Star

Adaptations of the A* Algorithm for the Computation of Fastest Paths in Deterministic Discrete-Time Dynamic Networks

Graph Contraction. Graph Contraction CSE341T/CSE549T 10/20/2014. Lecture 14

Optimal Parallel Randomized Renaming

Graph Algorithms. Definition

Accurate High-Performance Route Planning

6.889 Lecture 15: Traveling Salesman (TSP)

Notes for Lecture 24

An algorithm for Performance Analysis of Single-Source Acyclic graphs

Visibility Graph. How does a Mobile Robot get from A to B?

Clustering. (Part 2)

Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M.

FINAL EXAM SOLUTIONS

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Principles of Algorithm Design

CSE 521: Design and Analysis of Algorithms I

Algorithmic Problems Related to Internet Graphs

1 The Traveling Salesperson Problem (TSP)

Speed-Up Techniques for Shortest-Path Computations

Speeding up Evolutionary Algorithms Through Restricted Mutation Operators

Foundations of Computing

Reading: 10.1, (opt.), 10.4 (opt.), 10.5 (mostly opt.), , 10.6 (mostly opt.)

Graph Theory. Chapter 4.

Greedy algorithms is another useful way for solving optimization problems.

(Refer Slide Time: 00:18)

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

Connected Components of Underlying Graphs of Halving Lines

Conflict-free Real-time AGV Routing

Shortest Path Algorithm

Computational Geometry

U.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, Midterm 1 Solutions

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

Algorithms on Graphs: Part III. Shortest Path Problems. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

DESIGN AND ANALYSIS OF ALGORITHMS GREEDY METHOD

Elementary maths for GMT. Algorithm analysis Part II

An efficient implementation of the greedy forwarding strategy

CS 170 Second Midterm ANSWERS 7 April NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt):

The Geodesic Integral on Medial Graphs

Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij

Advanced Operations Research Techniques IE316. Quiz 1 Review. Dr. Ted Ralphs

Approximating Fault-Tolerant Steiner Subgraphs in Heterogeneous Wireless Networks

Analysis of Algorithms, I

Algorithms and Theory of Computation. Lecture 7: Priority Queue

Week 11: Minimum Spanning trees

Parallel Graph Algorithms

Lecture 4: Graph Algorithms

Tutte s Theorem: How to draw a graph

A Note on the Separation of Subtour Elimination Constraints in Asymmetric Routing Problems

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility

Lecture 20 : Trees DRAFT

All-Pairs Nearly 2-Approximate Shortest-Paths in O(n 2 polylog n) Time

A Tight Analysis of the (1 + 1)-EA for the Single Source Shortest Path Problem

Unit #9: Graphs. CPSC 221: Algorithms and Data Structures. Will Evans 2012W1

ME/CS 132: Advanced Robotics: Navigation and Vision

Section 08: Solutions

On Minimum Weight Pseudo-Triangulations

A TIGHT BOUND ON THE LENGTH OF ODD CYCLES IN THE INCOMPATIBILITY GRAPH OF A NON-C1P MATRIX

Algorithms for Data Science

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

CSE 417: Algorithms and Computational Complexity. 3.1 Basic Definitions and Applications. Goals. Chapter 3. Winter 2012 Graphs and Graph Algorithms

Network optimization: An overview

A Game Map Complexity Measure Based on Hamming Distance Yan Li, Pan Su, and Wenliang Li

High Dimensional Indexing by Clustering

Reversible Hyperbolic Triangulations

A visibility graph based method for path planning in dynamic environments

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

Graph Representations and Traversal

Combining Speedup Techniques based on Landmarks and Containers

Institutionen för datavetenskap Department of Computer and Information Science

Depth First Search A B C D E F G A B C 5 D E F 3 2 G 2 3

SILC: Efficient Query Processing on Spatial Networks

Point Location in Delaunay Triangulations

A new edge selection heuristic for computing the Tutte polynomial of an undirected graph.

Distributed minimum spanning tree problem

Figure : Example Precedence Graph

What is Multicasting? Multicasting Fundamentals. Unicast Transmission. Agenda. L70 - Multicasting Fundamentals. L70 - Multicasting Fundamentals

Chapter 10. Fundamental Network Algorithms. M. E. J. Newman. May 6, M. E. J. Newman Chapter 10 May 6, / 33

Transcription:

Computing the shortest path Bidirectional search and Goal-directed Dijkstra Alexander Kozyntsev October 18, 2010 Abstract We study the problem of finding a shortest path between two vertices in a directed graph. This is an important problem with many applications, including that of computing driving directions. In this work we present a bidirectional search algorithm that has expected running time ( n log n) instead of Dijkstra s unidirectional search algorithm which has the expected running time (n log n). Also, A search in combination with a new graph-theoretic lowerbounding technique based on landmarks and the triangular inequality is discussed. We also present bidirectional variants of A search. 1

Contents 1 Introduction 3 1.1 Definition of a Random Graph........................... 3 2 Analysis of Unidirectional search 3 3 Bidirectional search 3 3.1 Definitions....................................... 3 3.1.1 Phase I.................................... 4 3.1.2 Phase II.................................... 4 3.2 Comparison...................................... 4 4 Goal-directed search 5 4.1 Definitions....................................... 5 4.2 Landmark selection.................................. 6 5 Bidirectional lower-bownding algorithms 6 5.1 Symmetric approach................................. 6 5.2 Consistent approach................................. 6 6 Conclusion 7 2

1 Introduction The shortest path problem is a fundamental problem with numerous applications. In this paper we study one of the most common variants of the problem, where the goal is to find a point-to-point shortest path in a directed graph. The fastest algorithm known due to Dijkstra, it performs a unidirectional search outward from the source node s toward the destination node d. A natural alternative, termed bidirectional search, is to search simultaneously forward from s and backward from d. In the worst case this is roughly twice as slow as unidirectional search, but empirical results suggest that it is faster in practice [5] and [4]. 1.1 Definition of a Random Graph For expository purposes we use the following probabilistic model. We assume that the graph is a complete directed graph with n nodes. An exponential distribution is used to choose the length of each edge: the mean length of an edge is 1/λ for all n. Then P r[l e x] = 1 exp λx for some fixed λ > 0. The important property of exponential distribution that we will use later is that it is memoryless, that is, P r[l e x + y l e x] = P r[l e y] for all x, y 0. 2 Analysis of Unidirectional search We describe the procedure which will be used to simulate the behaviour of the unidirectional search algorithm on a random graph. The edge-lengths are chosen from the exponential distribution, but are unknown to the procedure. All edges are initially inactive. Associated with the procedure is a real-valued variable L, which starts at zero and increases in a continous manner. At the beginning of the procedure, s is added to S and all edges out of s are activated. If the procedure makes an edge e active, when L = x, then, when L = x + l e, the edge is discovered by the procedure. An edge that has been discovered is no longer considered active. Theorem 1. Let the random variable X be the number of nodes in S at the end of the algorithm. Then 1 P r(x = k) =, for 2 k n (1) (n 1) E(X) = Θ(n) (2) Internal edges may also be discovered during the course of the algorithm. These discoveries do not terminate a stage; but they correspond to queue operations. Theorem 2. The expected number of edge discoveries in unidirectional search, both internal and external, is Θ(n). 3 Bidirectional search 3.1 Definitions The bidirectional search proceeds in two phases (cf. Figure 1). In the first phase we alternate between two unidirectional searches: one forward from s, growing a tree spanning a set of nodes S for which the minimum distance from s is known, and the other backward from d spanning a set D of nodes for which the minimum distance to d is known. Phase I alternately adds one node to S and one node to D, continuing until an edge crossing from S to D is drawn. At this point, the shortest path is known to lie within the search trees associated with S and D except for at most one edge from S to D. 3

Figure 1: Bidirectional search 3.1.1 Phase I Let X be the number of stages in Phase I. Then E[X] = Θ( n) and the total number of edges discovered in phase I is bounded by 2X plus the number of internal edges that are discovered. Theorem 3. The expected number of internal edges discovered in Phase I is O(1) The significance of Theorem 3 is that the expected overhead due to drawing internal edges from the queue is only O(1) queue operations. 3.1.2 Phase II In general, the s d path P found at the end of phase I is not necessarily the shortest s d path. However, by the following argument, there is no s d path P which is shorter than P such that P contains a node x not in S D. It is not hard to see that the length of P is at most L S + L D. On the other hand, by the correctness of Dijkstra s algorithm, the distance from s to x along P is at least L S ; similarly, the distance from x to d along P is at least L D. Thus P is at least as long as P. As a consequence, the shortest s d path lies entirely within the search trees associated with S and D except for at most one cross-edge. The aim of phase II is to find the shortest path among this resricted set of paths. The following theorem shows that the expected number of queue operations in bidirectional search is Θ( n). Theorem 4. The expected number of edges discovered during Phase II is O( n). 3.2 Comparison In an implementation of unidirectional or bidirectional search using priority queues, there are at most n edges in a queue at any one time, one for each node in the S or D sets. Hence each queue operation takes O(log n) time. Unidirectional Search 1. Each queue operation takes O(log n) time 4

2. The expected running time is O(n log n) Bidirectional Search 1. Each queue operation takes O(log n) time 2. The expected running time is O( n log n) 4 Goal-directed search 4.1 Definitions This technique, originating from [2], modifies the priority of active nodes to change the order in which the nodes are processed. More precisely, a goal-directed search adds to the priority dist(u) a potential ρ t depending on the target t of the search. Definition 4.1. A potential function is a function from vertices to reals. Given a potential function ρ, we define the reduced cost of an edge by l (u, v) := l(u, v) ρ t (u) + ρ t (v) (3) With a suited potential, the search can be pushed towards the target thereby reducing the running time while the algorithm still returns a shortest path. Intuitively speaking, one can compare a path in traffic network with a walk in a landscape. If you add a potential, the affected region is raised. If the added potential is small next to the target, you create a valley around the target. As walking downhill is easier than uphill, you are likely to hit the target sooner than without the potential added. Definition 4.2. Given a weighted graph G = (V, E), l : V R + 0, a potential ρ : V R is called feasible, if l(u, v) ρ t (u) + ρ t (v) 0 for all edges e E. It can be shown that a feasible potential ρ is a lower bound of the distance to the target t if ρ(t) 0. The tighter the bound is, the more the search is attracted to the target. In particular, a goal-directed search visits only nodes on the shortest path, if the potential is the distance to tha target. We will now present three scenarios and how to obtain feasible potentials in these cases: 1. Euclidean distances: Assume a layout L : V R 2 of the graph is available where the length of an edge is somehow correlated with Euclidean distance of its end nodes. Then a feasible potential for a node v can be obtained using the Euclidean distance L(v) L(t) to the target t. 2. Landmarks: With preprocessing, it is possible to gather information about the graph that can be used to obtain improved lower bounds. In [1], a small fixed-sized subset L V of landmarks is chosen. Then, for all nodes v V, the distance dist(v, l) to all nodes l L is precomputed and stored. These distances can be used to determine a feasible potential ([6]). 3. Distances from Graph Condensation: One can run Dijkstra s algorithm for a condensed graph and get the distances for all v to the target t. These distances provide a feasible potential for the time-expanded graph ([1]). 5

4.2 Landmark selection Finding good landmarks is critical for the overall performance of lower-bounding algorithms. We will now present a few methods of selecting landmarks: Random landmark selection: The simplest way of selecting landmarks is to select k landmark vertices at random. This works reasonably well, but one can do better. Farthest landmark selection: Pick a start vertex and find a vertex v 1 that is farthest away from it. Add v 1 to the set of landmarks. Proceed in iterations, at each iteration finding a vertex that is farthest away from the current set of landmarks and adding the vertex to the set. Planar landmark selection: Find a vertex c closest to the center of the embedding. Divide the embedding into k pie-clice sectors centerd at c, each containing approximately the same number of vertices. For each sector pick a vertex farthest away from the center. To avoid having two landmarks close to each other, if we processed sector A and are processing sector B such that the landmark for A is close to the border of A and B, we skip the vertices of B close to the border. The above three selection rules are relatively fast, and one can optimize them various ways. 5 Bidirectional lower-bounding algorithms In this section we show how to combine the ideas of bidirectional search and A search. This seems trivial: just run the forward and the reverse searches and stop as soon as they meet. This doesn t work, however. Definition 5.1. We say that ρ t and ρ s are consistent if for all arcs (v, w), l ρt (v, w) in the original graph is equal to l ρs (w, v) in the reverse graph. In other words ρ t + ρ s = const It is easy to come up with lower-bounding schemes for which ρ t and ρ s are not consistent. If they are not, the forward and the reverse searches use different length functions. Therefore when the searches meet, we have no guarantee that the shortest path has been found. One can overcome this difficulty in two ways: develop a new termination condition, or use consistent potential functions. 5.1 Symmetric approach The following symmetric algorithm is due to [5]. Run the forward and the reverse searches, alternating in some way. Each time a forward search scans an arc (v, w) such that w has been scanned by the reverse search, see if the concatenation of the s t path formed by concatenating the shortest s v path found by the forward search, (v, w), and the shortest w t path found by the reverse search, is shorter than best s t path found so far, and update the best path and its length, µ, if needed. Also do the corresponding updates during the reverse search. Stop when one of the searches is about to scan a vertex v with k(v) µ or when both searches have no labeled vertices. The algorithm is correct because the search must have found the shortest path by then. 5.2 Consistent approach Given a potential function ρ, a consistent algorithm uses ρ for the forward computation and ρ (or its shift by a constant, which is equivalent correctness-wise) for the reverse one. These two potential functions are consistent; the difficulty is to select a function ρ that works well. 6

Let Π t and Π s be feasible potential functions giving lower bounds to the source and from the sink. Ikeda at [3] use ρ t (v) = Πt(v) Πs(v) 2 as the potential function for forward computation and ρ s (v) = Πs(v) Πt(v) 2 for the reverse one. Feasibility of the average of ρ t and ρ s is obvious. 6 Conclusion Two methods for finding a shortest path have been presented. The first one, bidirectional search algorithm is a multiplicative factor of n faster than the unidirectional algorithm in the average case, where edge length are independent random variables. Presented results hold for a large class of probability distributions on random graphs, including both directed and undirected graphs, sparse as well as dense graphs, and graphs where the length of each edge is drawn from a different probability distribution. Besides, we has shown that unidirectional algorithm searches a ball with s in the center and d on the boundary, instead of bidirectional algorithm which searches two touching balls centered at s and d. And the second one, goaldirected search algorithm is based on landmarks and triangular inequality, for which several landmark selections were presented. Also, we have shown how to combine these two techiques - the ideas of bidirectional search and A search. References [1] A.V. Galdberg and C. Harrelson. Computing the shortest path: A* search meets graph theory. Proc. 16th Annual ACM-SIAM Symposium on Discrete Algorithms, page 156 165, 2005. [2] P.E. Hart, N.J. Nilsson, and B. Raphael. A formal basis or the heuristic determination of minimum cost paths. IEEE transactions on systems science and cybernetics, 4:100 107, 1968. [3] T. Ikeda, Min-Yao Hsu, H. Imai, S. Nishimura, and other. A fast algorithm for finding better routes by AI search techniques. Vehicle navigation and information systems conference, 1994. [4] Y. Ma. A shortest path algorithm with expected running time o( V log v). Master s project report, University of California, Berkeley. [5] I. Pohl. Bidirectional search. Machine intelligence, 6, 1971. [6] D. Wagner and T. Willhalm. Speed-up techniques for shortest-path computations. Institut fur Theoretische Informatik, 2005. 7