efficient partition trees jiri matousek

60
Efficient Partition Trees Jiri Matousek Presented By Benny Schlesinger Omer Tavori 1

Upload: helia

Post on 25-Feb-2016

51 views

Category:

Documents


3 download

DESCRIPTION

Efficient Partition Trees Jiri Matousek. Presented By Benny Schlesinger Omer Tavori. Simplex Range Searching. Simplex range searching: We preprocess a set P of n points in so that, given any query region  , the points in P   can be counted or reported efficiently. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Efficient Partition Trees Jiri Matousek

1

Efficient Partition TreesJiri Matousek

Presented ByBenny Schlesinger

Omer Tavori

Page 2: Efficient Partition Trees Jiri Matousek

2

Simplex Range Searching• Simplex range searching: We preprocess

a set P of n points in so that, given any query region , the points in P can be counted or reported efficiently.

• Let's assume that the query region is a simple polygon; if it is not, we can always approximate it (by triangulation).

2R

Page 3: Efficient Partition Trees Jiri Matousek

3

Simplex Range Searching

• We have arrived at the triangular range searching problem: given a set P of n points in the plane, count the points from P lying in a query triangle delta.

• Let’s first look at a simpler version of this problem, where the query triangle degenerates into a half plane (simply a query line).

• Extending the simpler version to the original problem is just looking at 3 lines.

Page 4: Efficient Partition Trees Jiri Matousek

4

Half plane query example

Page 5: Efficient Partition Trees Jiri Matousek

5

How do we solve the simplex range searching problem? We will use

Partitions Trees

Page 6: Efficient Partition Trees Jiri Matousek

6

Partitions Trees vs. Cutting Trees Query Time Storage Construction

TimeData Structure

Cutting Trees

Partitions Trees 2/1nO nO nO

nO 3log 2nO 2nO

Page 7: Efficient Partition Trees Jiri Matousek

7

Partitioning Point Sets

• A simplicial partition for a set P of n points in the plane is a collection :=where the Pi are disjoint subsets of P whose union is P and i is a triangle containing Pi. The subsets Pi are called classes.

• We do not require the triangles to be disjoint.

rrPP ,,,, 11

Page 8: Efficient Partition Trees Jiri Matousek

8

Simplicial Partition

Page 9: Efficient Partition Trees Jiri Matousek

9

Simplicial Partition

• We say that a line h crosses a triangle if h intersects the interior of .

• A crossing number of a line h with respect to is the number of triangles crossed by h.

• In our example the crossing number of h is 2.

Page 10: Efficient Partition Trees Jiri Matousek

10

Simplicial Partition

• The crossing number of is the maximum crossing number over all possible lines.In the last figure you can find lines that intersect four triangles, but no line intersects all five.

Page 11: Efficient Partition Trees Jiri Matousek

11

Fine Simplicial Partition

• We say that a simplicial partition is fine if s |Pi|< 2s for a given s.

In fine simplicial partitions none of the classes contains more than twice the average numberof points of the classes.

(If there are r classes and n points The average number of points in class is n/r = s)

Page 12: Efficient Partition Trees Jiri Matousek

12

Simplicial Partition

• If a triangle , of the partition is not crossed by the line h, then its class p, either lies completely in h, or it is completely disjoint from h (i.e. either completely above or below the line)

• In our example, if we queried with l+, the half-plane lying above l, we would have to recourse on two of the five classes.

Page 13: Efficient Partition Trees Jiri Matousek

13

The Partition Theorem

• It is always possible to find a simplicial partition with crossing number

• The partition Theorem: For a set P of n points in the plane, and a parameter r with 1 r n , a fine simplicial partition of size r and crossing number can be constructed in time O(n).

rO

rO

Page 14: Efficient Partition Trees Jiri Matousek

14

-Cutting

• cutting : A cutting is a collection of closed triangles with disjoint interiors, whose union is the whole plane. The size of a cutting is the number of its triangles.

• -cutting: Let H be a collection of n lines and let be a cutting. For a triangle , let denote the collection of lines of H intersecting . A cutting is an -cutting for H provided that

H

nH

Page 15: Efficient Partition Trees Jiri Matousek

15

-cutting for weighted collection of lines

• A weighted collection of lines is a pair (H, w), where H is a collection of lines andis a weight function .

• A Cutting is an -cutting for (H,w), provided that, for every triangle : HwHw

RHW :

Page 16: Efficient Partition Trees Jiri Matousek

16

The Partition Theorem

• In order to prove the partition theorem will use two lemmas.

• In the first lemma we will use the cutting theorem. Let us remind what is the cutting theorem.

Page 17: Efficient Partition Trees Jiri Matousek

17

The cutting theorem

rnO

rOrnr

in computed becan cutting The

. size of cutting-/1 a exists there,

parameter a and linesk of collectionany For 2

Page 18: Efficient Partition Trees Jiri Matousek

18

Lemma 1

Let P be an n-point set in , let s be an integer parameter, 2 s < n, set r = n/s.and let H be a set of lines. Then there exists a simplicial partition for P, whose classes Pi satisfy s |Pi| < 2s for every i and that the crossing number of every line of H relative to is HrO log

2R

Page 19: Efficient Partition Trees Jiri Matousek

19

Lemma 1: Building the Partition

• We inductively construct the disjoint sets Pi and i.

• Suppose that P1,…Pi have already been constructed and set Pi'=Pi-(P1,…, Pi)

• If |Pi|' < 2s we set Pi+1 = Pi' , i+1 = R2. m = i+1 and := {(P1, 1),…,(Pm, m)}which finishes the construction.

• Otherwise Let ni = |Pi'| >= 2s.

Page 20: Efficient Partition Trees Jiri Matousek

20

Lemma 1: Finding a cutting using weights

How do we find Pi+1 and i+1?We will find them by building a cutting for weighted collection of lines.

For a line h H let ki(h) denote the number of triangles among 1,…, i (the triangles that are already in the partition) that are crossed by h.For every h H let .we also define a weighted collection (H,wi).

hki

ihw 2

Page 21: Efficient Partition Trees Jiri Matousek

21

Lemma 1: Finding a cutting using weights

At the first iteration:

h H

Notice that if a line h intersects i-1 at the next iteration:

hwhw

hkhk

ii

ii

1

1

21

1,0 00 hwhk

Page 22: Efficient Partition Trees Jiri Matousek

22

Lemma 1: Finding a cutting using weights

The intuition: While building the cutting we will try to avoid constructing triangles that are crossed by lines with “heavy” weights. (One of these triangles will be chosen to be a triangle in the simplicial partition.)

Page 23: Efficient Partition Trees Jiri Matousek

23

Lemma 1: Constructing A (1/ri)-cuttingW (h) = 2

Page 24: Efficient Partition Trees Jiri Matousek

24

Lemma 1: Constructing A (1/ri)-cuttingW (h) = 2

Page 25: Efficient Partition Trees Jiri Matousek

25

Lemma 1: Constructing A (1/ri)-cuttingW (h) = 2

Page 26: Efficient Partition Trees Jiri Matousek

26

Lemma 1: Constructing A (1/ri)-cuttingW (h) = 2

Page 27: Efficient Partition Trees Jiri Matousek

27

Lemma 1: Constructing A (1/ri)-cuttingW (h) = 2

Page 28: Efficient Partition Trees Jiri Matousek

28

Lemma 1: choosing iW (h) = 2

Page 29: Efficient Partition Trees Jiri Matousek

29

Lemma 1: choosing iW (h) = 2

Page 30: Efficient Partition Trees Jiri Matousek

30

Lemma 1: choosing iW (h) = 2

Page 31: Efficient Partition Trees Jiri Matousek

31

Lemma 1: Updating The WeightsW (h) = 4

Page 32: Efficient Partition Trees Jiri Matousek

32

Lemma 1: Constructing a new Cutting

Page 33: Efficient Partition Trees Jiri Matousek

33

Lemma 1: Constructing a new Cutting

Page 34: Efficient Partition Trees Jiri Matousek

34

Lemma 1: Constructing a new Cutting

Page 35: Efficient Partition Trees Jiri Matousek

35

Lemma 1: Finding Pi+1 and i+1 We want to find a triangle i+1 which will hold the class Pi+1. Don’t forget that we want at least s points in Pi+1. Currently we have ni points left.

.wH,

1/r a define us ./r

1i

1i11i

for

cuttingLetsnLet i

Page 36: Efficient Partition Trees Jiri Matousek

36

Lemma 1: Finding Pi+1 and i+1 According to the cutting theorem we know that we have a cutting with triangles. By the pigeonhole principle, One of the triangles in the cutting will have at least = s points. This triangle will be i+1. We choose some s points from i+1 to be Pi+1 in the partition.

21irO

211 / ii rn

Page 37: Efficient Partition Trees Jiri Matousek

37

Creating The Partition Algorithm

.4hw2set w(h) cross whoHhevery for 3.8

s-nn 3.7 P - PP 3.6

, 3.5 . as .P themasset and from pointes sarbitary choose 3.4

points. sleast at with Find 3.3 w).(H,for cutting-)(1/r a Find 3.2

n/s 1.3

)i ;r i 0;for(i 3.1hset w Hhevery for .2

1.),,(

i

i

ii

i

return

PSet

r

nPHitionCreatePart

i

i

i

Page 38: Efficient Partition Trees Jiri Matousek

38

Lemma 1: Finding The Crossing Number Of The Partition

• We want to show that the crossing number of every line h in H relative to our partition is:

HrO log

Page 39: Efficient Partition Trees Jiri Matousek

39

Lemma 1: Finding The Crossing Number Of The Partition

H

HSince

Hqwhwhhx

hThe

rrhh

rr

r

r

rHq

x

r

wgestimationby partition theofnumber crossing thefindcan wewlog x

wlogloglog2log

.2 toequal

isnumber x crossing with Hh line a of weight w

Page 40: Efficient Partition Trees Jiri Matousek

40

Lemma 1: Finding The Crossing Number Of The Partition

1 i

1 i

i

1 i

crossing H of lines of collection the denote H

. with w compared increases H w how consider us

Let

HLet

Page 41: Efficient Partition Trees Jiri Matousek

41

Lemma 1: Finding The Crossing Number Of The Partition

ii

i

iiii

iiii

iiiiii

ii

ii

rHwcuttingFrom

HwHwHwHw

HwHwHwHwHwHwHw

SohwhwForhwhw

/Hw:clear that isit 1/r a of definition the

1

2

: linesother the

,2 Hh line aFor

1i

i

11

11

111

1

11i

Page 42: Efficient Partition Trees Jiri Matousek

42

Lemma 1: Finding The Crossing Number Of The Partition

rHOHwk

Boudingj

Hir

HHw

xTakingir

HHw

snrsinnHHSince

nsHw

rHwH

r

r

i

r

jr

r

ir

i

ii

ii

loglog

:obtainfinally weintegral,by sumlast the

1log1loglog

:get we x)ln(1 inequality theusing and logarithms

11

,, w

11

1w

0 1

1

0

o

1i

Page 43: Efficient Partition Trees Jiri Matousek

43

Lemma 2: The Test Set Lemma

• For an n-point set P and a parameter r, there exists set H of at most r lines, s.t, for any simplicial partition for P satisfying |Pi| s for i, the following holds: if k0 is the maximum crossing number of lines of H relative to the partition, then the crossing number of the partition is bounded by:

2R

rsnOk03

Page 44: Efficient Partition Trees Jiri Matousek

44

The cutting theorem

Now that we can use the two lemmas we can easily prove the cutting theorem.

Given an n-point set P in the plane, an integer parameter 2 <= s < n , and r = n/s.In order to obtain the desired simplicial partition, we first use lemma 2. We get a set H of at most r lines.

Page 45: Efficient Partition Trees Jiri Matousek

45

The cutting theorem

• Second we use lemma 1, obtaining a simplicial partition , whose classes have size between s and 2s, and such that the crossing number of any line of H is at most:

• By the property of H guaranteed by the Test Set

Lemma the crossing number of is at most:

rOrHO log

rOrsnOrO

Page 46: Efficient Partition Trees Jiri Matousek

46

Lemma 2Test-Set Lemma

( ) ( ){ }

2

1 1

0

For an n-point set and a parameter there existsa set of at most lines s.t. for any simplicial partition

, ,, , for satisfying for every ,the following holds:if is the max

im m

P rQ r

PP P P s i

k

Í

D DP =

¡

K …

( )0

imum crossing numbers of lines of relative to , then the crossing number of is bounded by:

3

Q

ns r

k

P P

× + ×O

Page 47: Efficient Partition Trees Jiri Matousek

47

Test-Set Lemma (cont.)

• Why Test-Set?We will show that we can literally find a “small” set of lines as stated, that is, a test-case of lines that ensures a certain crossing number for any partition whose classes’ sizes is no less than a certain bound, s.

Page 48: Efficient Partition Trees Jiri Matousek

48

Test-Set Lemma – proof( )Let us look at , the collection of lines

dual to the points of .P

PD

( )1

So, now we are looking at the dual plane where pointshave become lines. [the green ones]According to previous results, for the dual plane, there isa -cutting, , for (the dual lines to the points r HX

2

),whose triangles have at most vertices in total for

cells (i.e. the number of intersection pointsas promised by the cutting-lemma).

Pr

r

Page 49: Efficient Partition Trees Jiri Matousek

49

Test-Set Lemma (cont.) Primal plane – Dual plane

( )

Now, let be the set of all vertices of the simplices of .and let (i.e. lines translated from these pointsin the dual plane to lines in the primal plane)

VQ V

· X=D

We would like to show that this has the desiredproperty we are looking for.So, let be any line (in the primal plane) and let be the set of vertices of a triangle of containingthe dual point

Q

h G

·

·D X

( )

0

.By the assumption, each of the 3 lines (in the primal plane)dual to the points of , crosses at most triangles of thesimplicial partition .

h

G k·

P

D

Page 50: Efficient Partition Trees Jiri Matousek

50

( )

( )

So... how many simplices of remain that are crossedby the line but by no line of ?These triangles must all be completelty containedin the zone of in the arrangement of . Thus,this zone

i

h G

h G

· P

· DD

Dmust also contain the points of their corresponding

classes in its interior.By properties of the duality transform, it stems thatany point of lying in the interior of the zone of inthe arrangem

iP

P h·

( )ent of dualizes to a line of intersecting the interior of the triangle .

Now why is that?

G HD

D

Test-Set Lemma (cont.)

( )

( )

[The zone of in the arrangement of :is all of the faces (or cells) that runs throughin the arrangement of .]

h Gh

G

D

D

Page 51: Efficient Partition Trees Jiri Matousek

51

Primal Plane – Dual Plane

h( )hD

Primal plane

Dual plane

PÎ,V GÎÎ P (the cutting)Î X

Every point in the zone of h is either above two lines and below one line (or vice-versa), thus each point corresponds (in the dual plane) to a line above two points and below one (or vice-versa), hence, cutting the triangle.

Page 52: Efficient Partition Trees Jiri Matousek

52

Primal Plane – Dual Plane

* *

* *

*

The duality transform preserves:Incidence: A point on the line in the primal planetranslates to the point on the line in the dual plane. (and vice versa)order: lies above

p l l pp l

l p

p l l

· Î Û Î

· Û *lies above p

Page 53: Efficient Partition Trees Jiri Matousek

53

Test-Set Lemma (cont.)( )

( )

There are at most such lines in (by propertyof the cutting ). Hence the zone of containsno more than this many points of There areat most simplices of completely containedin the z

n r

ns r

Hh

P

×

·X

ÞP

O

( )

( )0

one of in the arrangement of So any general line, , crosses at the most simplices and in addition, not more than 3 simplicesare crossed by the triangle , hence the result.

ns r

h Gh O

Gk

×·×

+D

( )(there are at least points in each class aswe have taken, thus, indeed there are at the most simplices as described).

ins r

s P

×

Page 54: Efficient Partition Trees Jiri Matousek

Application

54

Page 55: Efficient Partition Trees Jiri Matousek

Select In Half PlaneAlgorithm

55

This algorithm is quite simple. It merely uses the recursive nature of thePartition tree to gather all of the points that indeed lie in the query half-plane

While recursing down only in triangles that are not completely contained ineither side of the of query half-plane.

Page 56: Efficient Partition Trees Jiri Matousek

Select In Half-PlaneAlgorithm (cont. in more detail)

56

If (the set of points) contains only one point, , the partition treeconsists of a single leaf where is stored explicitly.The set is the canonical subset of the leaf.Otherwise, the structure i

S pp

S

·

· s a tree of branching degree ,where is a sufficiently large constant.(Below we shall see how r should be chosen.)The children of the root of the tree are in one-to-one correspondencewith the tria

rr

T

( )

ngles of a fine simplicial partition of size for the set .The triangle of the partition corresponding to child is denoted by .The corresponding class in is called the canonical subset of :it

r St

Sn n

n

( )

( )

( )

is denoted S(v). The child is the root of a recursively definedpartition tree on the set .With each child we store the triangle . We also store informationabout the subset ; for half-pl

St

S

n

nn

n nn

·T

( )

ane range counting this informationis the cardinality of , but for other applications we may wantto store other information.

S n

Page 57: Efficient Partition Trees Jiri Matousek

Select In Half-PlaneAlgorithm (cont. in more detail)

57

Counting the number of points: from in a query half-plane .Return a set of nodes from the partition tree ,called the selected nodes, such that the subset of points from

lying in is the dis

S h

S h

·· ¡ T

( )

joint union of the canonical subsetsof the nodes in .In other words, is a set of nodes whose canonical subsetsare disjoint, and such that

The selected nodes are exactly the nodes with

S h Sn

nn

¡· ¡

·Î ¡

Ç = U( )

( )

the property: (or, in case is a leaf, the point stored at v lies in h)

and there is no ancestor of such that .The number of points in can be computed by summingthe cardinalities of the

t h

t hh

n n

m n m

ÌÌ

· selected canonical subsets.

Page 58: Efficient Partition Trees Jiri Matousek

( ) ( )( ) ( )

( )( )( )( )

2

2 /4 /

The dominant factor in the reccurrence is: Hence, ( ) . ;but what is ?Let's denote some constant as the lower bound for the recurrence.2 l

i

i

i

i

T n r c r T n r

T n r c r r c r T n r

O c r

T n O c r id

n dr

£ + × ×é ù£ + × × + × ×ê úë û

Þ ×= ×

× = Þ ( ) ( ) ( ) ( ) ( )

( ) ( ) ( )

( ) ( )( )( ) ( )( )

( ) ( )( )log

log

log1 1log log log2 2

1 1 12 2

og log 2 log log 2 log

1 log 2 log log ; is constant and so is log log

( ) .

.

Since could

r

rr r r

rc

i ir r r r r

r r r

r r

i n

nn n n

r d n i d i n

i d n d r

i d d n O n

T n O c r O c r

c r c r c n

n n O n

r

e+

× = × Þ + = × +

Þ × - = - +¢ ¢¢Þ = + × Î

Þ = × = ×

× = × = × =

= × =

log1 be chosen, so that for any 0.c r e e< >

58

Query time AnalysisThe number

of classesMax. number of classes

recursed,by the crossing number

2 2n sr

=

Page 59: Efficient Partition Trees Jiri Matousek

The space required by the tree( )The space required by the tree is linear, i.e. storage, as

is the number of points in .

Every point in the tree occupies a leaf (i.e. there exactly leaves),and since the number of internal nodes

O nn S

n of a tree is linear

in the number of leaves of that tree, when each internal node hasdegree of at least 2 (such as in our case - each node with its ownpartition).

Page 60: Efficient Partition Trees Jiri Matousek

Pre-process time

( )

For a constant (or bounded by a constant), a simplicial partitionas in the Partition-theorem can be constructed in time .

rO n

( )

Let's verify that it is so, by going through the proof of thePartition-theorem.

For the Test-set lemma, the cutting required is donein time.In the proof of the first lemma the collection hasa co

O nQ

·

·( )

( )

nstant number of lines, and we make only 1steps and only deal with a constant number ofsimplices only. That is, steps, in each step we make a cutting, each of whichis done in time.

So, in tota

r O

rO n

=

·

( )l we have time.O n