Seidel s Trapezoidal Partitioning Algorithm

Similar documents
Merging to ordered sequences. Efficient (Parallel) Sorting. Merging (cont.)

Homework 1 Solutions CSE 101 Summer 2017

Straight-line Drawings of Outerplanar Graphs in O(dn log n) Area

= ρ. Since this equation is applied to an arbitrary point in space, we can use it to determine the charge density once we know the field.

Jackson 3.3 Homework Problem Solution Dr. Christopher S. Baird University of Massachusetts Lowell

The Substring Search Problem

Math 301: The Erdős-Stone-Simonovitz Theorem and Extremal Numbers for Bipartite Graphs

A Bijective Approach to the Permutational Power of a Priority Queue

On the ratio of maximum and minimum degree in maximal intersecting families

Stanford University CS259Q: Quantum Computing Handout 8 Luca Trevisan October 18, 2012

Capacity of Data Collection in Arbitrary Wireless Sensor Networks

Topic 4a Introduction to Root Finding & Bracketing Methods

FI 2201 Electromagnetism

Lecture 1. time, say t=0, to find the wavefunction at any subsequent time t. This can be carried out by

Relating Scattering Amplitudes to Bound States

Conducting fuzzy division by using linear programming

On intersecting a set of parallel line segments with a convex polygon of minimum area

On the ratio of maximum and minimum degree in maximal intersecting families

A Sardinas-Patterson Characterization Theorem for SE-codes

Objectives. We will also get to know about the wavefunction and its use in developing the concept of the structure of atoms.

Math 2263 Solutions for Spring 2003 Final Exam

Fractional Zero Forcing via Three-color Forcing Games

1 Explicit Explore or Exploit (E 3 ) Algorithm

Classical Worm algorithms (WA)

Positivity results for cluster algebras from surfaces

Splay Trees Handout. Last time we discussed amortized analysis of data structures

Course Updates. Reminders: 1) Assignment #10 due next Wednesday. 2) Midterm #2 take-home Friday. 3) Quiz # 5 next week. 4) Inductance, Inductors, RLC

AST 121S: The origin and evolution of the Universe. Introduction to Mathematical Handout 1

Exploration of the three-person duel

Mutual Inductance. If current i 1 is time varying, then the Φ B2 flux is varying and this induces an emf ε 2 in coil 2, the emf is

Theorem on the differentiation of a composite function with a vector argument

Handout: IS/LM Model

and Slater Sum Rule Method * M L = 0, M S = 0 block: L L+ L 2

PROBLEM SET #1 SOLUTIONS by Robert A. DiStasio Jr.

Other quantum algorithms

Lectures on Multivariable Feedback Control

Section 8.2 Polar Coordinates

CALCULUS II Vectors. Paul Dawkins

Web-based Supplementary Materials for. Controlling False Discoveries in Multidimensional Directional Decisions, with

Coordinate Geometry. = k2 e 2. 1 e + x. 1 e. ke ) 2. We now write = a, and shift the origin to the point (a, 0). Referred to

PHYS 705: Classical Mechanics. Central Force Problems I

Math 1105: Calculus I (Math/Sci majors) MWF 11am / 12pm, Campion 235 Written homework 3

Jackson 4.7 Homework Problem Solution Dr. Christopher S. Baird University of Massachusetts Lowell

Encapsulation theory: radial encapsulation. Edmund Kirwan *

ANA BERRIZBEITIA, LUIS A. MEDINA, ALEXANDER C. MOLL, VICTOR H. MOLL, AND LAINE NOBLE

PHYS 705: Classical Mechanics. Central Force Problems II

10/04/18. P [P(x)] 1 negl(n).

Physics 2A Chapter 10 - Moment of Inertia Fall 2018

Mechanics Physics 151

6 Matrix Concentration Bounds

Mechanics Physics 151

New problems in universal algebraic geometry illustrated by boolean equations

4/18/2005. Statistical Learning Theory

Positivity for cluster algebras from surfaces

Pushdown Automata (PDAs)

Problem set 6. Solution. The problem of firm 3 is. The FOC is: 2 =0. The reaction function of firm 3 is: = 2

The Solutions of the Classical Relativistic Two-Body Equation

The geometric construction of Ewald sphere and Bragg condition:

ON THE INVERSE SIGNED TOTAL DOMINATION NUMBER IN GRAPHS. D.A. Mojdeh and B. Samadi

Forest-Like Abstract Voronoi Diagrams in Linear Time

Analysis of simple branching trees with TI-92

Internet Appendix for A Bayesian Approach to Real Options: The Case of Distinguishing Between Temporary and Permanent Shocks

Surveillance Points in High Dimensional Spaces

Information Retrieval Advanced IR models. Luca Bondi

Generalized net model of the process of ordering of university subjects

Determining solar characteristics using planetary data

gr0 GRAPHS Hanan Samet

Probability Estimation with Maximum Entropy Principle

Online-routing on the butterfly network: probabilistic analysis

Three-dimensional systems with spherical symmetry

MULTILAYER PERCEPTRONS

Chem 453/544 Fall /08/03. Exam #1 Solutions

THE CONE THEOREM JOEL A. TROPP. Abstract. We prove a fixed point theorem for functions which are positive with respect to a cone in a Banach space.

Lecture 18: Graph Isomorphisms

ON INDEPENDENT SETS IN PURELY ATOMIC PROBABILITY SPACES WITH GEOMETRIC DISTRIBUTION. 1. Introduction. 1 r r. r k for every set E A, E \ {0},

Quasi-Randomness and the Distribution of Copies of a Fixed Graph

Non-Linear Dynamics Homework Solutions Week 2

A Simultaneous Routing Tree Construction and Fanout Optimization Algorithm *

arxiv: v1 [math.co] 4 May 2017

EQUI-PARTITIONING OF HIGHER-DIMENSIONAL HYPER-RECTANGULAR GRID GRAPHS

Lifting Private Information Retrieval from Two to any Number of Messages

Compactly Supported Radial Basis Functions

MATH 415, WEEK 3: Parameter-Dependence and Bifurcations

Hardness of Approximating the Minimum Distance of a Linear Code

Bounds on the performance of back-to-front airplane boarding policies

Physics 4A Chapter 8: Dynamics II Motion in a Plane

Mechanics Physics 151

FUSE Fusion Utility Sequence Estimator

7.2. Coulomb s Law. The Electric Force

Chapter 3: Theory of Modular Arithmetic 38

3.1 Random variables

The Chromatic Villainy of Complete Multipartite Graphs

Physics 2020, Spring 2005 Lab 5 page 1 of 8. Lab 5. Magnetism

Discretizing the 3-D Schrödinger equation for a Central Potential

Gaia s Place in Space

Electrostatics (Electric Charges and Field) #2 2010

Supplementary information Efficient Enumeration of Monocyclic Chemical Graphs with Given Path Frequencies

( ) [ ] [ ] [ ] δf φ = F φ+δφ F. xdx.

Chapter 5 Linear Equations: Basic Theory and Practice

Relating Branching Program Size and. Formula Size over the Full Binary Basis. FB Informatik, LS II, Univ. Dortmund, Dortmund, Germany

Transcription:

CS68: Geometic Agoithms Handout #6 Design and Anaysis Oigina Handout #6 Stanfod Univesity Tuesday, 5 Febuay 99 Oigina Lectue #7: 30 Januay 99 Topics: Seide s Tapezoida Patitioning Agoithm Scibe: Michae Godwasse Seide s Tapezoida Patitioning Agoithm Oveview A Randomized Incementa Agoithm. Idea: incementa agoithms ae usuay simpe. We buid a stuctue by adding objects one at a time. The pobem is that they often ead to poo pefomance. As a somewhat simpified exampe, suppose we buid a seach tee fo a set of keys by inseting the keys one at a time, without ebaancing. If the keys ae inseted in ode, the tee wi be unbaanced and the constuction wi take Θ(n ) time. Randomization can hep with this pobem: if we inset keys in andom ode, we expect to get a baanced seach tee in O(n og n) time. By andomizing the ode in which we add objects, we speed up the agoithm. The andomization in andomized incementa agoithms has two key popeties. Fist, the andomization is intena to the agoithm; we make no assumptions about the input. Instead, the agoithm does its own coin fips. Second, the andomization is of the Las Vegas type: the agoithm is guaanteed to give a coect answe (whateve that means in the context of the pobem), but the unning time is not guaanteed in any paticua instance. Instead, we tak about the expected unning time, based on the agoithm s intena andomization. Content of Lectue. Basic agoithm and data stuctues. Anaysis 3. Randomized Anaysis O(n og n) 4. Tacing and anaysis of it 5. Extensions

CS68: 6 Data stuctues Figue : The mappings in T(S). Let S be a set of ine segments (with the usua non-degeneacy conditions, such as no two endpoints diecty above and beow one anothe, and no vetica ine segments). Let T(S) be a tapezoida patitioning (aso caed a tapezoidation ). It shoud et us map any tapezoid τ to its bounding segments; and its hoizontay neighboing tapezoids (thee ae at most fou). These mappings ae iustated in fig.. This epesentation ets us tace a poygona cuve C though T(S) in time O( C + k), whee k is the numbe of tapezoids C intesects, povided C S =. Let Q(S) be a point ocation stuctue fo T(S). That is, given a quey point q = (q x, q y ), it aows us to detemine what tapezoid that point is in. Q(S) is a diected acycic gaph with one souce, and with one sink pe tapezoid of T(S). The intena nodes ae of two types:. X-nodes. (See fig..) When we get to these nodes, we ask, is point q to the eft o ight of a paticua X-vaue? We then banch accodingy.. Y-nodes. (See fig. 3.) Hee we ask, is point q above o beow a paticua ine? So to answe a quey (i.e. identify the tapezoid containing point q), we foow a diected path in Q(S), banching to one of the two descendants at each intena node,

CS68: 6 3 X-vaue Figue : An X-node. ine equation Figue 3: A Y-node. and stopping at a sink (i.e. a tapezoid). (See fig. 4.) Now, et e S be a segment ab (a x < b x ) such that e cosses no segment of S. Define S = S {s}. Question: How do we poduce T(S ) fom T(S), and Q(S ) fom Q(S)? See fig. 5. (Note: in this figue, we have S = {e } and the new segment is e.) The basic steps ae: inset eft endpoint, inset ight endpoint, and inset the segment between them. The fist thing to ask is, does the new segment shae an endpoint with any of the existing segments? If not, we add new vetica theads coesponding to the new endpoints. This spits tapezoid 3 into new tapezoids 5 and 6, and spits 4 into 7 and 8 (see fig. 6). But, of couse, e itsef futhe spits 6 into 9 and 0. It aso spits 7, but 7 s bottom haf is then meged with 0 (see fig. 7). We pefom simia opeations on Q(S), as shown in the figues. (Indeed, since we need Q(S) to hep us ocate tapezoids in T(S), we shoud do these opeations in paae.) Anaysis of unning time The unning time has two pats:

4 CS68: 6 T(S) Q(S) e 4 e 4 3 3 (x-coodinate vaues) Figue 4: An exampe of a tapezoida patitioning T(S), and the coesponding point ocation stuctue Q(S). e 4 e 3 Figue 5: Adding a new segment. quey time, i.e. point ocation in Q(S); and tacing time though the tapezoids in T(S), incuding the time to pefom spitting and meging opeations. Now, the tacing time is O() pus a tem popotiona to the numbe of theads in the new patitioning that abut upon e. Note that this does not incude the theads unning though the endpoints; fo instance, the segment in fig. 8 has ony one thead abutting on it.

CS68: 6 5 e 7 8 e 5 6 e 7 8 5 6 Figue 6: Intemediate stage in adding a segment e 9 8 e 5 0 e e 8 5 e 9 0 Figue 7: Adding a segment. T(S) and Q(S) have now been fuy updated. In the wost case, this coud make fo a ot of tacing time. Fo instance, in the poygon shown in fig., if we inset the segments in countecockwise poygon ode stating at the uppe ight, the tace time is Θ( S ). The point ocation cost may aso be excessive. If the segments shown on the eft side of fig. 9 ae inseted bottom to top, the quey data stuctue is vey unbaanced, as shown on the ight side of fig. 9, and the tota quey time is Θ( S ). But what if we ook at the agoithm s aveage o expected pefomance, athe than its wost-case pefomance?

6 CS68: 6 Figue 8: A segment with just one thead abutting on it. Figue 9: (Left) A set of segments in T which, if inseted bottom to top, eads to a wost-case quey time. (Right) The esuting quey stuctue. Randomized anaysis of unning time Let e, e,..., e n be a andom odeing of the segments of S, and et S i = {e, e,..., e i } (a pefix of S), fo 0 i n. Lemma. The expected cost of tacing e i though T(S i ) is 4. Poof: Define the degee of a segment in a patitioning, deg(e, T(S)), as the numbe of vetica theads that abut upon e (e S). Then deg(e, T(S i )) 4i () e S i This is because each thead (thee ae i of them) hits segments. andom e i, the expected degee E(deg(e i, T(S i ))) is at most 4. Now, eca that H n = n i= i = Θ(og n). So fo a

CS68: 6 7 e i q Figue 0: Hee, the addition of e i ceates two new decision eves (instead of one) in the seach path fo q. Lemma. Fo any quey point q, the expected numbe of key compaisons (ove a odeings of S) to ocate q in Q(S n ) is 5H n = O(og n). In othe wods, the numbe of decision nodes in Q(S) that we coss to get to q is O(og n). Poof: We use backwad anaysis. We wi fist find how many exta decision nodes we have to coss, on aveage, as a esut of adding a singe edge. Then we add up a those incementa costs to get the tota cost (effectivey, buiding up Q(S) fom scatch). Suppose, then, that q ies in tapezoid τ i, whee τ i T(S i ), and q aso ies in τ i T(S i ). If we know τ i (and its coesponding sink in Q(S i )), what is the expected cost E i of finding τ i? We, unde what cicumstances wi we have to go though an exta decision eve because of the new edge e i? That is, when is τ i = τ i? This occus if τ i s uppe bounding edge is e i (an event with pobabiity i ); if τ i s owe bounding edge is e i (an event with pobabiity i ); if τ i s eft bounding thead was geneated by e i (an event with pobabiity i ); o if τ i s ight bounding thead was geneated by e i (an event with pobabiity i ). One moe decision eve is possibe. Fo the situation shown in fig. 0, the addition of e i caused two new compaisons to be made, not one. This situation aso has pobabiity i Ṫheefoe, the expected incementa cost E i is 5 i, and the expected tota cost of ocating q is i= n E i = 5H n.

8 CS68: 6 Figue : A poygon whose bounday we woud not want to tace. With these emmas, we can now state the foowing theoem, which appies to abitay sets of disjoint ine segments. Theoem 3. Let S be a set of n segments, disjoint except fo thei endpoints. Then. We can buid T(S) and Q(S) in expected O(n og n) time.. Expected Q(S) = O(n). the expected numbe of tapezoids spit is O(n) 3. Expected quey time fo any point q in Q(S) is O(og n). The second pat of this theoem foows fom Lemma. The thid pat is a estatement of Lemma. The fist pat is a consequence of Lemmas and. Whee does a that time go? It goes to point ocation. How, then, can we avoid point ocation, in the specia case in which the segments fom a poygon? We, we coud stat fom the endpoints of eaie segments, i.e. inset the segments in poygon ode. But then we woud ose the benefits of andomization. Fo exampe, with the poygon in fig., the cost of tacing aound it goes up as Ω(n ). So et us use a compomise soution. We wi inset the segments in andom ode, but peiodicay tace the poygona bounday to speed up point ocation fo ate insetions. (Detais beow.) Lemma 4. Fo any q, if we know that q τ j (whee τ j T(S j )), then the expected cost of ocating q in T(S k ), k j, is 5(H k H j ) = O(og k j ). Poof: The poof is amost exacty the same as that of Lemma, above. Lemma 5. Let R be a andom subset of S, with size R =. Let Z be the numbe of intesections between T(R) and S\R. [Reca that S\R denotes the segments of S that ae not in R.] Then the expected vaue of Z is 4(n ).

CS68: 6 9 Poof: Fo any e (S\R), the numbe of intesections between e and T(R) is deg(e, T(R {e})). So E(Z) = ( n ) R S R = fom (), = ( n ) R S R =+ ( n ) 4 R R S R =+ = 4( + ) ( n + ) ( n ) = 4(n ) deg(e, T(R {e})) e (S\R) e R deg(e, T(R )) i Now, define og (i) {}}{ n = og og og n, and og n = max(h og (h) ). n Aso et N(h) =. og (h) n With these definitions, we now pesent the fina vesion of Seide s agoithm. Seide s Tapezoida Patitioning Agoithm. Geneate a andom ode s, s,..., s n of the segments of P.. Geneate T(S ) and Q(S ) [initiaization]. 3. fo h = to og n do a. fo i = N(h ) + to N(h) do Inset segment e i, poducing T(S i ) and Q(S i ) fom T(S i ) and Q(S i ). b. Tace P though T(S N(h) ) to ocate the endpoints of a e j, fo j > N(h). 4. fo i = N(og n) + to n do Inset e i, poducing T(S i ) and Q(S i ) fom T(S i ) and Q(S i ). Anaysis Let us examine the expected unning times of each step:. O(n). O() 3a. ( N(h) N(h) O() fom Lemma + O(og( N(h ) ) )) fom Lemma

0 CS68: 6 Now, N(h) og( N(h ) ) og( n N(h ) ) og(og (h ) n) = og (h) n. Theefoe, step (3a) takes N(h) O(og (h) n) = O(n) time. 3b. O(n), by Lemma 5. n 4. O(n) og( N(og n) ) = og n) og(og n og = O() }{{} (as in 3a) The tota unning time is O(n) pe phase. Thee ae O(og n) phases, so the fina unning time of the agoithm is O(n og n). This competes the poof of the foowing impoved vesion of Theoem 3. Theoem 6. Let S be a set of n segments that fom a simpe poygon. Then. We can buid T(S) and Q(S) in expected O(n og n) time.. Expected Q(S) = O(n). 3. Expected quey time fo any point q in Q(S) is O(og n). Impementation The agoithm was un on a compute as a demonstation at the end of cass, which seved to emphasize the basic steps invoved in this agoithm: () add a segment at andom; () ocate its endpoints; (3) inset tapezoids. Evey now and then, though, the agoithm woud seach aound the bounday of the poygon. As it did so, it ocated the vetices that had not yet been paced, in tems of the existing tapezoids. Then ate, when it needed to ocate those endpoints, it was abe to use that infomation to stat its seaches of Q(S) fom futhe down the DAG (theeby educing its seach time). This is the compomise discussed eaie on page 8. Extensions Seide s agoithm aso appies to moe genea objects than simpe poygons. Theoem 6 appies to any coection of ine segments, disjoint except fo thei endpoints, that fom a staight-ine embedding of a connected pana gaph we epace the poygon tacing step by a gaph tavesa, but a othe steps emain unchanged. Combining this obsevation with Theoem 3, we get the foowing theoem.

CS68: 6 Theoem 7. Let S be a set of n segments that fom a staight-ine embedding of a pana gaph with k connected components. Then. We can buid T(S) and Q(S) in expected O(k og n + n og n) time.. Expected Q(S) = O(n). 3. Expected quey time fo any point q in Q(S) is O(og n).