Algorithms on grids - PowerPoint PPT Presentation

About This Presentation
Title:

Algorithms on grids

Description:

Geometry Seminar: Algorithms on Grids. 4. Grids for geometric proximity ... Algorithm: Insert points into the grid. If cell(p) contains more than. 9 points, ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 18
Provided by: natasha46
Category:
Tags: algorithms | grids

less

Transcript and Presenter's Notes

Title: Algorithms on grids


1
Algorithms on grids
  • Natasha Gelfand

Geometry Seminar Fall 2006
2
Grids in computer science
3
Grids in computer science
  • Graphics and vision
  • Collision detection, point location
  • Simulation

4
Grids for geometric proximity
  • Isolate and localize interesting events
  • Proximity is local
  • Uniform grids
  • Closest pair, k-Minimum enclosing disk
  • Adaptive grids
  • quadtrees

5
Closest pair
  • Given n points in the plane
  • Return pair of pointsrealizing

6
Grids for points
  • Computing the grid takes linear time

7
Sub-problem
  • Given a set P and a distance r, verify in linear
    time if CP(P)ltr or CP(P) gt r
  • Insert points sequentially
  • If CP(P) lt r, p, q are in the same
    orneighboring cells
  • Can we search a cellin constant time?

8
Algorithm
  • If some cell contains more than 9 points, then
    CP(P)ltr
  • Algorithm
  • Insert points into the grid
  • If cell(p) contains more than 9 points, return
    CP(P) lt r

9
Algorithm
  • If some cell contains more than 9 points, then
    CP(P)ltr
  • Algorithm
  • Insert points into the grid
  • If cell(p) contains more than 9 points, return
    CP(P) lt r
  • Otherwise, compute
  • Constant time per point,running time O(n)

r
10
Closest pair
  • Permute points Pltp1, p1, , pngt
  • Let ri CP(p1, , pi)
  • Can check if riltri-1 in linear time
  • Good case ri ri-1
  • Grid is already built, check in O(1) time
  • Bad case ri lt ri-1
  • Rebuild grid, O(i) time
  • Trivial bound O(nk), when closest pair changes k
    times

11
Analysis
  • Let Xi 1 if ri ri-1, and 0 otherwise
  • Running time

12
Analysis
  • Bound PrXi 1 Prri lt ri-1
  • Likelihood that pi realizes CP(Pi)
  • Expected running time

13
k-Enclosing minimum disk
  • Disk of minimum radius that contains k points
  • Brute force O(nk)
  • 2-Opt algorithm r(P,k) 2ropt(P,k)

k4
k3
14
Non-uniform grid
  • Partition P into horizontal strips with at most
    k/4 points in each strip
  • Recursive median partitioning
  • O(n/k) strips

Running time T(n) n 2T(n/2) Stop at n lt
k/4 O(nlog(n/k))
G
15
Finite centers
  • Claim Dopt(P,k) contains at least one
    intersection point of G
  • Pf By contradiction

k/4 points
k/4 points
Dopt(P,k)
k points
At most k/2 points
16
Algorithm
  • For each grid intersection point g2G
  • Compute smallest circle centered at p with k
    points
  • k-th order statistic of p, g
  • Expected time O(n)
  • Return the best of (n/k)2 candidates
  • Running time O(n(n/k)2)

17
Correctness
  • 2-Opt r(P,k) 2ropt(P,k)
Write a Comment
User Comments (0)
About PowerShow.com