CircularTrip: An Effective Algorithm for Continuous kNN Queries Muhammad Aamir Cheema Database...

14
CircularTrip: An Effective Algorithm for Continuous kNN Queries Muhammad Aamir Cheema Database Research Group, The School of Computer Science and Engineering, University of New South Wales (UNSW), Sydney Joined work with: Yidong Yuan (UNSW), Xuemin Lin (UNSW)

Transcript of CircularTrip: An Effective Algorithm for Continuous kNN Queries Muhammad Aamir Cheema Database...

CircularTrip: An Effective Algorithm for Continuous kNN Queries

Muhammad Aamir Cheema

Database Research Group, The School of Computer Science and Engineering,

University of New South Wales (UNSW), Sydney

Joined work with: Yidong Yuan (UNSW), Xuemin Lin (UNSW)

Problem Settings

Given a query point q, continuously report k nearest objects of q according to Euclidean distance

Objects and query points move in an unpredictable fashion

Objects and query points can be indexed in main memory

Related Work Divide space into conceptual rectangles Initialize heap with first level rectangles and cq

For top entry e in heap unless mindist(e,q) > distk; If e is rectangle, enheap all cells in e If e is cell; check objects in it

Conceptual Partitioning: An efficient Method for Continuous nearest neighbor monitoringKyriakos Mouratidis, Marios Hadjieleftheriou, Dimitris Papadias

[SIGMOD 2005]

MotivationsData Point Updates

If a NN moves away, the new answer cannot lie inside the circle

All the shaded cells are visited

Ideally, the update should start from the cells that intersect the circle

Motivations

Rectangles do not approximate circles very wellAll the cells in any rectangle Rec are inserted in heap when r becomes greater than mindist(Rec,q)

All cells in the four rectangles are enheaped. Ideally, only the cells that intersect the circle should be enheaped

How to find all the cells that intersect a given circle? CircularTrip

CircularTrip Let n be the number of cells that intersect the circle, CircularTrip computes mindist of exactly n cells

r

kNN Initial Computation r=0, distk = ∞ (distk = distance of kth NN) Repeat unless r ≥ distk

Call CircularTrip with radius Min(r=r+ δ, distk) (δ= cell width) Insert returned cells into heap according to ascending order of their mindist from q For each cell c in heap

If mindist(c,q) ≥ distk

RETURN RESULTS Find points in c and update distk and q.kNN accordingly

q

p1

p2

r

r = δr = 2.δ r = dist(p1,q)

distk= ∞distk= dist(p1,q)distk= dist(p2,q)

q.kNN = p1q.kNN = Φq.kNN = p2

Continuous Monitoring

q

p2

p1

Incoming objects: any non-result object p entering inside the circle Insert p into q.kNN

Outgoing objects: any result object leaving the circle delete p from q.kNN

Hanlde all the object updates as mentioned above

Case 1: q.kNN contains k or more than k objects Keep k closest objects and discard other

Case 2: q.kNN contains less than k objects Same as initial computation except the

starting radius is distk

distk

Experiments Objects/queries moving on the road map of German city Oldenburg (Brinkhoff Generator) Number of objects = 100,000 Number of queries = 5000 Object agility= 50% (number of objects reporting update at each timestamp) Query agility= 30% Grid size = 256 X 256 (i.e., δ = 1/256 )

Effect of δ

Experiments

Effect of k

Experiments

Effect of N and n

N = number of objects

n = number of queries

Experiments

Effect of object agility and speed

Questions

Space Usage

CPM stores visit list and heap for each query