Professional Documents
Culture Documents
We have covered:
• interval trees for point queries
• mappings to higher dim. space for
interval range queries
I
queries
2 report all intervals that intersect I.
I
queries
3. report all intervals that contain I
I
interpretation
Project on x-y axes;
J contains I iff
J has larger x-coordinate and larger y-coordinate than I
J’
J
interpretation
J contains I iff
J has larger x-coordinate and larger y-coordinate than I
J’
J’ dominates I’
J’ I’ dominates k’
k’ I’
the relation dominance
is transitive, so
J’ dominates k’
direct dominance
We say that J’ directly dominates I’
if J’ dominates I’ and should J’ dominate some k’ then
I’ dominates k’ or I’ and k’ are not related via the dominance relation
J’
k’ I’
the relation direct
dominance
k’ is not transitive!
Dominance/Direct Dominance
• As a result:
– the number of dominance pairs in direct
dominance is linear
– the number of dominance pairs in relation
dominance can be quadratic
– Dominance pairs are the transitive closure of
direct dominance i.e., each pair in the direct
dominance relation is taken to be in
dominance and then we build transitive
closure.
determining dominance pairs
4
1
2
6
1 2 3 4 5 6
determining dominance pairs
1. sort the points by one of the coordinates
say x-coordinate
(3,6,2,1,4,5)
3
1 2 3 4 5 6
Dominance via permuations
We can now easily see that:
i dominates k iff
1. i > k and
2. П = (.., Пk , …, Пi )
i.e., Пi appears Пk after in П
determining dominance pairs
(3,6,2,1,4,5)
5
is a compact representation
of dominance!
4 That is linear space
1 for a possibly quadratic
relation.
2
You can also get direct
6 dominance by looking for
the first number appearing
after a given entry that
3
is larger than the entry.
1 2 3 4 5 6
back to 1-d
1-d range search for points can be
answered in O(log n + outputsize) with
linear space
query
range queries
1 2 3 4 5 6
half-open range queries
I. the balanced binary tree search component
1 2 3 4 5 6
query
half-open range queries
I. balanced binary tree search
II. each internal node has a 1-d range tree of all
elements in its subtree
1 2 3 4 5 6
query
range queries
find the nodes closest to the
root that cover all nodes
of the x-range for the query
in each of these perform
a range query on the y-coordinates
query time:
O(log n) * O(log n) + O(output) =
O(log2 n + output)
storage: O( n log n)
1 2 3 4 5 6
query
half-open range queries
report points
2,4 and 5
1 2 3 4 5 6 7 8
half-open range queries
I. Build a balanced binary
search tree on the
100 x-coordiantes as keys
1 2 3 4 5 6 7 8
Priority Search Tree
(McCreight)
Heap 100
on y-values 80 40
70 50 20 30
60 - - - - - - -
[ y-values 70 50 20 80 100 40 30 60 ]
x1 x2 x3 x4 x5 x6 x7 x8
half-open range queries can be solved
in linear space and O(log n + outputsize)
report points
2,4 and 5
1 2 3 4 5 6 7 8
range queries can be solved through
two half-open range queries
report points
2 and 4
1 2 3 4 5 6 7 8
Range queries through half-open range
queries Important note: this requires
Intersecting the outputs of both
half-open range queries,
thus NOT output sensitive.
+∞ query output: 2,4,5
-∞ query output: 2,3,4
output: 2 and 4
1 2 3 4 5 6 7 8
Point location problems
cont’d
• We discussed the O(n) point location
algorithm based on Jordan’s Theorem.
• We will be discussing three methods which
allow preprocessing and then faster point
location.
• Note: point location in planar subdivision or
polygons is a key task and a step in many
algorithms.
Point location methods
1. Slab method
2. Chain decomposition
3. Kirkpatrick
Slab Method
• Consider a planar subdivision
• In a preprocessing step we
construct horizontal slab through each of
the vertices of the subdivision.
Slab Method
Slab Method
query
Total cost for query
query
Total cost for preprocessing
Theorem: The slab method requires O(n2) storage and preprocessing time.
query
Total cost for preprocessing
Theorem: The slab method requires O(n2) storage and preprocessing time.
∑si = O(n2)
O(n2) preprocessing time
Note: Brute force preprocessing O(n2)
Alternate method use plane sweep method in O(n log n + output)
∑si = O(n2)
Pros and Cons of Slab Method
- storage quadratic
- preprocessing time
Chain decomposition
• This method improves on the previous in
terms of storage and preprocessing time.
• However, we pay for this with increased
query time.
Chain decomposition
• The idea is to partition the planar
subdivsion edges into a set of chains.
• These chains will all be monotonic in the
y-direction.
• This allows for binary search between
chains.
2 Chains point location
• Consider two chains that are monotonic
and that have a common highest and
lowest vertex.
(We actually assume
that the chains are going
to infinity on both ends.)
2 Chains point location
• Consider two chains that are monotonic
and that have a common highest and
lowest vertex.
In O(log n) time we can
determine if a query point
falls inside or outside the
polygon formed by these two
chains.
2 Chains point location
• We do this by performing two separate
location tests: one against the left and one
against the right
chain.
2 Chains point location
• Each test is using the left-turn/right-turn
primitive.
2 Chains point location
• Assume, for a moment, that the planar
subdivision is partitioned into
a monotonic (in y)
polygons.
Chain decomposition
We aim for the following properties for that
partitioning:
4
2 3
6 3
Chain decomposition
in the second phase (bottom-up) 1
we make sure that the number of 1 1
chains on each vertex matches 1
1
in both directions.
1 1
1 1 1
2
1 2
3
1 2
2 3
1 3
6
Chain decomposition
6
in the second phase (bottom-up) 31
we make sure that the number of 1 1
2
chains on each vertex matches 1
2 1
in both directions.
1 1
1 1 1
2
1 2
3
1 2
2 3
1 3
6 6
Query using chains
6
Once we have the chain decomposition, 31
we can carry out two nested binary 1 1
2
searches: 1
2 1
one over the chains the other
for each chains (left/right of chain) 1 1
1 1 1
2
The query then takes:
1 2
O( log2 n) time. 3
1 2
2 3
1 3
6 6
Regularization
Finally, we need to guarantee that all
vertices are regular.
This is done by a procedure called
regularization. Regularization is useful
for other problems too.
it is visible
it is visible
Theorem: In O(log2 n) time, after O(n log n) preprocessing and linear storage,
point location queries in planar subdivisions on n vertices can be answered.
To obtain linear storage one must store the chains in such a manner as to
avoid storing multiple chains sharing an edge.
Kirkpatrick complexity
The best method is due to Kirkaptrick. Optimal is preprocessing, storage and
query.
see class