Simple and Fast Nearest Neighbor Search Marcel Birn, Manuel - - PowerPoint PPT Presentation

simple and fast nearest neighbor search
SMART_READER_LITE
LIVE PREVIEW

Simple and Fast Nearest Neighbor Search Marcel Birn, Manuel - - PowerPoint PPT Presentation

Birn et al.: Nearest Neighbors 1 Simple and Fast Nearest Neighbor Search Marcel Birn, Manuel Holtgrewe, Peter Sanders , Johannes Singler Birn et al.: Nearest Neighbors 2 2D Nearest Neighbor Search Preprocess S = { ( x 1 , y 1 ) , . . . , ( x


slide-1
SLIDE 1

Birn et al.: Nearest Neighbors

1

Simple and Fast Nearest Neighbor Search

Marcel Birn, Manuel Holtgrewe, Peter Sanders, Johannes Singler

slide-2
SLIDE 2

Birn et al.: Nearest Neighbors

2

2D Nearest Neighbor Search

Preprocess S = {(x1, y1), . . . , (xn, yn)}. Query: q = (x, y) −

→ closest point in S (Euclidean distance)

slide-3
SLIDE 3

Birn et al.: Nearest Neighbors

3

Application Example

Geographic Information Systems, e.g., Route Planning

slide-4
SLIDE 4

Birn et al.: Nearest Neighbors

4

A Greedy Algorithm

Preprocessing: Delaunay Triangulation (not Yao graph etc. !) Query: Start at any point in S. Follow any edge towards q. Iterate until no improvement possible. still linear time. . .

slide-5
SLIDE 5

Birn et al.: Nearest Neighbors

5

Multiple Levels

Start with a sample of points from S. Closest point in sample → starting point in next level.

How many levels? Complicated data structure?

slide-6
SLIDE 6

Birn et al.: Nearest Neighbors

6

n Levels?

Randomly number points in S. Function nlevelNN(q)

u:= s1

for i := 1 to n do

u:= greedyNN(u, q, DT(s1..k))

return u Sounds like quadratic space and at least linear time???

1 2 3 4 5 6 7 8

slide-7
SLIDE 7

Birn et al.: Nearest Neighbors

7

Full Delaunay Hierarchy (FDH) G:= (1..n,

n

  • i=1

Ek)

where Gk = (1..k, Ek):= Delaunay triangulation of points 1..k.

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

G has a linear expected number of edges

e.g., [Guibas et al. 92].

slide-8
SLIDE 8

Birn et al.: Nearest Neighbors

8

FDH-Based n Level Search!

Procedure nn(q, {s1, . . . , sn})

u:= s1

repeat foreach neighbor v of u in G with u > v in increasing order do invariant u is nearest neighbor of q wrt 1..v − 1 if ||q − sv||2 < ||q − su||2 then

u:= v

break for loop until no improvement found return u

1 2 3 4 5 6 7 8

slide-9
SLIDE 9

Birn et al.: Nearest Neighbors

9

Analysis

Theorem: Expected number of nodes visited ≤ ln n + 1 Proof Idea: si is visited

⇔si is closest to q wrt 1..i.

This event has probability 1/i.

harmonic sum claim.

i

slide-10
SLIDE 10

Birn et al.: Nearest Neighbors

10

Bad Inputs

# of inspected edges might be Ω (n)

slide-11
SLIDE 11

Birn et al.: Nearest Neighbors

11

Implementation

Store coordinates redundantly in edge array.

Scan logarithmic number of pieces. Never worse than greedy scanning algorithm.

1 2 3 4 5 6 7 8

1 2 3 4 5 6 7 8

4(6,0) 4(6,0) 7(8,0) 6(5,0) 8(3,0) 6(5,0) 3(2,0) 8(3,0) 2(7,0) 5(1,0)

x: #:

2 3 4 1 q=(2.8, 0)

slide-12
SLIDE 12

Birn et al.: Nearest Neighbors

12

Other Approaches

Delaunay Hierarchy kd−Tree Voronoi Diagram

  • ptimal

+point location in practice implementation? [CGAL, Mount et al.] currently preferred [Devillers92] relatively complicated

slide-13
SLIDE 13

Birn et al.: Nearest Neighbors

13

Instances

[Devillers02]

5% 95% in square

  • n circle

mixed

  • n parabola
slide-14
SLIDE 14

Birn et al.: Nearest Neighbors

14

Experiments: Square

0.1 1 10 128 512 211 213 215 217 219 221 223 time per query [µs] number of points (n) CGAL Delaunay hierarchy FDH exact ANN kd-tree CGAL kd-tree FDH array, inexact

slide-15
SLIDE 15

Birn et al.: Nearest Neighbors

15

Experiments: Circle (parabola similar)

0.1 1 10 100 1000 104 128 512 211 213 215 217 219 221 223 time per query [µs] number of points (n) ANN kd-tree CGAL Delaunay hierarchy CGAL kd-tree FDH, exact FDH, inexact

slide-16
SLIDE 16

Birn et al.: Nearest Neighbors

16

Experiments: Mixed

0.1 1 10 100 1000 128 512 211 213 215 217 219 221 223 time per query [µs] number of points (n) ANN kd-tree CGAL Delaunay hierarchy CGAL kd-tree FDH, exact FDH, inexact

slide-17
SLIDE 17

Birn et al.: Nearest Neighbors

17

More Related Work Several n-level geom. data structures on more complex objects

(triangles. . . ) and for point location. [BoissonatTeillaud86], [Guibas et al. 92],. . .

Contraction Hierarchies – route planning with n levels

[Geisberger et al. 2008]

n-level Graph Partitioning [with Vitaly Osipov]

slide-18
SLIDE 18

Birn et al.: Nearest Neighbors

18

Conclusions

Full Delaunay Hierarchies

(mostly) fast simple elegant

slide-19
SLIDE 19

Birn et al.: Nearest Neighbors

19

Open Problems Comparison with worst case efficient algorithms Make worst case efficient,

e.g., replace high degree nodes? move high degree nodes in hierarchy?

Higher Dimensions??? More n-level algorithms?