Point Location. Preprocess a planar, polygonal subdivision for point location queries. p = (18, 11)


 Felicia Richard
 1 years ago
 Views:
Transcription
1 Point Location Prerocess a lanar, olygonal subdivision for oint location ueries. = (18, 11) Inut is a subdivision S of comlexity n, say, number of edges. uild a data structure on S so that for a uery oint = (x, y), we can find the face containing fast. Imortant metrics: sace and uery comlexity.
2 The Slab Method Draw a vertical line through each vertex. This decomoses the lane into slabs. In each slab, the vertical order of line segments remains constant. s5 D D s4 C C s3 s s1 Partition into slabs Slab 1 If we know which slab = (x, y) lies, we can erform a binary search, using the sorted order of segments.
3 The Slab Method To find which slab contains, we erform a binary search on x, among slab boundaries. second binary search in the slab determines the face containing. s5 D D s4 C C s3 s s1 Partition into slabs Slab 1 Thus, the search comlexity is O(log n). ut the sace comlexity is Θ(n ).
4 Otimal Schemes There are other schemes (kdtree, uadtrees) that can erform oint location reasonably well, they lack theoretical guarantees. Most have very bad worstcase erformance. inding an otimal scheme was challenging. Several schemes were develoed in 70 s that did either O(log n) uery, but with O(n log n) sace, or O(log n) uery with O(n) sace. Today, we will discuss an elegant and simle method that achieved otimality, O(log n) time and O(n) sace [D. Kirkatrick 83]. Kirkatrick s scheme however involves large constant factors, which make it less attractive in ractice. Later we will discuss a more ractical, randomized otimal scheme.
5 Kirkatrick s lgorithm Start with the assumtion that lanar subdivision is a triangulation. If not, triangulate each face, and label each triangular face with the same label as the original containing face. If the outer face is not a triangle, comute the convex hull, and triangulate the ockets between the subdivision and CH. Now ut a large triangle abc around the subdivision, and triangulate the sace between the two. a b c
6 Modifying Subdivision y Euler e formula, the final size of this triangulated subdivision is still O(n). This transformation from S to triangulation can be erformed in O(n log n) time. a b c If we can find the triangle containing, we will know the original subdivision face containing.
7 Hierarchical Method Kirkatrick s method is hierarchical: roduce a seuence of increasingly coarser triangulations, so that the last one has O(1) size. Seuence of triangulations T 0, T 1,..., T k, with following roerties: 1. T 0 is the initial triangulation, and T k is just the outer triangle abc.. k is O(log n). 3. Each triangle in T i+1 overlas O(1) triangles of T i. Let us first discuss how to construct this seuence of triangulations.
8 uilding the Seuence Main idea is to delete some vertices of T i. Their deletion creates holes, which we retriangulate. u v Vertex deletion and re triangulation We want to go from O(n) size subdivision T 0 to O(1) size subdivision T k in O(log n) stes. Thus, we need to delete a constant fraction of vertices from T i. critical condition is to ensure each new triangle in T i+1 overlas with O(1) triangles of T i.
9 Indeendent Sets Suose we want to go from T i to T i+1, by deleting some oints. Kirkatrick s choice of oints to be deleted had the following two roerties: [Constant Degree] Each deletion candidate has O(1) degree in grah T i. If has degree d, then deleting leaves a hole that can be filled with d triangles. When we retriangulate the hole, each new triangle can overla at most d original triangles in T i. u v Vertex deletion and re triangulation
10 Indeendent Sets [Indeendent Sets] No two deletion candidates are adjacent. This makes retriangulation easier; each hole handled indeendently. u v Vertex deletion and re triangulation
11 I.S. Lemma Lemma: Every lanar grah on n vertices contains an indeendent vertex set of size n/18 in which each vertex has degree at most 8. The set can be found in O(n) time. We rove this later. Let s use this now to build the triangle hierarchy, and show how to erform oint location. Start with T 0. Select an ind set S 0 of size n/18, with max degree 8. Never ick a, b, c, the outer triangle s vertices. Remove the vertices of S 0, and retriangulate the holes. Label the new triangulation T 1. It has at most 17 18n vertices. Recursively build the hierarchy, until T k is reduced to abc. The number of vertices dros by 17/18 each time, so the deth of hierarchy is k = log 18/17 n 1 log n
12 Illustration n k o y z T m j l i c d b e h 0 1 a f g T x v w r u s t T 3 H J I T E C G D T4 (not shown) K T 4 H I J T 3 C D E G T r s t u v w x y z T 1 a b c d e f g h i j k l m n o T 0
13 The Data Structure Modeled as a DG: the root corresonds to single triangle T k. The nodes at next level are triangles of T k 1. Each node for a triangle in T i+1 has ointers to all triangles of T i that it overlas. To locate a oint, start at the root. If outside T k, we are done (exterior face). Otherwise, set t = T k, as the triangle at current level containing. T n k o m j h g l i a c d f 0 1 b e T y z x v w u t r s T 3 H J I T G E D C T4 (not shown) K T 4 H I J T 3 C D E G T r s t u v w x y z T 1 a b c d e f g h i j k l m n o T 0
14 The Search H J I E G D C x y w v u r s z t n m k j l i a c d b e o h g f K H I J C D E G r s t u v w x y z a b c d e f g h i j k l m n o Check each triangle of T k 1 that overlas with t at most 6 such triangles. Udate t, and descend the structure until we reach T 0. Outut t.
15 nalysis H J I G E D C y z x v w u t r s n o m k j h g l i a c d f b e K H I J C D E G r s t u v w x y z a b c d e f g h i j k l m n o Search time is O(log n) there are O(log n) levels, and it takes O(1) time to move from level i to level i 1. Sace comlexity reuires summing u the sizes of all the triangulations. Since each triangulation is a lanar grah, it is sufficient to count the number of vertices. The total number of vertices in all triangulations is n ( 1 + (17/18) + (17/18) + (17/18) 3 + ) 18n. Kirkatrick structure has O(n) sace and O(log n) uery time.
16 inding I.S. We describe an algorithm for finding the indeendent set with desired roerties. Mark all nodes of degree 9. While there is an unmarked node, do 1. Choose an unmarked node v.. dd v to IS. 3. Mark v and all its neighbors. lgorithm can be imlemented in O(n) time kee unmarked vertices in list, and reresenting T so that neighbors can be found in O(1) time. v
17 I.S. nalysis Existence of large size, low degree IS follows from Euler s formula for lanar grahs. triangulated lanar grah on n vertices has e = 3n 6 edges. Summing over the vertex degrees, we get deg(v) = e = 6n 1 < 6n. v We now claim that at least n/ vertices have degree 8. Suose otherwise. Then n/ vertices all have degree 9. The remaining have degree at least 3. (Why?) Thus, the sum of degrees will be at least 9 n + 3n = 6n, which contradicts the degree bound above. So, in the beginning, at least n/ nodes are unmarked. Each chosen v marks at most 8 other nodes (total 9 counting itself.) Thus, the node selection ste can be reeated at least n/18 times. So, there is a I.S. of size n/18, where each node has degree 8.
18 Traezoidal Mas randomized oint location scheme, with (exected) uery O(log n), sace O(n), and construction time O(n log n). The exectation does not deend on the olygonal subdivision. The bounds holds for any subdivision. It aears simler to imlement, and its constant factors are better than Kirkatrick s. The algorithm is based on traezoidal mas, or decomositions, also encountered earlier in triangulation.
19 Traezoidal Mas Inut a set of nonintersecting line segments S = {,,..., s n }. Query: given oint, reort the segment directly above. The region label can be easily encoded into the line segments. Ma is created by shooting a ray vertically from each vertex, u and down, until a segment is hit. In order to avoid degeneracies, assume that no segment is vertical. The resulting rays lus the segments define the traezoidal ma.
20 Traezoidal Mas Enclose S into a bounding box to avoid infinite rays. ll faces of the subdivision are traezoids, with vertical sides. Size Claim: If S has n segments, the ma has at most 6n + 4 vertices and 3n + 1 tras. Each vertex shoots one ray, each resulting in two new vertices, so at most 6n vertices, lus 4 for the outer box. The left boundary of each traezoid is defined by a segment endoint, or lower left corner of enclosing box. The corner of box acts as leftoint for one tra; the right endoint of any segment also for one tra; and left endoint of any segment for at most traezoids. So total of 3n + 1.
21 Construction Plane swee ossible, but not helful for oint location. Instead we use randomized incremental construction. Historically, invented for randomized segment intersection. Point location an intermediate roblem. Start with outer box, one traezoid. Then, add one segment at a time, in an arbitrary, not sorted, order. / s / / i efore fter inserting s
22 Construction Let S i = {,,..., s i } be first i segments, and T i be their traezoidal ma. Suose T i 1 built, and we add s i. ind the traezoid containing the left endoint of s i. Defer for now: this is oint location. Walk through T i 1, identifying traezoids that are cut. Then, fix them u. ixing u means, shoot rays from left and right endoints of s i, and trim the earlier rays that are cut by s i. / s / / i efore fter inserting s
23 nalysis Observation: inal structure of tra ma does not deend on the order of segments. (Why?) Claim: Ignoring oint location, segment i s insertion takes O(k i ) time if k i new traezoids created. Proof: Each endoint of s i shoots two rays. dditionally, suose s i interruts K existing ray shots, so total of K + 4 rays need rocessing. If K = 0, we get exactly 4 new traezoids. or each interruted ray shot, a new traezoid created. With DCEL, udate takes O(1) er ray. efore fter
24 Worst Case In a worstcase, k i can be Θ(i). This can haen for all i, making the worstcase run time n i=1 i = Θ(n ). Using randomization, we rove that if segments are inserted in random order, then exected value of k i is O(1)! So, for each segment s i, the exected number of new traezoids created is a constant. igure below shows a worstcase examle. How will randomization hel? n/ + 1 n 1 n/
25 Randomization Theorem: ssume,,..., s n is a random ermutation. Then, E[k i ] = O(1), where k i traezoids created uon s i s insertion, and the exectation is over all ermutations. Proof. 1. Consider T i, the ma after s i s insertion.. T i does not deend on the order in which segments,..., s i were added. 3. Reshuffle,..., s i. What s the robability that a articular s was the last segment added? 4. The robability i/i. 5. We want to comute the number of traezoids that would have been created if s were the last segment. s The traezoids that deend on s The segments that the traezoid deends on.
26 Proof Say traezoid deends on s if would be created by s if s were added last. Want to count traezoids that deend on each segment, and then find the average over all segments. Define δ(, s) = 1 if deends on s; otherwise, δ(, s) = 0. s The traezoids that deend on s The exected comlexity is E[k i ] = 1 ix s S i The segments that the traezoid deends on. Xδ(, s) T i Some segments create a lot of traezoids; others very few. X X Switch the order of summation: E[k i ] = 1 δ(, s) i s S i T i
27 Proof s The segments that the traezoid The traezoids that deend on s deends on. Now we are counting number Xof segments X each traezoid deents on. E[k i ] = 1 δ(, s) i s S i T i This is much easier each deends on at most 4 segments. To and bottom of defined by two segments; if either of them added last, then comes into existence. Left and right sides defined by two segments endoints, and if either one added last, is created. Thus,Ps S δ(, s) 4. i T i X has O(i) traezoids, so E[k i ] = = i i 4 T i = 1 O(i) = O(1). i T i End of roof.
28 Point Location Like Kirkatrick s, oint location structure is a rooted directed acyclic grah. To uery rocessor, it looks like a binary tree, but subtree may be shared. Tree has two tyes of nodes: xnode: contains the xcoordinate of a segment endoint. (Circle) ynode: ointer to a segment. (Hexagon) leaf for each trazedoid. 1 C D 1 E G 1 C D 1 E G
29 Point Location Children of xnode corresond to oints lying to the left and right of x coord. Children of ynode corresond to sace below and above the segment. ynode searched only when uery s xcoordinate is within segment s san. Examle: uery in region D. 1 C D 1 E G 1 C D 1 E G Encodes the tra decomosition, and enables oint location during the construction as well.
30 uilding the Structure Incremental construction, mirroring the traezoidal ma. When a segment s added, modify the tree to account for changes in traezoids. Essentially, some leaves will be relaced by new subtrees. Like Kirkatrick s, each old traezoid will overla O(1) new traezoids. 1 C D 1 E G 1 C D 1 E G Each traezoid aears exactly once as a leaf. or instance,.
31 dding a Segment Consider adding segment s 3. 1 C D 1 E G 1 C D 1 E G K 1 1 s I 1 s N L M H J H 1 1 s 3 s 3 3 s 3 s 3 3 M N I J K L
32 dding a Segment Changes are highly local. If segment s asses entirely through an old traezoid t, then t is relaced by two tras t, t. During search, we need to comare uery oint to s to decide above/below. So, a new ynode added which is the arent of t and t. If an endoint of s lies in t, then we add a xnode to decide left/right and a ynode for the segment. K 1 1 s I 1 s N L M H J H 1 1 s 3 s 3 3 s 3 s 3 3 M N I J K L
33 nalysis Sace is O(n), and uery time is O(log n), both in exectation. Exected bound deends on the random ermutation, and not on the choice of inut segments or the uery oint. The data structure size number of traezoids, which is O(n), since O(1) exected number of tras created when a new segment inserted. In order to analyze uery bound, fix a uery. We consider how moves incrementally through the traezoidal ma as new segments are inserted. Search comlexity number of traezoids encountered by.
34 Search nalysis Let i be traezoid containing after insertion of ith segment. If i = i 1 then new insertion does not affect s traezoid. (E.g. and s 3 s insertion.) If i i 1, then new segment deleted s traezoid, and needs to locate itself among the (at most 4) new tras. could fall 3 levels in the tree. E.g. C falling to J after s 3 s insertion. K 1 1 s I 1 s N L M H J H 1 1 s 3 s 3 3 s 3 s 3 3 M N I J K L
35 Search nalysis Let P i be robability that i i 1, over all random ermutation. Since can dro 3 levels, exected search ath length is n i=1 3P i. We will show that P i 4/i. That will imly that exected search ath length is n n 4 3 i = 1 1 = 1 ln n i i=1 i=1 Why is P i 4/i? Use backward analysis. The traezoid i deends on at most 4 segments. The robability that ith segment is one of these 4 is at most 4/i. 1 C D 1 E G 1 C D 1 E G
36 inal Remarks Exectation only says that average search ath is small. It can still have large variance. The traezoidal ma data structure has bounds on variance too. See the textbook for comlete analysis. Theorem: or any λ > 0, the robability that deth of the randomized seach structure exceeds 3λ ln(n + 1) is at most (n + 1) λ ln More careful analysis can rovide better constants for the data structure.
Lectures on the Dirichlet Class Number Formula for Imaginary Quadratic Fields. Tom Weston
Lectures on the Dirichlet Class Number Formula for Imaginary Quadratic Fields Tom Weston Contents Introduction 4 Chater 1. Comlex lattices and infinite sums of Legendre symbols 5 1. Comlex lattices 5
More informationBranchandPrice for Service Network Design with Asset Management Constraints
BranchandPrice for Servicee Network Design with Asset Management Constraints Jardar Andersen Roar Grønhaug Mariellee Christiansen Teodor Gabriel Crainic December 2007 CIRRELT200755 BranchandPrice
More informationBeyond the F Test: Effect Size Confidence Intervals and Tests of Close Fit in the Analysis of Variance and Contrast Analysis
Psychological Methods 004, Vol. 9, No., 164 18 Coyright 004 by the American Psychological Association 108989X/04/$1.00 DOI: 10.1037/108989X.9..164 Beyond the F Test: Effect Size Confidence Intervals
More informationIntroductory Number Theory
Introductory Number Theory Course No. 100 331 Sring 2006 Michael Stoll Contents 1. Very Basic Remarks 2 2. Divisibility 2 3. The Euclidean Algorithm 2 4. Prime Numbers and Unique Factorization 4 5. Congruences
More informationPRIME NUMBERS AND THE RIEMANN HYPOTHESIS
PRIME NUMBERS AND THE RIEMANN HYPOTHESIS CARL ERICKSON This minicourse has two main goals. The first is to carefully define the Riemann zeta function and exlain how it is connected with the rime numbers.
More informationElementary Number Theory: Primes, Congruences, and Secrets
This is age i Printer: Oaque this Elementary Number Theory: Primes, Congruences, and Secrets William Stein November 16, 2011 To my wife Clarita Lefthand v vi Contents This is age vii Printer: Oaque this
More informationComputing the Most Probable String with a Probabilistic Finite State Machine
Comuting the Most Probable String with a Probabilistic Finite State Machine Colin de la Higuera Université de Nantes, CNRS, LINA, UMR6241, F44000, France cdlh@univnantesfr Jose Oncina De de Lenguajes
More informationGroup lending, local information and peer selection 1
Journal of Develoment Economics Ž. Vol. 60 1999 7 50 www.elsevier.comrlocatereconbase Grou lending, local information and eer selection 1 Maitreesh Ghatak ) Deartment of Economics, niõersity of Chicago,
More informationSizeConstrained Weighted Set Cover
SizeConstrained Weighted Set Cover Lukasz Golab 1, Flip Korn 2, Feng Li 3, arna Saha 4 and Divesh Srivastava 5 1 University of Waterloo, Canada, lgolab@uwaterloo.ca 2 Google Research, flip@google.com
More information28 ClosestPoint Problems 
28 ClosestPoint Problems  Geometric problems involving points on the plane usually involve implicit or explicit treatment of distances
More informationOPRE 6201 : 2. Simplex Method
OPRE 6201 : 2. Simplex Method 1 The Graphical Method: An Example Consider the following linear program: Max 4x 1 +3x 2 Subject to: 2x 1 +3x 2 6 (1) 3x 1 +2x 2 3 (2) 2x 2 5 (3) 2x 1 +x 2 4 (4) x 1, x 2
More informationWHICH SCORING RULE MAXIMIZES CONDORCET EFFICIENCY? 1. Introduction
WHICH SCORING RULE MAXIMIZES CONDORCET EFFICIENCY? DAVIDE P. CERVONE, WILLIAM V. GEHRLEIN, AND WILLIAM S. ZWICKER Abstract. Consider an election in which each of the n voters casts a vote consisting of
More informationStoring a Collection of Polygons Using Quadtrees
Storing a Collection of Polygons Using Quadtrees HANAN SAMET University of Maryland and ROBERT E. WEBBER Rutgers University An adaptation of the quadtree data structure that represents polygonal maps (i.e.,
More informationOutOfCore Algorithms for Scientific Visualization and Computer Graphics
OutOfCore Algorithms for Scientific Visualization and Computer Graphics Course Notes for IEEE Visualization 2002 Boston, Massachusetts October 2002 Organizer: Cláudio T. Silva Oregon Health & Science
More informationMining Data Streams. Chapter 4. 4.1 The Stream Data Model
Chapter 4 Mining Data Streams Most of the algorithms described in this book assume that we are mining a database. That is, all our data is available when and if we want it. In this chapter, we shall make
More informationFindTheNumber. 1 FindTheNumber With Comps
FindTheNumber 1 FindTheNumber With Comps Consider the following twoperson game, which we call FindTheNumber with Comps. Player A (for answerer) has a number x between 1 and 1000. Player Q (for questioner)
More information
Number Theory Naoki Sato
Number Theory Naoki Sato 0 Preface This set of notes on number theory was originally written in 1995 for students at the IMO level. It covers the basic background material
More informationAlgorithms for Designing PopUp Cards
Algorithms for Designing PopUp Cards Zachary Abel Erik D. Demaine Martin L. Demaine Sarah Eisenstat Anna Lubiw André Schulz Diane L. Souvaine Giovanni Viglietta Andrew Winslow Abstract We prove that every
More informationSUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by
SUBGROUPS OF CYCLIC GROUPS KEITH CONRAD 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by g = {g k : k Z}. If G = g, then G itself is cyclic, with g as a generator. Examples
More informationAn efficient reconciliation algorithm for social networks
An efficient reconciliation algorithm for social networks Nitish Korula Google Inc. 76 Ninth Ave, 4th Floor New York, NY nitish@google.com Silvio Lattanzi Google Inc. 76 Ninth Ave, 4th Floor New York,
More informationRobust Set Reconciliation
Robust Set Reconciliation Di Chen 1 Christian Konrad 2 Ke Yi 1 Wei Yu 3 Qin Zhang 4 1 Hong Kong University of Science and Technology, Hong Kong, China 2 Reykjavik University, Reykjavik, Iceland 3 Aarhus
More informationThe Set Data Model CHAPTER 7. 7.1 What This Chapter Is About
CHAPTER 7 The Set Data Model The set is the most fundamental data model of mathematics. Every concept in mathematics, from trees to real numbers, is expressible as a special kind of set. In this book,
More informationIEEE TRANSACTIONS ON INFORMATION THEORY 1. The Smallest Grammar Problem
IEEE TRANSACTIONS ON INFORMATION THEORY 1 The Smallest Grammar Problem Moses Charikar, Eric Lehman, April Lehman, Ding Liu, Rina Panigrahy, Manoj Prabhakaran, Amit Sahai, abhi shelat Abstract This paper
More informationFigure 2.1: Center of mass of four points.
Chapter 2 Bézier curves are named after their inventor, Dr. Pierre Bézier. Bézier was an engineer with the Renault car company and set out in the early 196 s to develop a curve formulation which would
More informationRate adaptation, Congestion Control and Fairness: A Tutorial. JEANYVES LE BOUDEC Ecole Polytechnique Fédérale de Lausanne (EPFL)
Rate adaptation, Congestion Control and Fairness: A Tutorial JEANYVES LE BOUDEC Ecole Polytechnique Fédérale de Lausanne (EPFL) September 12, 2014 2 Thanks to all who contributed to reviews and debugging
More informationRevised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)
Chapter 23 Squares Modulo p Revised Version of Chapter 23 We learned long ago how to solve linear congruences ax c (mod m) (see Chapter 8). It s now time to take the plunge and move on to quadratic equations.
More informationTOPOLOGY: THE JOURNEY INTO SEPARATION AXIOMS
TOPOLOGY: THE JOURNEY INTO SEPARATION AXIOMS VIPUL NAIK Abstract. In this journey, we are going to explore the so called separation axioms in greater detail. We shall try to understand how these axioms
More informationIf A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?
Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question
More informationThe Backpropagation Algorithm
7 The Backpropagation Algorithm 7. Learning as gradient descent We saw in the last chapter that multilayered networks are capable of computing a wider range of Boolean functions than networks with a single
More informationSubset feedback vertex set is fixed parameter tractable
Subset feedback vertex set is fixed parameter tractable Marek Cygan Marcin Pilipczuk Michał Pilipczuk Jakub Onufry Wojtaszczyk Abstract The FEEDBACK VERTEX SET problem, given an undirected graph G and
More information