CS591: Computational Geometry Lecture Three - October 8, 2004 Lecturer: Shang-Hua Teng Scribe: Vladimir Rydzevsky Delaunay Triangulation (continued) Given a set of points: P={p1...pn} build DT DT0 DT1 DT2 …. DTi-1 DTi … DTn Algorithm for i-th step: 1. Locate (pi, DTi-1) 2. Split triangle that contains pi (the only triangle that gets destroyed is the one containing pi) 3. Flip Complexity depends on the number of flips and time for insertion of new triangles. We will now examine algorithm for point location in 2D triangulations. This analysis will help us determine the complexity of Randomized DT Algorithm. Point Location in 2D triangulations Given a triangulation {V, E, F} build a query structure to answer the following: having a query point p return the triangle that contains p. To answer this query we will use Kirpatrick structures (David Kirkpatrick). To construct Kirkpatrick structure, we start with T0 , and repeatedly select an independent set of vertices of degree at most 12. We never include the three vertices a, b, and c (forming the outer face) in such an independent set. We delete the vertices from the independent set from the graph, and retriangulate the resulting holes. Observe that each triangle in the new triangulation can overlap at most 12 triangles in the previous triangulation. Since we can eliminate a constant fraction of vertices with each stage, after O(log24/23n) stages, we will be down to the last 3 vertices. Algorithm: I – independent set I= While unmarked vertex of degree < 12 Choose an arbitrary vertex of degree < 12 Put it in I Mark all of its neighbors Return I O(log24/23n) stages can be derived using the following reasoning: Euler’s formula: |V| - |E| + |F| = 2 => |E| < 3|V| => Average degree < 6 => at least half of vertices of degree 12. Therefore, there exists independent set of vertices 1 23 with degree < 12, i.e. , having reduction rate 24 24 The constant factors here are not so great. With each stage, the number of vertices falls by a factor of 24/23. To reduce to the final three vertices, implies that (24/23) k = n or that k = log24/23n 24 lg n The data structure is based on this decomposition. The root of the structure corresponds to the single triangle of Tk The nodes at the next lower level are the triangles of Tk-1 , followed by Tk-2, until we reach the leaves, which are the triangles of our initial triangulation, T0. Each node for a triangle in triangulation Ti+1 , stores pointers to all the triangles it overlaps in Ti (there are at most 12 of these). Note that this structure is a directed acyclic graph (DAG) and not a tree, because one triangle may have many parents in the data structure. This is shown in the following figure. To locate a point, we start with the root, Tk . If the query point does not lie within this single triangle, then we are done (it lies in the exterior face). Otherwise, we search each of the (at most 12) triangles in Tk-1 that overlap this triangle. When we find the correct one, we search each of the triangles in Tk-2 that overlap this triangle, and so forth. Eventually we will find the triangle containing the query point in the last triangulation, T0, and this is the desired output. See the figure below for an example. Randomized Algorithm for Delaunay Triangulation We now come back from the detour and examine the randomized algorithm for DT. We will consider: space O(n). locate O(log n). time to build query structure O(nlogn) since space complexity is O(n) and locate is O(logn) Space Using linearity of expectations pairs of random variables x,y E(x+y) = E(x) + E(y) We can observe that each insertion produces 3 new triangles, while destroying one. Each flip produces 2 new triangles while destroying 2. Insertion Flip Lemma: The expected number of triangles we generate is 9n. (3n are generated from split) Proof: To prove this lemma we will use Backward Analysis introduced by Seidel Let DTi = DT {p-2, p-1, p0, p1, …, pi} Note that DTi is independent of the order of its vertices. Let fi be the number of flips. Note that the degree of pi in DTi is equal to fi-3. The number of new triangles introduced is equal to 2fi+3. Any vertex in the set {P1 … Pi} is equally likely to be the last vertex added. Because DTi is independent of the order of its vertices and we are using a random permutation, then looking backward: E(di) 6, it follows that E(fi) 3. Thus, the expected number of triangles produced at stage i is at most 9. Space complexity is O(9n) = O(n) Locate Now, we examine the expected complexity of Locate. We note that when we delete a point from DT, it is still DT, i.e. PkPsPt in DTi, if Pi {Pk,Ps,Pt} PkPsPt DTi-1 . Using this observation and backward analysis we can construct a hierarchical link structure: DT0 DT1 DT2 DTi- n1 n2 nj-1 1 nj to locate Pi in DTi-1, let nj be the number of links that we traverse from Dj-1 to Dj, the cost of Locate of Pi is proportional to nj . We want to know: i 1 i 1 j 1 j 1 E( nj ) f (nj ) Assume Pi PkPsPt Case 1: nj=0 if Pj { PkPsPt } otherwise Case 2: nj is proportional to the number of flips when Pj is added. 3 Using backward analysis the probability of case 1 is exactly (1- ), the probability of j 3 case 2 is j So, E(nj) = 3 9 E(fi) = . Thus, j j i 1 i -1 9 n j O(logi) j 1 j 1 j Therefore, the total time is O(logn)