Query Processing in Spatial Network Databases

Similar documents
CS 4407 Algorithms Lecture: Shortest Path Algorithms

Single Source Shortest Paths

Design and Analysis of Algorithms

Analysis of Algorithms. Outline. Single Source Shortest Path. Andres Mendez-Vazquez. November 9, Notes. Notes

Single Source Shortest Paths

CMPS 2200 Fall Carola Wenk Slides courtesy of Charles Leiserson with small changes by Carola Wenk. 10/8/12 CMPS 2200 Intro.

CMPS 6610 Fall 2018 Shortest Paths Carola Wenk

Nearest Neighbor Search with Keywords

Slides credited from Hsueh-I Lu & Hsu-Chun Hsiao

CS 253: Algorithms. Chapter 24. Shortest Paths. Credit: Dr. George Bebis

Introduction to Algorithms

Introduction to Algorithms

Breadth First Search, Dijkstra s Algorithm for Shortest Paths

Introduction to Algorithms

Skylines. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya

CS 6301 PROGRAMMING AND DATA STRUCTURE II Dept of CSE/IT UNIT V GRAPHS

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

Introduction to Algorithms

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

Algorithms: Lecture 12. Chalmers University of Technology

Shortest Path Algorithms

Decision Mathematics D1 Advanced/Advanced Subsidiary. Tuesday 9 June 2015 Morning Time: 1 hour 30 minutes

Shortest Paths. CS 320, Fall Dr. Geri Georg, Instructor 320 ShortestPaths 3

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

BFS Dijkstra. Oct abhi shelat

CMU Lecture 4: Informed Search. Teacher: Gianni A. Di Caro

Algorithm Design Strategies V

Lecture 11. Single-Source Shortest Paths All-Pairs Shortest Paths

CSE 591 Foundations of Algorithms Homework 4 Sample Solution Outlines. Problem 1

Dijkstra s Single Source Shortest Path Algorithm. Andreas Klappenecker

Contents Lecture 4. Greedy graph algorithms Dijkstra s algorithm Prim s algorithm Kruskal s algorithm Union-find data structure with path compression

Graph Search Howie Choset

CSE 4502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions

Informed Search. Chap. 4. Breadth First. O(Min(N,B L )) BFS. Search. have same cost BIBFS. Bi- Direction. O(Min(N,2B L/2 )) BFS. have same cost UCS

Informed Search. Day 3 of Search. Chap. 4, Russel & Norvig. Material in part from

Algorithm Design and Analysis

Lecture Notes for Chapter 25: All-Pairs Shortest Paths

Ngày 20 tháng 7 năm Discrete Optimization Graphs

All-Pairs Shortest Paths

CS781 Lecture 3 January 27, 2011

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

Breadth-First Search of Graphs

Metrics: Growth, dimension, expansion

ICS 252 Introduction to Computer Design

High-Dimensional Indexing by Distributed Aggregation

Spatial Database. Ahmad Alhilal, Dimitris Tsaras

Efficient K-Nearest Neighbor Search in Time-Dependent Spatial Networks

Algorithm Design and Analysis

Nearest Neighbor Search in Spatial

Data Structures and and Algorithm Xiaoqing Zheng

Making Nearest Neighbors Easier. Restrictions on Input Algorithms for Nearest Neighbor Search: Lecture 4. Outline. Chapter XI

Nearest Neighbor Search with Keywords in Spatial Databases

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CS 161: Design and Analysis of Algorithms

Algorithms for Picture Analysis. Lecture 07: Metrics. Axioms of a Metric

Matching Residents to Hospitals

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Tailored Bregman Ball Trees for Effective Nearest Neighbors

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

An Õ m 2 n Randomized Algorithm to compute a Minimum Cycle Basis of a Directed Graph

Incremental Path Planning

Divide-and-Conquer Algorithms Part Two

IS 2610: Data Structures

CS 580: Algorithm Design and Analysis

CS 410/584, Algorithm Design & Analysis, Lecture Notes 4

CS 580: Algorithm Design and Analysis

Pavel Zezula, Giuseppe Amato,

Fundamental Algorithms 11

The Greedy Method. Design and analysis of algorithms Cs The Greedy Method

Algorithms and Data Structures (COMP 251) Midterm Solutions

CS360 Homework 12 Solution

CSE 417T: Introduction to Machine Learning. Final Review. Henry Chai 12/4/18

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 10

NATIONAL UNIVERSITY OF SINGAPORE CS3230 DESIGN AND ANALYSIS OF ALGORITHMS SEMESTER II: Time Allowed 2 Hours

ne a priority queue for the nodes of G; ile (! PQ.is empty( )) select u PQ with d(u) minimal and remove it; I Informatik 1 Kurt Mehlhorn

The Max Flow Problem

CS 241 Analysis of Algorithms

AI Programming CS S-06 Heuristic Search

8 Priority Queues. 8 Priority Queues. Prim s Minimum Spanning Tree Algorithm. Dijkstra s Shortest Path Algorithm

Algorithms to Compute Minimum Cycle Basis in Directed Graphs

I may not have gone where I intended to go, but I think I have ended up where I needed to be. Douglas Adams

A Simple Implementation Technique for Priority Search Queues

Decision Mathematics D1 Advanced/Advanced Subsidiary. Tuesday 13 January 2009 Morning Time: 1 hour 30 minutes

The direction-constrained k nearest neighbor query

D1 Discrete Mathematics The Travelling Salesperson problem. The Nearest Neighbour Algorithm The Lower Bound Algorithm The Tour Improvement Algorithm

Continuous Skyline Queries for Moving Objects

Scribes: Po-Hsuan Wei, William Kuzmaul Editor: Kevin Wu Date: October 18, 2016

Intro to Contemporary Math

Nearest Neighbor Search with Keywords: Compression

Greedy. Outline CS141. Stefano Lonardi, UCR 1. Activity selection Fractional knapsack Huffman encoding Later:

Examination paper for TDT4120 Algorithms and Data Structures

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

Decision Mathematics D1

Algorithm Design and Analysis

First Lemma. Lemma: The cost function C h has the ASI-Property. Proof: The proof can be derived from the definition of C H : C H (AUVB) = C H (A)

Minimizing the Number of Tardy Jobs

Linear-Time Algorithms for Finding Tucker Submatrices and Lekkerkerker-Boland Subgraphs

Transcription:

Temporal and Spatial Data Management Fall 0 Query Processing in Spatial Network Databases SL06 Spatial network databases Shortest Path Incremental Euclidean Restriction Incremental Network Expansion Spatial Network Databases (SNDB)/ Definition (Spatial network databases) In a spatial network database objects can move only on pre-defined trajectories as specified by the underlying network (representing e.g., roads, railways, rivers, etc.) The distance between two objects is the shortest trajectory between the two rather than the Eucledian distance Query Find the hotels within a km range returns {a, b, c} Query Find the closest hotel returns {b} Eucledian nearest neighbor is d (which is the farest in the network) TSDM, SL06 /9 M. Böhlen, ifi@uzh Spatial Network Databases (SNDB)/ Definition (Network distance) For each edge connecting n i and n j, the network distance, d N (n i, n j ), is stored with the edge. For nodes n i and n j that are not directly connected, the network distance, d N (n i, n j ), is the length of the shortest path from n i to n j. Euclidean Lower-Bound Property: For any two nodes, the Euclidean distance, d E (n i, n j ), lower bounds the network distance, d N (n i, n j ), i.e., d E (n i, n j ) d N (n i, n j ) TSDM, SL06 /9 M. Böhlen, ifi@uzh Shortest Path Much of the work on spatial network databases is on shortest path, nearest neighbor and range search. Dijkstra s incremental network expansion is a greedy algorithm and the most basic solution to the shortest path problem. Dijkstra s algorithm influenced much of the later work in spatial network databases. Starting point: directed weighted graph G = (V, E) with weight function W : E R Weight of path p = v v... v k is w(p) = k i= w(v i, v i+ ) Shortest path = a path of minimum weight (cost) TSDM, SL06 3/9 M. Böhlen, ifi@uzh TSDM, SL06 4/9 M. Böhlen, ifi@uzh

Shortest Path Problems Optimal Substructure Single-source Find a shortest path from a given source vertex s to all other vertices. Single-pair Given two vertices, find a shortest path between them. Solution to single-source problem solves this problem efficiently, too. All-pairs Find shortest-paths for every pair of vertices. Dynamic programming algorithm. Theorem: Subpaths of shortest paths are shortest paths Proof: if some subpath were not the shortest path, one could substitute the shorter subpath and create a shorter total path a b c d e f Unweighted shortest-paths BFS. TSDM, SL06 /9 M. Böhlen, ifi@uzh Shortest Path Tree TSDM, SL06 6/9 M. Böhlen, ifi@uzh Relaxation The result of the algorithms is a shortest path tree. For each vertex v it records a shortest path from the start vertex s to v v.pred is the predecessor of v in this shortest path v.dist is the shortest path length from s to v For each vertex v in the graph, we maintain v.dist, the estimate of the shortest path from s. It is initialized to at the start. Relaxing an edge (u,v) means testing whether we can improve the shortest path to v found so far by going through u. 9 6 6 TSDM, SL06 /9 M. Böhlen, ifi@uzh TSDM, SL06 8/9 M. Böhlen, ifi@uzh

Dijkstra s Algorithm Dijkstra s Algorithm Basic idea of Dijkstra s algorithm: maintains a set S of solved vertices at each step select closest vertex u, add it to S, and relax all edges from u Greedy algorithm that gives optimal solution Similar to breadth-first search (if all weights = then one can simply use BFS) Use a priority queue Q with keys v.dist, which is re-organized whenever some dist decreases foreach u G.V do u.dist := ; u.pred := NIL; s.dist := 0; init(q, G.V) // priority queue Q; while isempty(q) do u := extractmin(q); foreach v u.adj do Relax(u, v, G); modifykey(q, v); TSDM, SL06 9/9 M. Böhlen, ifi@uzh TSDM, SL06 0/9 M. Böhlen, ifi@uzh 0 0 0 3 9 4 6 3 9 4 6 3 9 4 6 Q = {s(0, ), u(, ), u(, ), u(, ), u(, )} Q = {x(, s), u(0, s), v(, ), y(, )} Q = {y(9, u)} 0 0 0 3 9 4 6 3 9 4 6 3 9 4 6 Q = {y(, x), u(8, x), v(4, x)} Q = {u(8, x), v(3, x)} Q = {} TSDM, SL06 /9 M. Böhlen, ifi@uzh TSDM, SL06 /9 M. Böhlen, ifi@uzh

Nearest Neighbors in SNDB Definition Given a source point q and an entity dataset S, a k-nearest neighbor (knn) query retrieves the k ( ) objects of S closest to q according to the network distance. S = {a, b, c, d} -NN is {b} -NN is {b, a} Incremental Euclidean Restriction (IER)/ Applies the Euclidean distance to reduce the search space in combination with the Euclidean lower bound Basic idea for -NN search Retrieve the Euclidean NN pe using an incremental knn algorithm on the R-tree built on S Compute the network distance dn (q, p E ) Due to the lower-bound property, objects closer to q should be within Euclidean distance d Emax = d N (q, p E ) (shaded area in figure below). The second Euclidean NN, p E, is retrieved with d N (q, p E ) < d N (q, p E ); thus p E becomes the new NN and d Emax = d N (q, p E ). Repeat last step until no more Eulidean NN is found in search region. TSDM, SL06 3/9 M. Böhlen, ifi@uzh Incremental Euclidean Restriction (IER)/ {p,..., p k } = Euclidean_NN(q, k); foreach entity p i do d N (q, p i ) = compute_nd(q, p i ); Sort {p,..., p k } in ascending order of d N (q, p i ); d Emax = d N (q, p k ); repeat (p, d E (q, p)) = next_euclidean_nn(q); if d N (q, p) < d N (q, p k ) then Insert p in {p,..., p k }; d Emax = d N (q, p k ); until d N (q, p) > d Emax ; TSDM, SL06 4/9 M. Böhlen, ifi@uzh Incremental Euclidean Restriction (IER)/3 IER performs well if Euclidean distance is similar to network distance; otherwise, many Euclidean NNs are inspected before the network NN. The nearest entity to query point q is the entity p The subscripts in p,..., p are in ascending order of d(q, p i ) p will be examined after p,..., p 4, since it has the largest Euclidean distance TSDM, SL06 /9 M. Böhlen, ifi@uzh TSDM, SL06 6/9 M. Böhlen, ifi@uzh

Incremental Network Expansion (INE)/ Performs network expansion starting from query point q and examines entities in the order they arrive Nodes not yet explored are stored in a queue Q which is sorted according to the network distance from q Locate the edge (n, n ) that covers q and add n and n to the queue; Q = {(n, 3), (n, )}. No entity is on (n, n ), and the closest node n is expanded; Q = {(n, ), (n, )} No entity is on (n, n ) and n is expanded; Q = {(n 4, 8), (n 3, 9), (n, )} p is discoverd on (n, n 4 ) d N (q, p ) = provides a bound to restrict the search space TSDM, SL06 /9 M. Böhlen, ifi@uzh Incremental Network Expansion (INE)/ Algorithm: INE(q, k) n i n j = find_segment(q); S cover = find_entities(n i n j ); {p,..., p k } = the k network nearest entities in S cover ; Sort {p,..., p k } in ascending order of d N (q, p i ); if p k then d Nmax = d N (q, p k ) ; else d Nmax = ; Q = (n i, d N (q, n i )), (n j, d N (q, n j )) ; De-queue the node n in Q with the smallest d N (q, n); while d N (q, n) < d Nmax do foreach non-visited adjacent node n x of n do S cover = find_entities(n x n); Update {p,..., p k } from {p,..., p k } S cover ; d Nmax = d N (q, p k ); En-queue (n x, d N (q, n x )); De-queue next node n in Q; TSDM, SL06 8/9 M. Böhlen, ifi@uzh Summary Network databases consider the street network, which constrains the positions and movements of objects. The Euclidean distance lower bounds the network distance. Most network expansion algorithms are based on Dijkstra s shortest path algorithm. Incremental Euclidean Restriction (IER) Incremental Network Expansion (INE) The addition of schedules (start and end times, multimodal networks) complicates network algorithms significantly. TSDM, SL06 9/9 M. Böhlen, ifi@uzh