# Computational Geometry Seminar - Distance Problems

Embed Size (px)

description

### Transcript of Computational Geometry Seminar - Distance Problems

Computational Geometry Seminar - Distance ProblemsBy Yoni Dabush

Topics: Distance Problems:

› Post Office Problem› Nearest Neighbors and Closest Pair› Largest Empty and Smallest Enclosing Circle

Sub graphs of Delaunay Triangulations:› MST and TSP problems› α-Shapes› β-Skeletons› Shortest Paths

The Post Office Problem Given a set of n sites (post offices) in the plane, determine for an arbitrary point x, the post office closest to x.

Lets say each post office is a region in a Voronoi diagram, it remains to determine the region that contains the query point x.

To do so, we will use the Slab Method:› Through each Voronoi vertex draw a vertical line.› These extra lines partition the Voronoi regions into triangles and trapezoids.› By construction, no vertical “slab” between two consecutive lines contains a Voronoi

vertex in its interior, so that all crossing Voronoi edges are ordered within the slab.› To locate the point x = (x1,x2), we use binary search for x1 among the slabs and another

one among the edge segments of the slab found.› This gives us O(log n) query time, and quadric storage cost (disadvantage).

Slab method applied on Voronoi Diagram:

Figure from H. Alt “The Nearest Neighbor”

Theorem: given a set S of n point sites in the plane, one can, within O(log n) time and O(n log n) storage, construct a data structure that supports nearest neighbor queries: for an arbitrary query point x, its nearest neighbor in S can be found in time O(log n).

Let us assume that the site set, S, contains k non-intersecting convex polygons with n edges in total. The bisector of two sites is composed of O(n) many straight or parabolic segments; if we also count the endpoints of such segment as vertices (of degree 2), then the Voronoi diagram of the k convex polygons iscomplexity Ѳ(n), as lemma 4.4 shows.It could be constructed in time o(n log n) by first computing the line segment Voronoi diagram of the polygon edges, and then joining those regions thatbelong to parts of the same convex polygon.

Nearest Neighbors and Closest Pair For each point site in the set S, a nearest neighbor in S is required. In the following example: Arrows are pointing from each site towards its nearest neighbor.For sites in general position the resulting nearest neighbor graph is a forest of trees each of whose verticesis of outdegree 1 and indegree at most 6.

Lemma: Let be a disjoint decomposition of the point set S, and be such that , Then the

Voronoi regions of are edge-adjacent in V(S).

Proof: otherwise the line segment contains a point z that belongs to the closure of some Voronoi region VR(r,S), where . Let us assume that r belongs to Q; the case is symmetric. From follows , hence by minimality of :

Hence, we obtain . But since lies on the bisector , each point z in the interior ofis strictly closer to than to r, a contradiction.

q)d(p,min)q,d(pQqP,p00

QPS

Q 00 q and Pp

00 q and p

00qp00 ,qpr

Pr ),( SrVRz),(),( 0pzdrzd ),( 00 qpd

),(),(),(),(),(),(),( 0000000 rpdqpdqzdzpdrzdzpdrpd

),(),( and ),(),( 0000 qzdrzdqpdrpd 0p ),( 0 rqB 00 ,qp

0q

If we apply the lemma on the subsets {p} and S\{p} it follows that the nearest neighbor of p is sitting in the neighboring Voronoi region (i.e. it is a Delaunay neighbor).

Therefore, it is sufficient to inspect, for each , all neighbors of p in the Voronoi diagram, and select the closest of them.

This way, each edge of V(S) will be accessed twice. Since their total number is linear, we can solve the all nearest neighbors problem by constructing the Voronoi diagram.

Sp

Theorem: given a set S of n points in the plane, O(n log n) time and linear space is sufficient for determining, for each , a nearest neighbor in S.

Once for each p its nearest neighbor in S is known, we can easily determine a pair of points whose distance is minimum.

Corollary: the closest pair among n points in the plane can be determined within O(n log n) time and linear space.

The problem of finding the closest pair of n points can be generalized to reporting the k closest pairs in S, for some number .

A brute-force solution would sort all inter point distances in time

and then report the K smallest.

Sp

2n

k

logn)o(n2

Largest Empty and Smallest Enclosing Circles The largest empty circle problem Observation: this circle must have its center:

1. at a Voronoi vertex of V(S). or 2. at the intersection of a Voronoi edge with the boundary of A. or3. at a vertex of A.

If a circle C with center , not even on its boundary, we blow it up until it does. if its boundary now contains three sites then x is a Voronoi vertex; If there are two sites on its boundary, x lies on a Voronoi edge. In this case we move x along their bisector away from the two sites until the expanding circle hits a third site, or x hits the boundary of A. If, in the beginning, only one point site lies on the boundary of C then we expand C, while keeping its boundary in constant with p, until x reaches a vertex of A, or one of the before mentioned events occurs.

Sp no containsA x

Sp

Example: a center point where x is aVoronoi vertex.

This Observation leads to the following:Theorem: The largest circle not containing a point of S, whose center lies inside a convex polygon A, can be found within O((m+n) log n) time and linear space.Here, m denotes the number of vertices of A, and n is the size of S.

Proof: we spend O(n log n) time on constructing the Voronoi diagram V(S) and point location structure, so that O(m log n) total time is sufficient for finding, for each vertex of A, its nearest neighbor in S.The largest empty circles centered at the Voronoi vertices can be determined in constant time each. Finally we can trace the convex boundary of A through the Voronoi diagram, in order to detect its intersections with the Voronoiedges, in time O(n+m).

The smallest enclosing circle problemClaim: The smallest enclosing circle:1. contains three points of S on its boundary, or 2. it runs through two antipodal points whose distance equals the diameter of S.

From the convex hull of S its diameter, together with a pair of points realizing it, can be derived in linear time; then it can be checked if the smallest circle through these points contain S.Otherwise, the center v of the smallest enclosing circle C must be a vertex of the furthest site (or: order n-1) Voronoi diagram.Namely, the three sites on the boundary of C are furthest from v.

This yields an O(n log n) algorithm for computing the smallest enclosing circle.

The linear programming technique is more efficient: For fixed dimension d it allows the smallest sphere enclosing n points in d-space to be constructed in time O(n).

Previously: Using Voronoi diagrams, we can improve

efficiency in solving some well-known problems.

Lets see some more details…

The Post-Office problem› What?› You arrive to a new town and you want to get to the

nearest post office.

› In other words: › We throw a new point x=(x1,y1) into a Voronoi diagram

built from a set S of n points.› And we want to know which point in S is closest to x.

› How?

› Using the slab method (binary search) O(n log n) time. O(n^2) space (bad )

› Building a special data structure that holds the Voronoi vertices.

O(log n) time and O(n log n) space for the building.

› For each point x=(x1,y1) we use the data structure in time O(log n).

Nearest Neighbors problem› What?› We have a set S of n point.› And we want to know for each point – its NN.

› How?› We build a Voronoi diagram.› We have proved that each NNs are also edge adjacent in

V(S). for each p in S we only need to check the neighboring

Voronoi regions.› This gives us time complexity of O(n log n)

Largest empty circle problem› What?› You have an area with building in it.› And you want to build a new building in this area, s.t it

will be far away from all other buildings.

› In other words:› Given a convex Polygon A, and a set of point S in A, find

the largest empty circle whose center is in A.

› How?

› We saw that the center of the circle must be:1. at a Voronoi vertex of V(S). or 2. at the intersection of a Voronoi edge with the boundary of A. or3. at a vertex of A.

› By this, we can find this circle in time O((m+n) log n). O(n log n) - Building the Voronoi diagram. O(m + n) – the intersections of A and the Voronoi edges. O(m log n) – finding for each vertex of A its NN in S.

Smallest enclosing circle problem› What?› You are a cellular company.› And you want to place a low frequent antenna that will

cover a set of given points.

› In other words:› Given a set S of n points, find the minimal circle that

encloses all points in S.

› How?

› We saw that:1. the circle contains three points of S on its boundary. or2. it runs through two antipodal points whose distance equals the diameter of S.

› By this, we can find the smallest enclosing circle by

constructing the Voronoi diagram of S – O(n log n)

Next: Subgraphs of Delaunay triangulations:

› MST › TSP › α-Shapes› β-Skeletons› Shortest Paths

Lemma: MST(S) is a sub-graph of DT(S)

Proof: Let e be an edge of MST(S). Removal of e splits MST(S) into two sub trees, and S into two subsets S1, S2.Clearly, e is the shortest edge connecting S1 and S2. A shorter edge will lead to a shorter spanning tree than MST(S).It follows that the circle C with diameter e is empty of sites in S. A site enclosed by C would have to belong to either S1 or S2, leading to a connection between S1 and S2 shorter than e. by definition, C proves e Delaunay.

Minimum spanning trees

We thus can select the n-1 edges of MST(S) from O(n) edges of DT(S), rather than from all the edges spanned by S.

Edges are considered in increasing length order, and an edge is classified as a tree edge if it does not violate acyclicity (Kruskal - O(E log V)).

An O(n log n) time algorithm for computing MST(S) is obtained.

2n

An example: set S to DT(S) to MST(S)

A Traveling Sales Person Tour It is known that generally, TST(S) is no sub-graph of DT(S). Finding a traveling salesman tour has been shown to be NP-complete. But a factor-2 approximation of TST(S) can be found easily using MST(S). Let A(S) be a cycle through S that results from traversing MST(S) in preorder.

Lemma: |A(S)| < 2*|TST(S)|

Proof: when traveling each edge of MST(S) twice, a tour longer than A(S) is obtained. Hence |A(S)| < 2*|MST(S)|. To see |MST(S)| < |TST(S)|, note that removing an edge from TST(S) leaves a path which is some, but not necessarily the minimum spanning tree of S.

*A(S) can be constructed in linear time from MST(S).

α-Shapes The concept of a-Shapes – generalize the convex hull of S for the sake of

better shape approximation, while still remaining a sub-graph of DT(S).

For a > 0, the a-shape a(S) of S is defined to contain an edge between sites iff there is some disc of radius a that avoids S and has p and q on its boundary. By definition a(S) is always part of DT(S) and thus has only O(n) edges.

For a being sufficiently large, the convex hull of S is obtained. The smaller is the value of a, the finer is the level of resolution of the shape.

Sqp ,

a-shapes with different radius examples :

β-Skeletons Let . We select s.t the edge (p,q) is included in the β-Skeleton

β (s) iff the two discs of diameter β* d(p,q) that pass through both p and q are empty of sites in S.

We will not discuss the case where β<1…

Sp,q 1β

β < 1 β=1 β>1

Observations…

Let us note that β (S) is a subgraph of β ‘(S) if β > β ‘.

For β = 1, the Gabriel graph of S is obtained.

MST(S) and NN(S) are sub graphs of the Gabriel graph which is a sub graph of DT(S).

β (S) may be disconnected for any β >1, the Gabriel graph is always connected as it contains the minimum spanning tree of S as a subgraph.

β –Skeletons can be constructed from DT(S) in linear time.

β-Skeletons for β = 1.1 (heavy dark edges) and 0.9 (light dashed blue)

β-Skeletons for β = 1 – Gabriel graph

Given a graph G=(V,E), a subgraph G’= (V,H) is a t-spanner of G if for any pair of vertices it satisfies .

We say the graph G’ has dilation t if, for any the shortest path in G’ between u and w is at most .

The basic t-spanner problem is: finding a t-spanner of a given graph G with the smallest number of edges.

t-spanner is used for studying geometric network optimization.

Shortest Paths

Vwu , ),(),( wudtwud EH

Vwu ,),( wudt E

Some more details…

Finding a spanner in the Euclidean plane with minimal dilation over n points with at most m edges is known to be NP-Hard.

The best upper bound (of t) for DT(S) is approximately 2.481.

And the best lower bound is approximately 1.5846.

Consequently, good spanners for S can be constructed in O(n log n).

Thanks for listening