Exact and Approximation Algorithms for Computing the Dilation

0 downloads 0 Views 264KB Size Report
Jun 28, 2005 - Abstract. Let G be a graph embedded in Euclidean space. For any two vertices of G their dilation denotes the length of a shortest connecting ...
Exact and Approximation Algorithms for Computing the Dilation Spectrum of Paths, Trees, and Cycles Rolf Klein∗, Christian Knauer†, Giri Narasimhan‡, Michiel Smid§ June 28, 2005

Abstract Let G be a graph embedded in Euclidean space. For any two vertices of G their dilation denotes the length of a shortest connecting path in G, divided by their Euclidean distance. In this paper we study the spectrum of the dilation, over all pairs of vertices of G. For paths, trees, and cycles in 2D we present O(n3/2+² ) randomized algorithms that compute, for a given value κ ≥ 1, the exact number of vertex pairs of dilation > κ. Then we present deterministic algorithms that approximate the number of vertex pairs of dilation > κ up to an 1 + η factor. They run in time O(n log2 n) for chains and cycles, and in time O(n log3 n) for trees, in any constant dimension.

Keywords Computational geometry, dilation, distribution, geometric graph, network, spectrum, stretch factor.

1

Introduction

Let S be a set of n points in Rd , where d ≥ 1 is a small constant, and let G be an undirected connected graph having the points of S as its vertices. The length of any edge (p, q) of G is defined as the Euclidean distance |pq| between the two vertices p and q. Such graphs are called Euclidean graphs. Let dG (x, y) denote the length of a shortest path in G that connects x and y. Then the dilation between x and y in G is defined as δG (x, y) =

dG (x, y) . |xy|

Euclidean graphs are frequently used for modeling traffic or transportation networks. In order to measure their performance, the dilation of G [16] has been used, which is defined as the maximum dilation over all pairs of points in G, i.e., σ(G) = max δG (x, y). x6=y

(1)

In case of railroad systems, access is only possible at stations. Thus, in the definition of the dilation, the maximum is taken over all vertices x and y of G. This value is also called the stretch factor, the spanning ratio, or the distortion [13] of G. A lot of work has been done on the construction of good spanners, i. e., of sparse graphs of low dilation that connect a given vertex set and enjoy other desirable properties; see the handbook chapter [8] or the forthcoming monograph [15]. How ∗ Institut f¨ ur Informatik I, Universit¨ at Bonn, R¨ omerstraße 164, D-53117 Bonn, Germany, [email protected]. This author was supported by DFG Kl 655/14-1,2. † Freie Universit¨ at Berlin, Institute of Computer Science, Berlin, Germany, [email protected] ‡ School of Computer Science, Florida International University, ECS389, University Park, Miami, FL 33199, U.S.A., [email protected] § School of Computer Science, Carleton University, 1125 Colonel By Drive, Ottawa, Ontario K1S 5B6, Canada, [email protected]. This author was supported by NSERC.

1

to compute the dilation of a given Euclidean graph has first been addressed in [14]. They gave an O(n log n) algorithm for approximating, up to an 1 − ² factor, the dilation of paths, trees, and cycles in Euclidean space of constant dimension. In [1] exact randomized algorithms were given that run in time O(n log n) for paths in the plane, and in time O(n log2 n) for computing the dilation of a plane tree or cycle. In 3D, time O(n4/3+² ) is sufficient for either type of graph; see also [2, 12]. For general graphs, nothing better seems to be known than running Dijkstra’s algorithm for each vertex of G, which leads to an O(mn + n2 log n) algorithm [4]; here n denotes the number of vertices, while m is the number of edges of G. In the recent paper [9], the interesting question has been addressed how to decrease the dilation of a graph as much as possible by inserting another edge. A different situation arises when modeling the street system of a city. Here, houses are everywhere along the streets. Thus, it makes sense to allow, in the definition of dilation (1), all points x and y of G, vertices and interior edge points alike. This point-to-point type of dilation has also been called the detour or the geometric dilation of G. For plane paths, it can be computed in time O(n log n), while time O(n log2 n) is sufficient for plane trees and cycles. In 3D, the point-to-point dilation of paths, trees, and cycles can be computed in time O(n16/9+² ), see [1]. For both, point-to-point and vertex-to-vertex dilation, the problem of constructing a plane Euclidean graph, i. e. one without edge crossings, of smallest possible dilation that contains a given point set, is rather challenging. In [6, 7] first results on the point-to-point case were obtained. Here optimal graphs tend to have curved edges, as opposed to the vertex-to-vertex dilation where triangulations work best. Recent progress on bounding the vertex-to-vertex dilation of plane graphs has been made in [5]. In this paper we are studying the vertex-to-vertex dilation of graphs from a different perspective. Computing the dilation, as defined in (1), simply points to the pair of vertices for which the dilation is maximized. In real networks, one may wish to tolerate some number of pairs of vertices with high dilations, if the network provides good connections to the majority of vertex pairs. Therefore, we are interested in computing (exactly or approximately) the dilation spectrum of a graph G. That is, for a given threshold κ > 1 we are interested in the number πG (κ) := | (p, q) ∈ S 2 ; δG (p, q) > κ |

(2)

of all vertex pairs whose dilation exceeds κ. This distribution of the dilation could also be helpful in understanding structural properties of a given geometric graph. Clearly, the cost O(mn + n2 log n) of running Dijkstra’s algorithm from each vertex of G is an upper bound on the time complexity of computing the dilation spectrum of G. For some classes of graphs, better running times can be obtained. For example, it has been shown in [10] that the distances in G between all pairs of vertices of a plane geometric graph can be computed in O(n2 ) total time. Clearly, the same upper bound holds for the dilation spectrum. This paper is organized as follows. In Section 2 we provide randomized algorithms for polygonal paths, trees, and cycles in the plane, that allow πG (κ) to be computed in time O(n3/2+² ). To this end, we first use a geometric transformation scheme introduced in [1], in order to reduce the problem of computing πG (κ) to a counting problem, and then apply suitable range counting techniques. Then, in Section 3, faster algorithms will be presented for approximating the dilation spectrum. More precisely, for given reals κ ≥ 1 and ² > 0 we shall compute a number M satisfying πG (κ (1 + ²)2 ) ≤ M ≤ πG (κ)

(3)

that approximates the number of vertex pairs of dilation > κ. The run time of these deterministic algorithms is in O(n log2 n) for paths and cycles, and in O(n log3 n) for trees. Our approach is based on the well-separated pair decomposition [3]; hence, it works in any constant dimension. Finally, in Section 4 we mention some open problems.

2

Computing the Exact Dilation Spectrum

In this section we derive exact algorithms for computing the dilation distribution πG (κ), where G is a plane graph whose structure will be specified below, and κ is a threshold > 1. Slightly more 2

generally, let A, B be two disjoint vertex sets of G. We are interested in πG (κ, A, B) = |{(x, y) ∈ A × B | δG (x, y) > κ}|, the number of vertex pairs in A × B whose dilation exceeds κ.

2.1

Paths

In this section, we present a randomized algorithm for computing πP (κ) for a simple polygonal path P in the plane. First, we describe a reduction that rephrases the problem of computing πP (κ) as a counting problem in three-dimensional space. Then we apply range counting algorithms to solve that problem. 2.1.1

Reduction to range counting

Let p0 be the first vertex of P . For a vertex pair (p, q) ∈ A × B we say that that p lies before q on P , and denote it by p

Cp (q)}, and 0 0 Π− P (κ, A, B) = {(p, q) ∈ A × B | ω (q) > Cp (q)}.

3

2.1.2

Counting points above cones

In the previous section we have seen that the problem of computing |π(κ, A, B)| amounts to count ˆ × C(A) such that p lies above C. the number of point-cone pairs (p, C) ∈ B Suppose we are given a set P of n points and a set C of m cones in R3 whose axes are vertical and whose apices are their bottommost points. We describe a randomized algorithm to compute µ(P, C), the number of point-cone pairs (p, C) ∈ P × C such that p lies above C. We fix a sufficiently large constant r. We choose a random sample R of O(r) cones in C, and compute the vertical decomposition Ak of the arrangement A of the cones in R. As is known (c.f. [17], Theorem 8.21), Ak has O(r3 log4 r) cells. For each cell ∆ ∈ Ak , let P∆ = {p ∈ P | p ∈ ∆}, let C6∆ ⊆ C be the set of cones P crossing ∆, and let C∆ ⊆ C be the set of cones which lie completely below ∆. Clearly µ(P, C) = ∆∈Ak |P∆ ||C∆ | + µ(P∆ , C6∆ ). P Set n∆ = |P∆ | and m∆ = |C6∆ |. Obviously, ∆ n∆ = n and by the theory of random sampling [11], m∆ ≤ m/r with high probability, for all ∆. If this condition is not satisfied for the sample R, we pick a new random sample. The expected number of trials until we get a ’good’ sample is constant. If m∆ or n∆ is less than a prespecified constant, then we use a naive procedure to determine µ(P∆ , C∆ ). Otherwise, we recursively compute µ(P∆ , C∆ ). For m, n > 0, let T (n, m) denote the expected running time of the algorithm on a set of n points and a set of m cones. We get the following probabilistic recurrence: X ³ m´ + O(m + n), T (n, m) = T n∆ , r ∆∈Ak

where

P ∆

n∆ ≤ n. The solution to the above recurrence is T (n, m) = O(m3+² + n log m)

for any ² > 0. Note that the same algorithm can be used to compute µ ¯(P, C), the number of point-cone pairs (p, C) ∈ P × C such that p lies below C. To improve the running p time of the algorithm we perform the following dualization step: Let Cˆ denote the cone z = − x2 + y 2 in R3 . If we map each point p = (px , py , pz ) ∈ P to the cone δ(p) = Cp = Cˆ ⊕ (px , py , pz ) and each cone C = Cˇ ⊕ (px , py , pz ) to the point δ(Cp ) = pC = (px , py , pz ) we have that p lies above C if and only if pC lies below Cp , in other words µ(P, C) = µ ¯(δ(C), δ(P )). We can use this to tune our algorithm as follows. The recursion proceeds as earlier except that when m∆ > n3∆ , we switch the roles of P∆ and C∆ using the duality transformation δ, and compute µ(P∆ , C∆ ) = µ ¯(δ(C∆ ), δ(P∆ )) in T (m∆ , n∆ ) = O(n3+² + m∆ log n∆ ) = O(m1+² ∆ ∆ ) time with the algorithm just described. With these modifications, the recurrence becomes  X ³ m´  T n∆ , + O(m + n) if m ≤ n3  r T (n, m) = ∆∈Ak   O(m1+² ) if m > n3 , P where ∆ n∆ ≤ n. It can be shown that T (n, m) = O((mn)3/4+² + m1+² + n1+² ) for any ² > 0. Hence, we obtain the following. Lemma 2.3. We can compute µ(P, C) in O((mn)3/4+² + m1+² + n1+² ) randomized expected time. Combining this with 2.2, we get Theorem 2.1. Let P be a polygonal path on n vertices in R2 , and let κ ≥ 1. Then we can compute πP (κ), i.e., the number of vertex-pairs of P that attain at least dilation κ, in O(n3/2+² ) randomized expected time for any ² > 0. Note that we can use the same approach to report all pairs of vertices for which the dilation is larger than κ, in additional time that is proportional to the size of the output. 4

2.2

Trees

Due to lack of space, we can only formulate our result. But in Section 3.5 we will show how to deal with trees in computing the approximate dilation spectrum. Theorem 2.2. Let T be a tree on n vertices in R2 , and let κ ≥ 1. Then we can compute πT (κ) in O(n3/2+² ) randomized expected time for any ² > 0.

2.3

Cycles

Let us now consider the case in which P is a simple closed polygonal curve. This case is more difficult because there are two paths between any two points of P . For two points x, y ∈ P , let P [x, y] denote the portion of P from x to y in clockwise direction. We use here the notation dP (x, y) to denote the length of P [x, y]; thus, in general, dP (x, y) = 6 dP (y, x) and dP (x, y) + dP (y, x) is the length of the entire P . For a point p ∈ P , let σ(p) denote the next point on P in clockwise direction, and let ν(p) denote the last point on P in clockwise direction such that dP (p, ν(p)) ≤ |P |/2 (i.e., dP (p, σ(ν(p))) > |P |/2), where |P | denotes the length of P . Similarly, let ν −1 (p) denote the last point on P in counterclockwise direction such that dP (ν −1 (p), p) ≤ |P |/2, i.e., dP (σ −1 (ν −1 (p)), p) > |P |/2, holds. We present a divide-and-conquer algorithm, which will use the algorithm described in Sec. 2.1 repeatedly. We can preprocess P in O(n) time so that for any two points x, y ∈ P , dP (x, y) can be computed in O(1) time. Lemma 2.4. Let x be a point on P , and let A and B be two subsets of the vertex set of Px = P [x, ν(x)]. Then πP (κ, A, B) = πPx (κ, A, B). This observation follows from the fact that the shortest path between any two points w, z ∈ A×B is contained in the polygonal path Px . Since Px [w, z] for any two points w, z ∈ A×B can be computed in O(1) time, using Theorem 2.1, we obtain the following. Lemma 2.5. Let x be a point on P , and let A, B be two subchains of P [x, ν(x)] composed of a total of m edges. Then πP (A, B) can be computed in O(m3/2+² ) randomized expected time. To compute πP (κ), we describe a recursive algorithm for the following more general problem: Let t1 , t2 be two points of P appearing in this clockwise order along P , so that t2 lies before ν(t1 ) in the sense that dP (t1 , t2 ) ≤ |P |/2, and let b1 = ν(t1 ) and b2 = ν(t2 ). First observe that dP (t2 , b2 ) = dP (t2 , b1 ) + dP (b1 , b2 ) ≤ |P |/2, and so dP (b1 , b2 ) ≤ |P |/2. Let m, n be the number of edges in P [b1 , b2 ] and P [t1 , t2 ], respectively. We wish to compute π(t1 , t2 , b1 , b2 ) := πP (κ, P [t1 , t2 ], P [b1 , b2 ]). If min{m, n} = 1, then we can compute π(t1 , t2 , b1 , b2 ) in O(m + n) time. Otherwise, suppose, without loss of generality, that n ≥ m, and let t be the middle vertex of P [t1 , t2 ], i.e., the vertex for which each of P [t1 , t], P [t, t2 ] has n/2 edges, and let b = ν(t). It is easily seen that b ∈ P [b1 , b2 ]. Clearly, π(t1 , t2 , b1 , b2 ) = π(t1 , t, b, b2 ) + π(t, t2 , b1 , b) + π(t1 , t, b1 , b) + π(t, t2 , b, b2 ). The quantities π(t1 , t, b1 , b) and π(t, t2 , b, b2 ) can be computed recursively, so it remains to determine π(t1 , t, b, b2 ) and π(t, t2 , b1 , b). Since P [t, t2 ] and P [b1 , b] lie in P [t, ν(t)], we can compute π(t, t2 , b1 , b) according to Lemma 2.5 in O((n + m)3/2+² ) randomized expected time for any ² > 0. To determine π(t1 , t, b, b2 ) we proceed as follows: Let b0 = ν −1 (t). We have that b0 = b or 0 b = σ(b). Moreover π(t1 , t, b, b2 ) = π(t1 , t, b0 , b2 ) + π(t1 , t, b, b)

5

Again, since P [b0 , b2 ] and P [t1 , t] lie in P [b0 , t], we can compute π(t1 , t, b0 , b2 ) according to Lemma 2.5 in O((n + m)3/2+² ) randomized expected time for any ² > 0. If b 6= b0 , we determine π(t1 , t, b, b) in O(n) time, by computing the dilation of every vertex on P [t1 , t] to b by brute force. Let m1 be the number of edges in P [b1 , b]. Then P [b, b2 ] contains at most m − m1 + 1 edges. Let T (n, m) denote the maximum expected time of computing π(t1 , t2 , b1 , b2 ). Then we obtain the following recurrence for any ² > 0: T (n, m) ≤ T (n/2, m1 ) + T (n/2, m − m1 + 1) + O((n + m)3/2+² ),

if n ≥ m,

with a symmetric inequality for m ≥ n, and T (n, 1) = O(n), T (1, m) = O(m). The solution to the above recurrence is T (n, m) = O((n + m)3/2+² ) for any ² > 0. Returning to the problem of computing πP (κ), we choose a vertex v ∈ P . Let P1 = P [v, ν(v)] and P2 = P [ν(v), ν(ν(v))]. Note that for v 0 = ν(ν(v)) we have that v 0 = v or σ(v 0 ) = v. Then πP (κ) = πP1 (κ) + πP2 (κ) + πP (κ, P1 , P2 ) = πP1 (κ) + πP2 (κ) + π(v, ν(v), ν(v), ν(ν(v))). Since πP1 , πP2 can be computed in O(n3/2+² ) randomized expected time, using 2.5 and π(v, ν(v), ν(v), v) can be computed in O(n3/2+² ) randomized expected time as just described, we conclude the following. Theorem 2.3. Let P be a closed polygonal path on n vertices in R2 , and let κ ≥ 1. Then we can compute πP (κ) in O(n3/2+² ) randomized expected time.

3

Computing the Approximate Dilation Spectrum

Now we set out to give faster algorithms for computing an approximation of the dilation spectrum. Our reduction uses the well-separated pair decomposition [3], thus adding to the list of applications of this powerful method.

3.1

Well-separated pairs

We briefly review this decomposition and some of its relevant properties. Definition 3.1. Let s > 0 be a real number, and let A and B be two finite sets of points in Rd . We say that A and B are well separated with respect to s if there are two disjoint d-dimensional balls CA and CB , having the same radius, such that (i) CA contains all points of A, (ii) CB contains all points of B, and (iii) the distance between CA and CB is at least equal to s times the radius of CA . In this paper, s will always be a constant, called the separation constant. The following lemma follows easily from the above definition. Lemma 3.1. Let A and B be two finite sets of points that are well separated with respect to s, let a and p be points of A, and let b and q be points of B. Then 1. |ab| ≤ (1 + 4/s)|pq|, 2. |pa| ≤ (2/s)|pq|. Definition 3.2 (see [3]). Let S be a set of n points in Rd and s > 0 a real number. A well-separated pair decomposition (WSPD) for S (with respect to s) is a sequence of pairs of nonempty subsets of S, {A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk }, such that 6

1. Ai ∩ Bi = ∅ for all i = 1, 2, . . . , k, 2. for any two distinct points p and q of S, there is exactly one pair {Ai , Bi } in the sequence, such that (a) p ∈ Ai and q ∈ Bi , or (b) p ∈ Bi and q ∈ Ai , 3. Ai and Bi are well separated with respect to s for all i = 1, 2, . . . , k. The integer k is called the size of the WSPD. Callahan and Kosaraju showed how such a WSPD of size k = O(n) and k = O(n log n) can be efficiently computed using a binary tree, called the fair split tree. We briefly state their results. Theorem 3.1. Let S be a set of n points in Rd and s > 0 a separation constant. In O(n log n+αds n) time, we can compute a WSPD for S of size at most αds n. The constant in the Big-Oh bound does not depend on s. Moreover, for a large separation constant s, the value of αds is proportional to 2d dd/2 sd . Theorem 3.2. Let S be a set of n points in Rd and s > 0 a separation constant. In O(αds n log n) time, we can compute a WSPD for S of size at most αds n log n, with the additional property that for each pair in the decomposition, at least one of the sets is a singleton set. The constant in the Big-Oh bound does not depend on s. Moreover, for a large separation constant s, the value of αds is proportional to 2d dd/2 sd .

3.2

A general algorithm

Given a real number κ > 1 and a geometric graph G, we show how to compute the number ρG (κ) of all pairs of vertices in the graph for which the dilation is at most κ.1 Now consider a WSPD {A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk } for the set of vertices of G. Assume without loss of generality that each Ai is a singleton set, {ai }. It follows from Theorem 3.2 that k = O(n log n). Lemma 3.1 essentially states that all geometric distances between ai and a point of Bi are roughly equal. Let the distance between ai and any representative point in Bi be denoted by Di . Hence, if we compute for each i, 1 ≤ i ≤ k, all points bi ∈ Bi whose distance dG (ai , bi ) in G is at most κ(1 + ²) · Di , then we would have effectively computed all pairs of points in the pair {Ai , Bi } for which their approximate dilation is at most κ. This observation leads to the general algorithm, A, presented below in Figure 1. General Algorithm A Input: A geometric graph G on a set S of points in Rd and a real constant ² > 0. Output: The number of pairs of vertices of G whose dilation is at most κ(1 + ²). Step 1: Using separation constant s = 4/², compute a WSPD {A1 , B1 }, {A2 , B2 }, . . . , {Ak , Bk } for the set S, with the added condition that |Ai | = 1, for each i = 1, . . . , k. Step 2: For each i, 1 ≤ i ≤ k, let Ai = {ai }, and Di denote the length |ai b|, where b is an arbitrary element of Bi . For i = 1, . . . , k. compute ni , the number of points bi ∈ Bi , such that dG (ai , bi ) ≤ κ(1 + ²) · Di . P Step 3: Report N = ki=1 ni .

Figure 1: General algorithm for counting the number of pairs with approximate dilation at most κ of a geometric graph. The above algorithm could be easily modified to output the set of pairs of points for which the dilation is at most κ(1 + ²) by making appropriate changes in Steps 2 and 3. The following lemma compares N , the output of Algorithm A, with the true value of ρG (κ). 1 Clearly,

we can obtain the number πG (κ) of vertex pairs whose dilation exceeds κ by subtracting ρG (κ) from

7

¡n¢ . 2

Lemma 3.2. The number of pairs of vertices in G with stretch factor at most κ is at most equal to N . The number of pairs of vertices in G with stretch factor at most κ(1 + ²)2 is at least equal to N . In other words, ρG (κ) ≤ N ≤ ρG (κ(1 + ²)2 ) Proof. In step 2 of algorithm A, Di is equal to |ai b|, where b is an arbitrary element of Bi . Step 2 of the algorithm counts all pairs of points bi ∈ Bi for which |ai bi | ≤ κ(1 + ²) · Di . If dG (ai , bi ) ≤ κ|ai bi |, then by Lemma 3.1, dG (ai , bi ) ≤ κ(1 + ²) · Di , and thus the pair (ai , bi ) is counted in step 2 of the algorithm, proving that ρG (κ) ≤ N . If dG (ai , bi ) ≤ κ(1 + ²)Di , then it is counted in step 2 of the algorithm. But then, by Lemma 3.1, dG (ai , bi ) ≤ κ(1 + ²)2 · |ai bi |, implying that this pair has a dilation of at most κ(1 + ²)2 . Thus, N ≤ ρG (κ(1 + ²)2 ). This completes the proof.

3.3

Paths

Let the graph G be a simple path (p0 , p1 , . . . , pn−1 ) on the points of the set S, and let ² > 0 be a constant. Following our general algorithm A of Section 3.2, we start by computing a split tree T and a corresponding WSPD {A1 , B1 }, {A2 , B2 }, . . . , {Am , Bm } for S, with separation constant s = 4/². By Theorem 3.2, we can compute in O(n log n) time such a WSPD with |Ai | = 1, for 1 ≤ i ≤ m, and m = O(n log n). By a simple postorder traversal of T , we store with each node u of T the sorted list of indices of all points stored at the leaves of the subtree of u. Note that this involves merging two sorted sublists at each node of the tree. Each set Bi is represented by a node vi in the split tree T such that their subtrees contain exactly the points of Bi in their leaves. Let the sorted list of the points for node vi be denoted by Vi . Also since |Ai | = 1, it is represented by a leaf node ui in the split tree. Step 2 of our algorithm is implemented as follows. First, we traverse the path, and compute for each vertex pj , 0 < j < n, the distance dG (p0 , pj ). Using this information, we can compute for any 0 ≤ j < k < n, the distance dG (pj , pk ) in constant time, as the difference between dG (p0 , pk ) and dG (p0 , pj ). Then, for 1 ≤ i ≤ m, use binary search to identify the two sublists of points in Vi that lie before and after point ai . It is easy to observe that the two sublists are effectively sorted by their distance from ai . Finally use two binary searches to search the two sublists separately to identify the number of points bi ∈ Vi such that dG (ai , bi ) ≤ κ(1 + ²)Di . It is easy to see that this correctly implements Step 2. Since it involves 2m = O(n log n) binary searches, the running time of the entire algorithm is bounded by O(n log2 n). Theorem 3.3. Let S be a set of n points in Rd , let G be a simple path on the points of S, and let ² be a positive constant. In O(n log2 n) time, we can compute a number N that lies between ρG (κ) and ρG (κ(1 + ²)2 ).

3.4

Cycles

Let the graph G be a cycle (p0 , p1 , . . . , pn−1 , p0 ) on the points of the set S, and let ² > 0 be a constant. We compute a split tree T and a corresponding WSPD {A1 , B1 }, {A2 , B2 }, . . . , {Am , Bm } for S, with separation constant s = 4/², such that each set Ai is a singleton, say Ai = {ai }. Note that m = O(n log n). With each point pj , we store all indices i, 1 ≤ i ≤ m, such that ai = pj . Pn−1 Let L be the total length of the cycle, i.e., L = j=0 |pj pj+1 |, where indices are to be read modulo n. 8

As in the case of a simple path, we preprocess G in O(n) time, such that the distance in G between any two points of S can be computed in O(1) time. Also, using a similar postorder traversal of T , we store with each node u of T the sorted list of indices of all points stored at the leaves of the subtree of u. Note that this involves merging two sorted sublists at each node of the tree. Each set Bi is represented by a node vi in the split tree T such that their subtrees contain exactly the points of Bi in their leaves. Let the sorted list of the points for node vi be denoted by Vi . Also since |Ai | = 1, it is represented by a leaf node ui in the split tree. Then, for 1 ≤ i ≤ m, use binary search to identify the two sublists of points in Vi that lie before and after point ai in the ordering in Vi . In the path case, these two sublists were effectively sorted by their distance from ai . In the cycle case, these two lists may not be sorted by their distance from ai . However, it is easy to see that their distances to ai are either sorted or unimodal, thus making it possible to use a modified binary search on them. Finally, we use two modified binary searches to search the two sublists separately to identify the number of points bi ∈ Vi such that dG (ai , bi ) ≤ κ(1 + ²)Di . As in the path case, the running time of the entire algorithm is bounded by O(n log2 n). Theorem 3.4. Let S be a set of n points in Rd , let G be a cycle on the points of S, and let ² be a positive constant. In O(n log2 n) time, we can compute a number N that lies between ρG (κ) and ρG (κ(1 + ²)2 ).

3.5

Trees

It is well known that in any tree G having n vertices, there is a vertex v, whose removal gives two graphs G01 and G02 , each having at most 2n/3 vertices. Moreover, such a vertex v can be found in O(n) time. Each of the two graphs G0i is a forest of trees. We will call v a centroid vertex of G. Each of the graphs G1 := G01 ∪ {v} and G2 := G02 ∪ {v} is connected and, hence, a tree again. Let S be a set of n points in Rd , and let G be an arbitrary tree having the points of S as its vertices. We will identify the vertices of G with the points of S. Let ² > 0 be a constant. The following recursive algorithm, which is inspired by the general algorithm A, solves the problem when the input graph G is a tree. Step 1: Compute a centroid vertex v of G, and the corresponding decomposition into trees G1 and G2 . Note that v is a vertex of both these trees. Traverse each tree in preorder, and store with each vertex p the distance dG (p, v) between p and the centroid vertex v. Step 2: Use the same algorithm to recursively solve the problem on graph G1 and on graph G2 . Step 3: Let s := 4/². Compute a split tree T and a corresponding WSPD {A1 , B1 }, {A2 , B2 }, . . . , {Am , Bm } for the points of S, with separation constant s, having size m = O(n log n). Step 4: For each node u of the split tree, denote by Su the set of points of S that are stored in the subtree of u. Traverse T in postorder, and compute for each of its nodes u the sorted sequence of nodes, Su1 , consisting of nodes in G1 sorted according to their distance from the centroid v. Similarly, compute the sorted sequence of nodes, Su2 , consisting of nodes in G2 sorted according to their distance from the centroid v. Step 5: For each i, 1 ≤ i ≤ m, we do the following. Consider the pair {Ai , Bi } in our WSPD, with Ai = {ai }, and the node vi in the split tree such that Bi = Svi . Let the two sets computed for vi be Sv1i and Sv2i . If ai ∈ G1 , then use binary search to identify the number of points bi ∈ Sv2i such that dG (ai , bi ) ≤ κ(1 + ²)Di . Otherwise the search is performed in Sv2i . The correctness of the above algorithm is proved by induction and results from the fact that Step 2 counts all pairs of nodes that involve ai and another node in G1 (assuming that ai ∈ G1 ), while Step 5 counts all pairs of nodes that involve ai and another node in G2 . Note that the distance in G from point ai ∈ G1 to point bi ∈ G2 is given by adding their distances to the centroid vertex v.

9

To prove the time complexity, let T (n) denote the running time of our algorithm on an input tree having n vertices. Then T (n) = O(n log2 n) + T (n0 ) + T (n00 ), where n0 and n00 are positive integers such that n0 ≤ 2n/3, n00 ≤ 2n/3, and n0 + n00 = n + 1. The O(n log2 n) term comes about because the binary search spends O(log n) time on each of the O(n log n) well-separated pairs. The above recurrence relation solves to T (n) = O(n log3 n). Theorem 3.5. Let S be a set of n points in Rd , let G be a tree on the points of S, and let ² be a positive constant. In O(n log3 n) time, we can compute a number N such that it lies between ρG (κ) and ρG (κ(1 + ²)2 ).

4

Conclusions

In this paper we have studied the spectrum of the vertex-to-vertex dilation of paths, trees, and cycles, and obtained efficient algorithms for computing it. Besides the obvious questions about possible improvement or generalization, there seem to be some interesting structural problems one may want to study. To what extend does the dilation spectrum of a graph, that is, the function πG (κ), reflect the graph’s structure? And, what types of functions πG (κ) can occur? Acknowledgement The authors would like to thank the organizers and all participants of the Korean workshop 2004 at Schloß Dagstuhl for establishing the nice and stimulating atmosphere that gave rise to this work.

References [1] P. Agarwal, R. Klein, Ch. Knauer, S. Langerman, P. Morin, M. Sharir, and M. Soss, Computing the detour and spanning ratio of paths, trees and cycles in 2D and 3D, Manuscript, submitted for publication, 2005. [2] P. Agarwal, R. Klein, Ch. Knauer, and M. Sharir, Computing the detour of polygonal curves, Technical Report B 02-03, Freie Universit¨ at Berlin, Fachbereich Mathematik und Informatik, 2002. [3] P. B. Callahan and S. R. Kosaraju, A decomposition of multidimensional point sets with applications to k-nearest-neighbors and n-body potential fields, J. ACM, 42 (1995), pp. 67–90. [4] T. H. Cormen, C. E. Leiserson, and R. L. Rivest, Introduction to Algorithms, MIT Press, Cambridge, MA, 1990. ¨ ne, M. Karpinski, R. Klein, Ch. Knauer, and A. Lingas, Embedding point sets [5] A. Ebbers-Baumann, A. Gru into plane graphs of low dilation, submitted for publication, 2005. ¨ ne, and R. Klein, On the geometric dilation of finite point sets, 14th International [6] A. Ebbers-Baumann, A. Gru Symposium ISAAC 2003, Kyoto, in T. Ibaraki, N. Katoh, and H. Ono (Eds.) Algorithms and Computation, Proceedings, pp. 250–259, LNCS 2906, Springer-Verlag, 2003. To appear in Algorithmica. ¨ ne, R. Klein, and G. Rote, On geometric dilation and halving [7] A. Dumitrescu, A. Ebbers-Baumann, A. Gru chords, Workshop on Algorithms and Data Strucures (WADS’05), Ottawa. [8] D. Eppstein, Spanning trees and spanners, in Handbook of Computational Geometry, J.-R. Sack and J. Urrutia, eds., Elsevier Science, Amsterdam, 1999, pp. 425–461. [9] M. Farshi, P. Giannopoulos, and J. Gudmundsson, Finding the best shortcut in a geometric network, 21st Ann. ACM Symp. Comput. Geom. (2005), pp. 327–335. [10] G. N. Frederickson, Fast algorithms for shortest paths in planar graphs, with applications, SIAM J. Comput., 16 (1987), pp. 1004–1022. [11] D. Haussler and E. Welzl, Epsilon-nets and simplex range queries, Discrete Comput. Geom. 2 (1987), pp. 127–151. [12] S. Langerman, P. Morin, and M. Soss, Computing the maximum detour and spanning ratio of planar chains, trees and cycles, In Proceedings of the 19th International Symposium on Theoretical Aspects of Computer Science (STACS 2002), volume 2285 of LNCS, pages 250–261. Springer-Verlag, 2002. [13] N. Linial, E. London, and Y. Rabinovich, The geometry of graphs and some of its algorithmic applications, Combinatorica, 15 (1995), pp. 215–245.

10

[14] G. Narasimhan and M. Smid, Approximating the stretch factor of Euclidean Graphs, SIAM J. Comput., 30(3) (2000), pp. 978–989. [15] G. Narasimhan and M. Smid, Geometric Spanner Networks, Cambridge University Press, to appear. ¨ffer, Graph spanners, J. Graph Theory, 13 (1989), pp. 99–116. [16] D. Peleg and A. Scha [17] M. Sharir and P. Agarwal, Davenport-Schinzel sequences and their geometric applications, Cambridge University Press, New York, 1995. [18] M. Smid, Closest-point problems in computational geometry, in Handbook of Computational Geometry, J.-R. Sack and J. Urrutia, eds., Elsevier Science, Amsterdam, 1999, pp. 877–935.

11

Suggest Documents