Efficient Partition Trees Jiri Matousek Presented By Benny Schlesinger Omer Tavori 1.
-
Upload
kathleen-poole -
Category
Documents
-
view
213 -
download
0
Transcript of Efficient Partition Trees Jiri Matousek Presented By Benny Schlesinger Omer Tavori 1.
1
Efficient Partition TreesJiri Matousek
Presented ByBenny Schlesinger
Omer Tavori
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
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.
4
Half plane query example
5
How do we solve the simplex range searching problem? We will use
Partitions Trees
6
Partitions Trees vs. Cutting Trees Query Time Storage Construction
TimeData Structure
Cutting Trees
Partitions Trees 2/1nO nO nO
nO 3log 2nO 2nO
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
8
Simplicial Partition
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.
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.
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)
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.
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
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
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 :
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.
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
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
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.
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
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
2
1
1,0 00 hwhk
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.)
23
Lemma 1: Constructing A (1/ri)-cutting
W (h) = 2
24
Lemma 1: Constructing A (1/ri)-cutting
W (h) = 2
25
Lemma 1: Constructing A (1/ri)-cutting
W (h) = 2
26
Lemma 1: Constructing A (1/ri)-cutting
W (h) = 2
27
Lemma 1: Constructing A (1/ri)-cutting
W (h) = 2
28
Lemma 1: choosing iW (h) = 2
29
Lemma 1: choosing iW (h) = 2
30
Lemma 1: choosing iW (h) = 2
31
Lemma 1: Updating The WeightsW (h) = 4
32
Lemma 1: Constructing a new Cutting
33
Lemma 1: Constructing a new Cutting
34
Lemma 1: Constructing a new Cutting
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
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
37
Creating The Partition Algorithm
.4
hw2set 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
P
Set
r
nPHitionCreatePart
i
i
i
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
39
Lemma 1: Finding The Crossing Number Of The Partition
H
HSince
Hqwhwhhx
hThe
rrhh
rr
r
r
rHq
x
r
wgestimationby partition the
ofnumber crossing thefindcan wewlog x
wlogloglog2log
.2 toequal
isnumber x crossing with Hh line a of weight w
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
H
Let
41
Lemma 1: Finding The Crossing Number Of The Partition
ii
i
iiii
iiii
iiiiii
ii
ii
rHw
cuttingFrom
Hw
HwHwHw
HwHwHw
HwHwHwHw
So
hwhwFor
hwhw
/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
42
Lemma 1: Finding The Crossing Number Of The Partition
rHOHwk
Bouding
jH
irHHw
xTaking
irHHw
s
nrsinnHHSince
n
sHw
rHwH
r
r
i
r
jr
r
ir
i
ii
ii
loglog
:obtainfinally weintegral,by sumlast the
1log
1loglog
:get we x)ln(1 inequality theusing and logarithms
11
,, w
11
1w
0 1
1
0
o
1i
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
rs
nOk03
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.
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
rOrs
nOrO
46
Lemma 2Test-Set Lemma
( ) ( ){ }
2
1 1
0
For an n-point set and a parameter there exists
a 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 r
Q 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
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.
48
Test-Set Lemma – proof( )Let us look at , the collection of lines
dual to the points of .
P
P
D
( )1
So, now we are looking at the dual plane where points
have become lines. [the green ones]
According to previous results, for the dual plane, there is
a -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 points
as promised by the cutting-lemma).
P
r
r
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 points
in the dual plane to lines in the primal plane)
V
Q V
· X
=D
We would like to show that this has the desired
property we are looking for.
So, let be any line (in the primal plane) and let
be the set of vertices of a triangle of containing
the 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 the
simplicial partition .
h
G k
·
P
D
50
( )
( )
So... how many simplices of remain that are crossed
by the line but by no line of ?
These triangles must all be completelty contained
in the zone of in the arrangement of . Thus,
this zone
i
h G
h G
· P
· D
D
D
must also contain the points of their corresponding
classes in its interior.
By properties of the duality transform, it stems that
any point of lying in the interior of the zone of in
the arrangem
iP
P h
·
( )ent of dualizes to a line of
intersecting the interior of the triangle .
Now why is that?
G H
D
D
Test-Set Lemma (cont.)
( )
( )
[The zone of in the arrangement of :
is all of the faces (or cells) that runs through
in the arrangement of .]
h G
h
G
D
D
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.
52
Primal Plane – Dual Plane
* *
* *
*
The duality transform preserves:
Incidence:
A point on the line in the primal plane
translates to the point on the line
in the dual plane. (and vice versa)
order: lies above
p l l p
p l
l p
p l l
· Î Û Î
· Û *lies above p
53
Test-Set Lemma (cont.)( )
( )
There are at most such lines in (by property
of the cutting ). Hence the zone of contains
no more than this many points of There are
at most simplices of completely contained
in the z
nr
ns r
H
h
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 simplices
are crossed by the triangle , hence the result.
ns r
h G
h O
G
k×·
×
+D
( )
(there are at least points in each class as
we have taken, thus, indeed there are at the most
simplices as described).
i
ns r
s P
×
Application
54
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.
Select In Half-PlaneAlgorithm (cont. in more detail)
56
If (the set of points) contains only one point, , the partition tree
consists of a single leaf where is stored explicitly.
The set is the canonical subset of the leaf.
Otherwise, the structure i
S p
p
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 correspondence
with the tria
r
r
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 S
t
S
n n
n
( )
( )
( )
is denoted S(v). The child is the root of a recursively defined
partition tree on the set .
With each child we store the triangle . We also store information
about the subset ; for half-pl
S
t
S
n
n
n
n n
n
·
T
( )
ane range counting this information
is the cardinality of , but for other applications we may want
to store other information.
S n
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 subsets
of the nodes in .
In other words, is a set of nodes whose canonical subsets
are disjoint, and such that
The selected nodes are exactly the nodes with
S h S
nn
n
¡
· ¡
·Î ¡
Ç = 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 summing
the cardinalities of the
t h
t h
h
n n
m n m
Ì
Ì
·
selected canonical subsets.
( ) ( )
( ) ( )( )( )
( )( )
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.
2l
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 i
d
nd
r
£ + × ×
é ù£ + × × + × ×ê úë û
Þ ×
= ×
×= Þ ( ) ( ) ( ) ( ) ( )
( ) ( ) ( )
( ) ( )
( )( ) ( )( )
( ) ( )( )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
22
ns
r=
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 n
n S
n
of a tree is linear
in the number of leaves of that tree, when each internal node has
degree of at least 2 (such as in our case - each node with its own
partition).
Pre-process time
( )
For a constant (or bounded by a constant), a simplicial partition
as in the Partition-theorem can be constructed in time .
r
O n
( )
Let's verify that it is so, by going through the proof of the
Partition-theorem.
For the Test-set lemma, the cutting required is done
in time.
In the proof of the first lemma the collection has
a co
O n
Q
·
·( )
( )
nstant number of lines, and we make only 1
steps and only deal with a constant number of
simplices only.
That is, steps, in each step we make a cutting, each of which
is done in time.
So, in tota
r O
r
O n
=
·
( )l we have time.O n