380 likes | 402 Views
Continuous Nearest Neighbor Monitoring in Road Networks K. Mouratidis 1 Joint work with: M.L. Yiu 2 , D. Papadias 3 , N. Mamoulis 2 1 School of Information Systems, Singapore Management University 2 Dept. of Computer Science, University of Hong Kong
E N D
Continuous Nearest Neighbor Monitoring in Road Networks K. Mouratidis1 Joint work with: M.L. Yiu2, D. Papadias3, N. Mamoulis2 1 School of Information Systems, Singapore Management University 2 Dept. of Computer Science, University of Hong Kong 3 Dept. of Computer Science, Hong Kong Uni. of Science & Technology
Introduction The k-NN problem: Given a query point q and a set of objects P, find the k objects in P that are closest to q.
Introduction Continuous NN monitoring: Long-running queries demand constant update of their results. Existing methods are designed for Euclidean spaces. Consider a road network(where edge weights correspond to their length, or travel time). Queries and objects move in the network. Network distance: the length (i.e., sum of weights) of the shortest path connecting them. (Example: taxi – pedestrians)
Introduction Continuous NN monitoring in a Road Network: Queries and objects move in an unpredictable manner in the network, issuing an update whenever they move Network edges issue weight updates Central server processes the stream of updates, and continuously reports the k NNs of each query according to network distance Aim: to minimize the query processing time
Related Work Snapshot NN in road networks: e.g., Papadias et al. VLDB’03, Kolahdouzan and Shahabi VLDB’04 - Static data objects, One-time results Path NN in road networks: Cho and Chung VLDB’05, Kolahdouzan and Shahabi STDBM’04 - Staticdata objects, Known query trajectory Euclidean NN monitoring: Yu et al. ICDE’05, Xiong et al. ICDE’05, Mouratidis et al. SIGMOD’05 Grid index: cannot capture network-imposed constraints Circles/rectangles: no mapping to network distance space Do not deal with edge updates
Incremental Monitoring (IMA) and Group Monitoring (GMA) Algorithms Two methods (IMA, GMA) for: monitoring NNs according to network distance, with low CPU cost. Edges: indexed with a quadtree. We store with each edge (i) the objects in it, and (ii) an influence list. Queries: For each query we store its current NNs, and its expansion tree.
IMA: Initial NN computation Initial result (k=3): expansion tree, infl. intervals, and marks Only updates affecting the expansion tree can alter the result! Store q in influence lists of affecting edges
IMA: Object updates (Case 1) Outgoing no more than incoming NNs: update result + shrink expansion tree
IMA: Object updates (Case 1) New (shrunk) expansion tree
IMA: Object updates (Case 2) More outgoing than incoming: re-compute from marks + expand tree
IMA: Object updates (Case 2) New (grown) expansion tree
IMA: Query updates Re-compute starting from valid tree marks
IMA: Multiple concurrent updates Order of updates: Decreasing edge weights Increasing edge weights Query movement Object updates For each affected query q NN set= k best among remaining NNs and incomers Expand from marks in valid expansion tree
GMA: Main idea Sequence: path between consecutive intersection or terminal nodes The k-NN set of any query in sequence s is in the union of (i) the objects in s, (ii) the k-NNs of its intersection nodes (endpoints).
GMA: Main idea (example) Objects on sequence between n1 and n5 = {p4, p5} 2-NNs of intersection n1 = {p1, p5} 2-NNs of intersection n5 = {p3, p2} 2-NNs of q1 or q2 {p4, p5} {p1, p5} {p3, p2}
GMA: Active nodes active node: intersection node of nonempty sequence GMA monitors the k-NNs of active nodes (using IMA), and uses them to compute the NNs of the actual user queries GMA reduces CPU time by shared execution among queries in the same sequence reduction from NN monitoring of moving queries to NN monitoring of static active nodes.
GMA: Update processing Initial Result: utilizing active node NNs NN Maintenance: In every processing cycle do: Update NNs of active nodes with IMA. If NNs of active node n change, re-compute affected queries in sequences adjacent to n If object/edge updates occur in sequence s, re-compute affected queries within sequence s Re-compute moving queries
Sample experimental results N=100K, k=50, fobj=fqry=10%, fedg=4% Competitor: no previous work. OVH: re-computes from scratch.
Sample experimental results n=5K, N=100K, k=50, fobj=10%, fedg=4%
Sample experimental results n=5K, N=100K, k=50, fobj=fqry=10%
Sample experimental results n=5K, N=100K, fobj=fqry=10%, fedg=4%
Summary First work on NN monitoring in road networks. - No assumption about query/object moving patterns - Edge weights fluctuate We propose two methods: IMA: incremental NN maintenance GMA: query grouping - shared execution GMA is faster and requires less space.
4. Road-CNN (IMA) Incremental Monitoring Algorithm (Uobj, Uqry, Uedg) For each query q in Uqry that moves outside q.tree Delete q from the influence lists of affecting edges ; Discard q.tree and q.best_NN For each edge e in Uedg with decreasing weight For each query q in e.IL Delete invalid part of q.tree ;Remove q from invalid inf. lists ; Remove invalid NNs Update distances of nodes in valid part of q.tree ;Update the distances of NNs in valid q.tree For each edge e in Uedg with increasing weight For each query q in e.IL (same as lines 5, 6) For each query q in Uqry that moves inside q.tree (same as lines 5, 6) For each object p in Uobj Delete p from its old edge ; Insert p into its new edge For each query affected by p Treat p as outgoing, incoming, or moving NN For each query q affected in lines 1, 4, 8, 9, 12 q.best_NN = k best objects among remaining NNs and incomers Insert into min-heap H the marks of the valid q.tree If head of H has key < distance of the kth object in q.best_NN Consider all nodes in the valid q.tree as verified ; Perform NN search initializing heap to H If necessary, shrink q.tree ; Update influence lists accordingly
4. Road-CNN (GMA) Four events may alter NNs of a query q in s: (i) movement of q, (ii) changes in the NN sets of active nodes of s, (iii) object updates in s, and (iv) edge updates in s. Group Monitoring Algorithm (Uobj, Uedg, Qins, Qdel) For each query q in Qins (Qdel) Insert (delete) q in the corresponding edge ; Update n.k for active nodes of containing sequence Invoke IMA for active nodes, taking into account changes in n.k For each node n whose result changed in line 3 Mark as affected each query in n.Q influenced by n For each update <p.id, pold, pnew> in Uobj For each query q in old (new) sequence that is affected by pold (pnew) Mark q as affected For each edge e in Uedg //Let s be the sequence containing e Mark as affected each query in s that is affected by e For each query q marked as affected or in Qins Compute q.best_NN from scratch (utilizing active node NN sets)