δδ -Greedy t -spanner Gali Bar-On and Paz Carmi
Department of Computer Science,Ben-Gurion University of the Negev, Israel
Abstract.
We introduce a new geometric spanner, δ - Greedy , whose con-struction is based on a generalization of the known
Path-Greedy and
Gap-Greedy spanners. The δ -Greedy spanner combines the most desir-able properties of geometric spanners both in theory and in practice.More specifically, it has the same theoretical and practical properties asthe Path-Greedy spanner: a natural definition, small degree, linear num-ber of edges, low weight, and strong (1 + ε )-spanner for every ε >
0. The δ -Greedy algorithm is an improvement over the Path-Greedy algorithmwith respect to the number of shortest path queries and hence with re-spect to its construction time. We show how to construct such a spannerfor a set of n points in the plane in O ( n log n ) time.The δ -Greedy spanner has an additional parameter, δ , which indicateshow close it is to the Path-Greedy spanner on the account of the numberof shortest path queries. For δ = t the output spanner is identical to thePath-Greedy spanner, while the number of shortest path queries is, inpractice, linear.Finally, we show that for a set of n points placed independently at ran-dom in a unit square the expected construction time of the δ -Greedy al-gorithm is O ( n log n ). Our analysis indicates that the δ -Greedy spannergives the best results among the known spanners of expected O ( n log n )time for random point sets. Moreover, the analysis implies that by set-ting δ = t , the δ -Greedy algorithm provides a spanner identical to thePath-Greedy spanner in expected O ( n log n ) time. Given a set P of points in the plane, a Euclidean t -spanner for P is an undirectedgraph G , where there is a t -spanning path in G between any two points in P . Apath between points p and q is a t -spanning path if its length is at most t timesthe Euclidean distance between p and q (i.e., t | pq | ).The most known algorithm for computing t -spanner is probably the Path-Greedy spanner. Given a set P of n points in the plane, the Path-Greedy spanneralgorithm creates a t -spanner for P as follows. It starts with a graph G havinga vertex set P , an empty edge set E and (cid:0) n (cid:1) pairs of distinct points sorted ina non-decreasing order of their distances. Then, it adds an edge between p and q to the set E if the length of the shortest path between p and q in G is morethan t | pq | , see Algorithm 1 for more details. It has been shown in [7, 8, 11, 10,16, 20] that for every set of points, the Path-Greedy spanner has O ( n ) edges, a a r X i v : . [ c s . C G ] F e b lgorithm 1 Path-Greedy(
P, t ) Input:
A set P of points in the plane and a constant t > Output: A t -spanner G ( V, E ) for P sort the (cid:0) n (cid:1) pairs of distinct points in non-decreasing order of their distancesand store them in list L E ←− ∅ for ( p, q ) ∈ L consider pairs in increasing order do π ←− length of the shortest path in G between p and q if π > t | pq | then E := E ∪ | pq | return G = ( P, E )bounded degree and total weight O ( wt ( M ST ( P ))), where wt ( M ST ( P )) is theweight of a minimum spanning tree of P . The main weakness of the Path-Greedyalgorithm is its time complexity – the naive implementation of the Path-Greedyalgorithm runs in near-cubic time. By performing (cid:0) n (cid:1) shortest path queries,where each query uses Dijkstra’s shortest path algorithm, the time complexityof the entire algorithm reaches O ( n log n ), where n is the number of points in P . Therefore, researchers in this field have been trying to improve the Path-Greedy algorithm time complexity. For example, the Approximate-Greedy algo-rithm generates a graph with the same theoretical properties as the Path-Greedyspanner in O ( n log n ) time [12, 18]. However, in practice there is no correlationbetween the expected and the unsatisfactory resulting spanner as shown in [13,15]. Moreover, the algorithm is complicated and difficult to implement.Another attempt to build a t -spanner more efficiently is introduced in [14,13]. This algorithm uses a matrix to store the length of the shortest path betweenevery two points. For each pair of points, it first checks the matrix to see if thereis a t -spanning path between these points. In case the entry in the matrix for thispair indicates that there is no t -spanning path, it performs a shortest path queryand updates the matrix. The authors in [13] have conjectured that the numberof performed shortest path queries is linear. This has been shown to be wrongin [4], as the number of shortest path queries may be quadratic. In addition, Boseet al. [4] have shown how to compute the Path-Greedy spanner in O ( n log n )time. The main idea of their algorithm is to compute a partial shortest pathand then extend it when needed. However, the drawback of this algorithm isthat it is complex and difficult to implement. In [1], Alewijnse et al. computethe Path-Greedy spanner using linear space in O ( n log n ) time by utilizing thePath-Greedy properties with respect to the Well Separated Pair Decomposition(WSPD). In [2], Alewijnse et al. compute a t -spanner in O ( n log n log log n )expected time by using bucketing for short edges and by using WSPD for longedges. Their algorithm is based on the assumption that the Path-Greedy spannerconsists of mostly short edges.Additional effort has been put in developing algorithms for computing t -spanner graphs, such as θ -Graph algorithm [9, 17], Sink spanner, Skip-List span-2er [3], and WSPD-based spanners [6, 5]. However, none of these algorithmsproduces a t -spanner as good as the Path-Greedy spanner in all aspects: size,weight and maximum degree, see [13, 15].Therefore, our goal is to develop a simple and efficient algorithm that achievesboth the theoretical and practical properties of the Path-Greedy spanner. In thispaper we introduce the δ -Greedy algorithm that constructs such a spanner fora set of n points in the plane in O ( n log n ) time. Moreover, we show that fora set of n points placed independently at random in a unit square the expectedrunning time of the δ -Greedy algorithm is O ( n log n ). δ -Greedy In this section we describe the δ -Greedy algorithm (Section 2.1) for a given set P of points in the plane, and two real numbers t and δ , such that 1 < δ ≤ t .Then, in Section 2.2 we prove that the resulting graph is indeed a t -spanner withbounded degree. Throughout this section we assume that δ < t (for example, δ = t or δ = t ), except in Lemma 4, where we consider the case that δ = t . For each point p ∈ P we maintain a collection of cones C p with the propertythat for each point q ∈ P that lies in C p there is a t -spanning path between p and q in the current graph. The main idea of the δ -Greedy algorithm is to ensurethat two cones of a constant angle with apexes at p and q are added to C p andto C q , respectively, each time the algorithm runs a shortest path query betweenpoints p and q .The algorithm starts with a graph G having a vertex set P , an empty edgeset, and an initially empty collection of cones C p for each point p ∈ P . Thealgorithm considers all pairs of distinct points of P in a non-decreasing order oftheir distances. If p ∈ C q or q ∈ C p , then there is already a t -spanning path thatconnects p and q in G , and there is no need to check this pair. Otherwise, let d be the length of the shortest path that connects p and q in G divided by | pq | .Let c p ( θ, q ) denote the cone with apex at p of angle θ , such that the ray → pq isits bisector. The decision whether to add the edge ( p, q ) to the edge set of G ismade according to the value of d . If d > δ , then we add the edge ( p, q ) to G , acone c p (2 θ, q ) to C p , and a cone c q (2 θ, p ) to C q , where θ = Π − arcsin( √ · t ). If d ≤ δ , then we do not add this edge to G , however, we add a cone c p (2 θ, q ) to C p and a cone c q (2 θ, p ) to C q , where θ = Π − arcsin( d √ · t ).In Algorithm 2, we give the pseudo-code description of the δ -Greedy algo-rithm. In Figure 1, we illustrate a cone collection C p of a point p and how itis modified during the three scenarios of the algorithm. The figure contains thepoint p , its collection C p colored in gray, and three points v , u , and w , suchthat | pv | < | pu | < | pw | . Point v lies in C p representing the first case, where thealgorithm does not change the spanner and proceeds to the next pair without3erforming a shortest path query. The algorithm runs a shortest path query be-tween p and u , since u / ∈ C p (for the purpose of illustration assume p / ∈ C u ).Figure 1(b) describes the second case of the algorithm, where the length of theshortest path between p and u is at most δ | pu | . In this case the algorithm addsa cone to C p without updating the spanner. Figure 1(c) describes the third caseof the algorithm, where the length of the shortest path between p and w is morethan δ | pw | . In this case the algorithm adds a cone to C p and the edge ( p, w ) tothe spanner. Algorithm 2 δ -Greedy Input:
A set P of points in the plane and two real numbers t and δ s.t. 1 < δ ≤ t Output: A t -spanner for P sort the (cid:0) n (cid:1) pairs of distinct points in non-decreasing order of their distances(breaking ties arbitrarily) and store them in list L E ←− ∅ /* E is the edge set */ C p ←− ∅ ∀ p ∈ P /* C p is set of cones with apex at p */ G ←− ( P, E ) /* G is the resulting t -spanner */ for ( p, q ) ∈ L consider pairs in increasing order do if ( p / ∈ C q ) and ( q / ∈ C p ) then d ←− length of the shortest path in G between p and q divided | pq | if d > δ then E ←− E ∪ { ( p, q ) } d ←− θ ←− Π − arcsin( d √ · t ) /* θ − sin θ = td */ c p (2 θ, q ) ←− cone of angle 2 θ with apex at p and bisector → pq c q (2 θ, p ) ←− cone of angle 2 θ with apex at q and bisector → qp C p ←− C p ∪ c p (2 θ, q ) C q ←− C q ∪ c q (2 θ, p ) return G = ( P, E ) vu pw ( a ) vu pw ( b ) vu pw ( c ) Fig. 1.
The three scenarios of the δ -Greedy algorithm. (a) v ∈ C p ; (b) u / ∈ C p and d ≤ δ ; (c) w / ∈ C p and d > δ . 4 .2 Algorithm analysis In this section we analyze several properties of the δ -Greedy algorithm, includingthe spanning ratio and the degree of the resulting graph.The following lemma is a generalization of Lemma 6.4.1. in [19]. Lemma 1.
Let t and δ be real numbers, such that ≤ δ ≤ t . Let p , q , and r bepoints in the plane, such that1. p (cid:54) = r ,2. | pr | ≤ | pq | ,3. θ − sin θ ≤ tδ , where θ is the angle ∠ rpq ( i.e., ∠ rpq = θ ≤ Π − arcsin( δ √ · t )) .Then δ | pr | + t | rq | ≤ t | pq | .Proof. Let r (cid:48) be the orthogonal projection of r onto segment pq . Then, | rr (cid:48) | = | pr | sin θ , | pr (cid:48) | = | pr | cos θ , and | r (cid:48) q | = | pq | − | pr (cid:48) | . Thus, | r (cid:48) q | = | pq | − | pr | cos θ .By triangle inequality | rq | ≤ | rr (cid:48) | + | r (cid:48) q |≤ | pr | sin θ + | pq | − | pr | cos θ = | pq | − | pr | (cos θ − sin θ ) . We have, δ | pr | + t | rq | ≤ δ | pr | + t ( | pq | − | pr | (cos θ − sin θ ))= t | pq | − t | pr | (cos θ − sin θ ) + δ | pr |≤ t | pq | − t | pr | (cos θ − sin θ ) + t (cos θ − sin θ ) | pr |≤ t | pq | . (cid:117)(cid:116) Lemma 2.
The number of shortest path queries performed by δ -Greedy algo-rithm for each point is O ( t/δ − ) .Proof. Clearly, the number of shortest path queries performed for each point isat most n −
1. Thus, we may assume that t/δ > /n . Consider a point p ∈ P and let ( p, q ) and ( p, r ) be two pairs of points that δ -Greedy algorithm has runshortest path queries for. Assume w.l.o.g. that the pair ( p, r ) has been consideredbefore the pair ( p, q ), i.e., | rp | ≤ | pq | . Let d be the length of the path computedby the shortest path query for ( p, r ) divide by | pr | . If d ≤ δ , then the cone addedto the collection C p has an angle of at least Π − arcsin( δ √ · t ). Otherwise, thealgorithm adds the edge ( p, r ) to G and a new cone to the collection of cones C p ,where the angle of this cone is Π − arcsin( √ · t ). Thus, after the shortest pathquery performed for the pair ( p, r ), the collection C p contains a cone c p ( θ, r ),where θ is at least Π − δ √ · t ). The δ -Greedy algorithm performs a shortestpath query for ( p, q ) only if p / ∈ C q and q / ∈ C p . Thus, the angle ∠ rpq is at least Π − arcsin( δ √ · t ), and we have at most k = πθ shortest path queries for a point.5et us consider the case where t > tδ →
1. The equation θ = Π − arcsin( δ √ · t ) implies that θ − sin θ = tδ . Then, we have θ → , tδ ∼ θ, and θ ∼ tδ − . Thus, we have k ∼ π tδ − = O ( t/δ − ). (cid:117)(cid:116) Observation 1
For δ = t x − x , where x > is a fixed integer, the number ofshortest path queries performed by δ -Greedy algorithm for each point is O ( xt − ) .Proof. As in Lemma 2, let us consider the case where t > tδ →
1. Then,we have θ → , tδ ∼ θ, tt ( x − x ) ∼ θ, t ( x ) ∼ θ,t ∼ (1 + θ ) x , t ∼ x · θ, and θ ∼ t − x . Thus, we have k ∼ πxt − = O ( xt − ). (cid:117)(cid:116) Observation 2
The running time of δ -Greedy algorithm is O ( n log n ( t/δ − ) .Proof. First, the algorithm sorts the (cid:0) n (cid:1) pairs of distinct points in non-decreasingorder of their distances, this takes O ( n log n ) time. A shortest path query is doneby Dijkstra’s shortest path algorithm on a graph with O ( nt/δ − ) edges and takes O ( nt/δ − + n log n ) time. By Lemma 2 each point performs O ( t/δ − ) shortestpath queries. Therefore, we have that the running time of δ -Greedy algorithm is O (( nt/δ − ) log n ). (cid:117)(cid:116) Observation 3
The number of cones that each point has in its collection alongthe algorithm is constant depending on t and δ ( O ( t/δ − ) ).Proof. As shown in Lemma 2, the number of shortest path queries for each pointis O ( t/δ − ). The subsequent step of a shortest path query is the addition of twocones, meaning that for each point p the number of cones in the collection ofcones C p is O ( t/δ − ). (cid:117)(cid:116) Corollary 1.
The additional space for each point p for the collection C p is con-stant. Lemma 3.
The output graph G = ( P, E ) of δ -Greedy algorithm (Algorithm 2)is a t -spanner for P (for < δ < t ).Proof. Let G = ( P, E ) be the output graph of the δ -Greedy algorithm. To provethat G is a t -spanner for P we show that for every pair ( p, q ) ∈ P , there exists a t -spanning path between them in G . We prove the above statement by induction6n the rank of the distance | pq | , i.e., the place of ( p, q ) in a non-decreasingdistances order of all pairs of points in P . Base case:
Let ( p, q ) be the first pair in the ordered list (i.e., the closest pair).The edge ( p, q ) is added to E during the first iteration of the loop in step 9 ofAlgorithm 2, and thus there is a t -spanning path between p and q in G . Induction hypothesis:
For every pair ( r, s ) that appears before the pair ( p, q )in the ordered list, there is a t -spanning path between r and s in G . The inductive step:
Consider the pair ( p, q ). We prove that there is a t -spanning path between p and q in G . If p / ∈ C q and q / ∈ C p , we check whetherthere is a δ -spanning path in G between p and q . If there is a path which lengthis at most δ | pq | , then δ | pq | ≤ t | pq | , meaning there is a t -spanning path between p and q in G . If there is no path of length of at most δ | pq | , we add the edge ( p, q )to G , which forms a t -spanning path.Consider that p ∈ C q or q ∈ C p , and assume w.l.o.g. that q ∈ C p . Let ( p, r )be the edge handled in Step 5 in Algorithm 2 when the cone containing q hasbeen added to C p (Step 12 in Algorithm 2). Notice that | pr | ≤ | pq | . Step 7 ofAlgorithm 2 has computed the value d for the pair ( p, r ). In the algorithm thereare two scenarios depending on the value of d .The first scenario is when d > δ , then the algorithm has added the edge ( p, r )to G and a cone c p ( θ, r ) to C p , where θ = 2( Π − arcsin( √ · t )). Thus, the anglebetween ( p, q ) and ( p, r ) is less than θ/
2. Hence, | rq | < | pq | and by the inductionhypothesis there is a t -spanning path between r and q . Consider the shortestpath between p and q that goes through the edge ( p, r ). The length of this pathis at most | pr | + t | rq | . By Lemma 1, we have | pr | + t | rq | ≤ δ | pr | + t | rq | ≤ t | pq | for δ = 1. Therefore, we have a t -spanning path between p and q .The second scenario is when d ≤ δ , then the algorithm has added a cone c p ( θ, r ) to C p , where θ = 2( Π − arcsin( d √ · t )). Thus, the angle between ( p, q )and ( p, r ) is less than θ/
2. Hence, | rq | < | pq | and by the induction hypothesisthere is a t -spanning path between r and q . Consider the shortest path between p and q that goes through r . The length of this path is at most d | pr | + t | rq | . ByLemma 1, we have d | pr | + t | rq | ≤ t | pq | . Therefore, we have a t-spanning pathbetween p and q . (cid:117)(cid:116) Theorem 4.
The δ -Greedy algorithm computes a t -spanner for a set of points P with the same properties as the Path-Greedy t -spanner, such as degree andweight, in O (( nt/δ − ) log n ) time.Proof. Clearly, the degree of the δ -Greedy is at most the degree of the Path-Greedy δ -spanner. The edges of the δ -Greedy spanner satisfy the δ -leap frogproperty, thus, the weight of the δ -Greedy is as Path-Greedy t -spanner. Hence,we can pick δ close to t , such that we will have the required bounds. (cid:117)(cid:116) Lemma 4. If t = δ , the result of the δ -Greedy algorithm is identical to the resultof the Path-Greedy algorithm.Proof. Assume towards contradiction that for t = δ the resulting graph of the δ -Greedy algorithm, denoted as G = ( P, E ), differs from the result of the Path-Greedy algorithm, denoted as G (cid:48) = ( P, E (cid:48) ). Assuming the same order of the7orted edges, let ( p, q ) be the first edge that is different in G and G (cid:48) . Noticethat δ -Greedy algorithm decides to add the edge ( p, q ) to G when there is no t -spanning path between p and q in G . Since until handling the edge ( p, q ) thegraphs G and G (cid:48) are identical, the Path-Greedy algorithm also decides to addthe edge ( p, q ) to G (cid:48) . Therefore, the only case we need to consider is ( p, q ) ∈ E (cid:48) and ( p, q ) / ∈ E . The δ -Greedy algorithm does not add an edge ( p, q ) to G in twoscenarios: • there is a t -spanning path between p and q in the current graph G – whichcontradicts that the Path-Greedy algorithm adds the edge ( p, q ) to G (cid:48) ; • p ∈ C q or q ∈ C p – the δ -Greedy algorithm does not perform a shortestpath query between p and q . Assume w.l.o.g., q ∈ C p , and let ( p, r ) be theedge considered in Step 5 in Algorithm 2 when the cone containing q hasbeen added to C p . The angle of the added cone is θ = Π − d √ · t ),where d is the length of the shortest path between p and r divided | pr | . Thus,we have | pr | ≤ | pq | and α − sin α ≤ td , where α ≤ θ is the angle ∠ rpq . Then,by Lemma 1, δ | pr | + t | rq | ≤ t | pq | , and since there is a path from p to r oflength at most δ | pr | , we have that there is t -spanning path between p and q in the current graph. This is in contradiction to the assumption that thePath-Greedy algorithm adds the edge ( p, q ) to E (cid:48) . (cid:117)(cid:116) δ -Greedy in Expected O ( n log n ) Time for Random Set In this section we show how a small modification in the implementation im-proves the running time of the δ -Greedy algorithm. This improvement yieldsan expected O ( n log n ) time for random point sets. The first modification is torun the shortest path query between points p to q up to δ | pq | . That is, runningDijkstras shortest path algorithm with source p and terminating as soon as theminimum key in the priority queue is larger than δ | pq | .Let P be a set of n points in the plane uniformly distributed in a unitsquare. To prove that δ -Greedy algorithm computes a spanner for P in expected O ( n log n ) time, we need to show that: • each point runs a constant number of shortest path queries – follows fromLemma 2; • the expected number of points visited in each query is constant – The factthat the points are randomly chosen uniformly in the unit square impliesthat the expected number of points at distance of at most r from point p is Θ ( r · n ). A shortest path query from a point p to a point q terminatesas soon as the minimum key in the priority queue exceeds δ | pq | , thus, it isexpected to visit O ( n · ( δ | pq | ) ) points.By Lemma 2 the number of shortest path queries performed by the algorithmfor a point p is O ( t/δ − ). Each such query defines a cone with apex at p ofangle Ω ( t/δ − p will be8erformed to a point in this cone. By picking k = t/δ − and r = k √ n , wehave that the expected number of points around each point in a distance of r is Θ ( k ) = Θ ( t/δ − ).Assume we partition the plane into k equal angle cones with apex at point p .The probability that there exists a cone that does not contain a point fromthe set of points of distance k √ n is at most k · (1 − k ) k . Let Q be the setof points that p computed a shortest path query to, and let q ∈ Q be thefarthest point in Q from p . Then, the expected Euclidean distance between p and q is less than k √ n . Thus, the expected number of points visited by theentire set of shortest path queries from a point is O ( δ k t/δ − ) = O ( δ ( t − δ ) ); • the next pair to be processed can be obtained in expected O (log n ) timewithout sorting all pairs of distinct points – Even-though this is quitestraight forward, for completeness we give a short description how this canbe done. Divide the unit square to n × n grid cells of side length 1 /n . A hashtable of size 3 n is initialized, and for each non-empty grid cell (at most n such cells) we map the points in it to the hash table. In addition, we maintaina minimum heap H p for each point p ∈ P (initially empty), and one mainminimum heap H that contains the top element of each H p . Each heap H p contains a subset of the pairs that include p .For each point p ∈ P , all the cells of distance at most k √ n from p are scanned(using the hash table) to find all the points in these cells, where k is aparameter that we fix later. All the points found in these cells are added to H p according to their Euclidean distance from p .The heap H holds the relevant pairs in an increasing order, therefore thepairs are extracted from the main heap H . After extracting the minimumpair in H that belongs to a point p , we add to H the next minimum in H p . To insure the correctness of the heaps, when needed we increase thedistance to the scanned cells. Observe that there may be a pair ( p, q ) suchthat | pq | < | rw | , where the pair ( r, w ) is the top pair in H . This can occuronly when the pair ( p, q ) has not been added to H p nor H q , and this happenswhen p ∈ C q or q ∈ C p . However, in this case we do not need to consider thepair ( p, q ).Notice that the only cells that are not contained in C p are scanned to addmore pairs to H p . Thus, points that are in C p are ignored.Therefore, the total expected running time of the algorithm is O ( δ ( t − δ ) n log n ).Since both t and t/δ are constants bigger than one, the expected running timeof the δ -Greedy algorithm is O ( n log n ).A very nice outcome of δ -Greedy algorithm and its analysis can be seenwhen δ is equal to t . Assume that δ -Greedy algorithm (for δ = t ) has computeda shortest path query for two points p and q and the length of the received pathis d | pq | . If the probability that t/d > ε is low (e.g, less than 1/2), for someconstant ε >
0, then δ -Greedy algorithm computes the Path-Greedy spannerwith linear number of shortest path queries. Thus δ -Greedy algorithm computes9he Path-Greedy spanner for a point set uniformly distributed in a square inexpected O ( n log n ) time.Not surprisingly our experiments have shown that this probability is indeedlow (less than 1/100), since most of the shortest path queries are performed onpairs of points placed close to each other (with respect to Euclidean distance),and thus with a high probability their shortest path contains a constant numberof points. Moreover, it seems that for a “real-life” input this probably is low.Thus, there is a very simple algorithm to compute the Path-Greedy spanner inexpected O ( n log n ) time for real-life inputs, based on the δ -Greedy algorithmFor real-life input we mean that our analysis suggests that in the currentcomputers precision (Memory) one cannot create an instance of points set withmore than 1000 points, where the Path-Greedy spanner based on the δ -Greedyalgorithm has more than O ( n log n ) constructing time. In this section we discuss the experimental results by considering the propertiesof the graphs generated by different algorithms and the number of shortest pathqueries performed during these algorithms. We have implemented the Path-Greedy, δ -Greedy, Gap-Greedy, θ -Graph, Path-Greedy on θ -Graph algorithms.The Path-Greedy on θ -graph t -spanner, first computes a θ -graph t (cid:48) -spanner,where t (cid:48) < t , and then runs the Path-Greedy t/t (cid:48) -spanner on this t (cid:48) -spanner. Theshortest path queries criteria is used for an absolute running time comparisonthat is independent of the actual implementation. The known theoretical boundsfor the algorithms can be found in Table 1.The experiments were performed on a set of 8000 points, with different valuesof the parameter δ (between 1 and t ). We have chosen to present the parameter δ for the values t, t . and √ t . This values do not have special properties, theywhere chosen arbitrary to present the behavior of the spanner.To avoid the effect of specific instances, we have run the algorithms severaltimes and taken the average of the results. However, in all the cases the differencebetween the values is negligible. Table 2–4 show the results of our experimentsfor different values of t and δ . The columns of the weight (divided by wt ( M ST ))and the degree are rounded to integers, and the columns of the edges are roundedto one digit after the decimal point (in k ). Algorithm Edges
Weight wt ( MST ) Degree Time
Path-Greedy O ( nt − ) O (1) O ( t − ) O ( n log n )Gap-Greedy O ( nt − ) O (log n ) O ( t − ) O ( n log n ) θ -Graph O ( nθ ) O ( n ) O ( n ) O ( nθ log n ) δ -Greedy O ( nt/δ − ) O (1) O ( t/δ − ) O ( t/δ − · n log n ) Table 1.
Theoretical bounds of different t -spanner algorithms10 lgorithm δ Edges (in K)
Weight Degree Shortest path wt ( M ST ) queries (in K)Path-Greedy - 35.6 10 17 31996 δ -Greedy 1.1 35.6 10 17 254 δ -Greedy 1 . δ -Greedy 1 .
048 51.6 19 23 204 θ -Graph - 376.6 454 149 -Greedy on θ -Graph 1 . θ -Graph 1 .
048 52 19 23 693Gap-Greedy - 51.6 19 23 326
Table 2.
Comparison between several t -spanner algorithms for t = 1 . Algorithm δ Edges (in K)
Weight Degree Shortest path wt ( M ST ) queries (in K)Path-Greedy - 15 . δ -Greedy 1 . . δ -Greedy 1 .
44 16 3 8 77 δ -Greedy 1 .
224 22 . θ -Graph - 118 . θ -Graph 1 .
44 16 3 8 817Greedy on θ -Graph 1 .
224 22 . . Table 3.
Comparison between several t -spanner algorithms for t = 1 . Algorithm δ Edges (in K)
Weight Degree Shortest path wt ( M ST ) queries (in K)Path-Greedy - 11.4 2 5 31996 δ -Greedy 2 11.4 2 5 55 δ -Greedy 1 .
866 11.9 2 5 52 δ -Greedy 1 .
414 16.3 3 8 44 θ -Graph - 85.3 48 42 -Greedy on θ -Graph 1 .
866 11.9 3 6 493Greedy on θ -Graph 1 .
414 16.5 3 8 129Gap-Greedy - 16 3 8 63
Table 4.
Comparison between several t -spanner algorithms for t = 211 .1 Implementation details All the algorithms mentioned above were implemented in Java using JGraphTand JGraph libraries. The experiments were performed on an Intel Xeon CPUE5-2680 v2 @ 2.80 GHz (2 processors) and 128 GB RAM on Windows Server 2012Standard OS using ECJ for compilation. The sample point sets were generatedby Java.util.Random pseudo random number generator.
The experiments indicate that the δ -Greedy algorithm achieves good resultsin practice as expected. The outcome of the δ -Greedy algorithm for all val-ues of δ , that have been checked, is roughly the same as the results of thePath-Greedy algorithm for all parameters. Compared to other algorithms, the δ -Greedy graphs are superior to the graphs produced by the n -Gap algorithm,and are as good as Path-Greedy on θ -Graph, with significantly a lower numberof shortest path queries. The theoretical complexity of the Path-Greedy on θ -Graph is O ( n log n ), same as the δ -Greedy algorithm. However in practice the δ -Greedy algorithm computes considerably less shortest path queries. Hence,the δ -Greedy algorithm has the same results in weight, size and degree as thePath-Greedy on θ -Graph algorithm with better running time.In addition, Farshi and Gudmundsson in [15] have implemented various span-ner algorithms and shown that the Path-Greedy algorithm for t = 1 . t = 2 on random graphs are almost identical to ours experimental results inweight, size and degree. Moreover, they have shown that Path-Greedy spanneris the highest quality geometric spanner in terms of edge count, degree andweight. They have presented the results for t = 1 . t = 2 on randompoint set with 8000 points. Moreover, they have shown that the θ -Graph span-ner achieves in practice the best results after the Path-Greedy spanner for allparameters that have been tested (size, weight and degree) comparing to otherspanners that they have implemented (such as the Approximate-Greedy, theWSPD-spanner, Skip-list and Sink-Spanner). Our experiments show that the δ -Greedy spanner achieves better results than the θ -Graph spanner. Thus, com-bining this with the results in [15], we conclude that the δ -spanner achievesthe highest quality geometric spanner with respect to θ -Graph, Approximate-Greedy, the WSPD-spanner, Skip-list, Sink-Spanner, and Gap-Greedy spanners.The experiments reinforce the analysis that picking δ very close to t (forexample δ = t . ), the results are very close to the Path-Greedy spanner, andthe number of the performed shortest paths queries is still small. Moreover,the experiments show that the number of shortest path queries is linear whileselecting δ = t and obtaining the δ -Greedy spanner identical to the Path-Greedy t -spanner.The experiments presented in this paper were performed on set of pointsplaced independently at random in a unit square. However, we conjecture thatthe δ -Greedy algorithm computes a t -spanner in expected O ( n log n ) time foralmost all realistic inputs, that is, the δ -Greedy algorithm computes a t -spanner12n expected O ( n log n ) time for point sets that are not deliberately hand-madeto cause a higher number of shortest path queries. We would like to thank Rachel Saban for implementing the algorithms.
References
1. S. P. A. Alewijnse, Q. W. Bouts, A. P. ten Brink, and K. Buchin. Computing thegreedy spanner in linear space.
Algorithmica , 73(3):589–606, 2015.2. S. P. A. Alewijnse, Q. W. Bouts, Alex P. ten Brink, and K. Buchin. Distribution-sensitive construction of the greedy spanner.
Algorithmica , pages 1–23, 2016.3. S. Arya, D. M. Mount, and M. H. M. Smid. Randomized and deterministic algo-rithms for geometric spanners of small diameter. In
FOCS , pages 703–712, 1994.4. Prosenjit Bose, Paz Carmi, Mohammad Farshi, Anil Maheshwari, and MichielH. M. Smid. Computing the greedy spanner in near-quadratic time. In
SWAT ,pages 390–401, 2008.5. P. B. Callahan and S. R. Kosaraju. A decomposition of multi-dimensional point-sets with applications to k-nearest-neighbors and n-body potential fields. In
STOC ,pages 546–556, 1992.6. Paul B. Callahan. Optimal parallel all-nearest-neighbors using the well-separatedpair decomposition. In
FOCS , pages 332–340, 1993.7. B. Chandra, G. Das, G. Narasimhan, and J. Soares. New sparseness results ongraph spanners.
Int. J. Comp. Geom. and Applic. , 5:125–144, 1995.8. Barun Chandra. Constructing sparse spanners for most graphs in higher dimen-sions.
Inf. Process. Lett. , 51(6):289–294, 1994.9. Kenneth L. Clarkson. Approximation algorithms for shortest path motion plan-ning. In
STOC , pages 56–65, 1987.10. G. Das, P. J. Heffernan, and G. Narasimhan. Optimally sparse spanners in 3-dimensional Euclidean space. In
SoCG , pages 53–62, 1993.11. G. Das and G. Narasimhan. A fast algorithm for constructing sparse Euclideanspanners.
Int. J. Comp. Geom. and Applic. , 7(4):297–315, 1997.12. Gautam Das and Giri Narasimhan. A fast algorithm for constructing sparse Eu-clidean spanners.
Int. J. Comp. Geom. and Applic. , 7(4):297–315, 1997.13. M. Farshi and J. Gudmundsson. Experimental study of geometric t-spanners: Arunning time comparison. In
WEA , pages 270–284, 2007.14. Mohammad Farshi and Joachim Gudmundsson. Experimental study of geometric t -spanners. In ESA , pages 556–567, 2005.15. Mohammad Farshi and Joachim Gudmundsson. Experimental study of geometric t -spanners. ACM Journal of Experimental Algorithmics , 14, 2009.16. Joachim Gudmundsson, Christos Levcopoulos, and Giri Narasimhan. Fast greedyalgorithms for constructing sparse geometric spanners.
SIAM J. Comput. ,31(5):1479–1500, 2002.17. J. Mark Keil. Approximating the complete Euclidean graph. In
SWAT , pages208–213, 1988.18. Christos Levcopoulos, Giri Narasimhan, and Michiel H. M. Smid. Improved algo-rithms for constructing fault-tolerant spanners.
Algorithmica , 32(1):144–156, 2002.
9. Giri Narasimhan and Michiel Smid.
Geometric Spanner Networks . CambridgeUniversity Press, New York, NY, USA, 2007.20. Jos´e Soares. Approximating Euclidean distances by small degree graphs.
Discrete& Computational Geometry , 11(2):213–233, 1994., 11(2):213–233, 1994.