A -spanner of a graph is a subgraph of in which the distance between every pair of vertices is at most times their distance in , where is called the stretch of the spanner. Sparse spanner is an important choice to implicitly presenting all-pair distances , and spanners also have application background in distributed systems and communication networks. For undirected graphs, -spanner with edges is proposed and conjectured to be optimal [2, 16]. However, directed graphs may not have sparse spanners with respect to normal distance measure. For instance, in a bipartite graph with two sides and , if there is an directed edge from every vertex in to every vertex in , then removing any edge in this graph will destroy the reachability from to , so its only spanner is itself, which has edges. To circumvent this obstacle, one can approximate the optimal spanner in terms of edge size (e.g. in [9, 3]), or can define directed spanners on different distance measures. This paper will study directed sparse spanners on roundtrip distances.
Roundtrip distance is a natural metric with good property. Cowen and Wagner [7, 8] first introduce it into directed spanners. Formally, roundtrip distance between vertices is defined as , where is the length of shortest path from to . For a directed graph , a subgraph () is called a -roundtrip-spanner of if . is called the stretch of the roundtrip spanner.
In directed graph () with real edge weights in , Roditty et al.  provides a -spanner with , edges. Recently, Zhu and Lam  derandomizes it and improves the size to edges, while the stretch is also . We make a step further based on these works and reduce the stretch to . Formally, we state our main results in the following theorem.
For any directed graph with maximum edge weight and integer , there exists a -roundtrip spanner of with edges, and a -roundtrip spanner of with edges for any constant . Both spanners can be constructed in time.
Actually, our result almost matches the lower bound following girth conjecture. The girth conjecture, implicitly mentioned by Erdös , says that for any , there exists a graph with vertex and edges whose girth (minimum cycle) is at least . This conjecture implies that no algorithm can construct a spanner of size and less than stretch for all undirected graph with vertices . This lower bound also holds for roundtrip spanners on directed graphs.
Our approach is based on the scaling constructions of the -stretch roundtrip spanners in [15, 17]. To reduce the stretch, we construct inward and outward shortest path trees from vertices in a hitting set [1, 10] of size , and carefully choose the order to process vertices in order to make the stretch exactly . To further make the size of the spanner strongly subquatratic, we use a similar approach as in  to contract small edges in every scale.
1.1 Related Works
Like many previous works aiming at constructing sparse roundtrip spanners with small stretch, this paper also has construction time. Pachoci et al.  proposes an algorithm which can construct -roundtrip-spanner with edges. Its construction time is , which breaks the cubic time barrier. Very recently, Chechik et al.  give an algorithm which constructs -roundtrip-spanner with edges in time.
For spanners defined with respect to normal directed distance, researchers aim to approximate the -spanner with minimum number of edges. Dinitz and Krauthgamer  achieve approximation in terms of edge size, and Bermen et al.  improves the approximation ratio to .
Another type of directed spanners is transitive-closure spanner, introduced by Bhattacharyya et al. . In this setting the answer may not be a subgraph of , but a subgraph of the transitive closure of . In other words, selecting edges outside the graph is permitted. The tradeoff is between diameter (maximum distance) and edge size. One of Bhattacharyya et al.’s results is spanner with diameter and approximate to optimal edge size 
, using a combination of linear programming rounding and sampling. Berman et al. improves the approximation ratio to . We refer to Raskhodnikova  as a review of transitive-closure spanner.
In this paper we consider a directed graph with non-negative real edge weights where for all . Denote to be the subgraph of induced by , i.e. . A roundtrip path between nodes and is a cycle (not necessarily simple) passing through and . The roundtrip distance between and is the minimum length of roundtrip paths between and . Denote to be the roundtrip distance between and in . (Sometimes we may also use to denote a roundtrip shortest path between in .) It satisfies:
For , and .
If is the distance from to in , then .
For , .
Here is the one-way distance from to in . Of course is just the roundtrip distance between and in the original graph .
In , a -roundtrip spanner of in a subgraph of on the same vertex set such that the roundtrip distance between any pair of in is at most . is called the stretch of the spanner.
Given a center and a radius , define roundtrip ball to be the set of vertices whose roundtrip distance on to center is strictly smaller than the radius . Formally, . Then the size of the ball, denoted by , is the number of vertices in it. Similarly we define .
InOutTrees calculates the edge set of an inward and an outward shortest path tree centered at spanning vertices in on . (That is, the shortest path tree from to all vertices in and the shortest path tree from all vertices in to .)
It is easy to see that the shortest path trees will not contain vertices outside :
The inward and outward shortest path trees returned by
InOutTrees only contains vertices in .
For any , let be a cycle containing and such that the length of is less than . Then for any vertex , , so must be also in the trees returned by
For all notations above, we can omit the subscript when the roundtrip distance is considered in the original graph . Our algorithm relies on the following well-known theorem to calculate hitting sets deterministically.
3 A -Roundtrip-Spanner Algorithm
In this section we introduce our main algorithm constructing a -roundtrip-spanner with edges for any . We may assume in the following analysis, since the result is trivial for .
Our approach combines the idea of  and . In , given a length , we pick an arbitrary vertex and find the smallest integer such that , then we include the inward and outward shortest path tree centered at spanning and remove vertices in from . We can see that , so the stretch is for with roundtrip distance , and by a scaling approach the final stretch is . We observe that if , , so by Theorem 3 we can preprocess the graph by choosing a hitting set with size and construct inward and outward shortest path trees centered at all vertices in , then we do not need to include the shortest path trees spanning . The stretch can then be decreased to . To make the stretch equals , instead of arbitrarily selecting each time, we carefully define the order to select .
We first define a radius for each vertex . It is crucial for the processing order of vertices.
For all , we define to be the maximum length such that , that is, if we sort the vertices by their roundtrip distance to in by increasing order, is the roundtrip distance from to the -th vertex.
For any , . By Theorem 3, we can find a hitting set intersecting all sets in , such that . For all , we build an inward and an outward shortest path tree of centered at , and denote the set of edges of these trees by and include them in the final spanner. This step generates edges in total, and it is easy to obtain the following statement:
For such that , the roundtrip distance between and in the graph is at most .
Find the vertex such that , that is, . Then the inward and outward shortest path trees from will include and . By , we have . So the roundtrip distance of and in is at most . ∎
3.2 Approximating a Length Interval
Instead of approximating all roundtrip distances at once, we start with an easier subproblem of approximating all pairs of vertices whose roundtrip distance is within an interval .
Parameter is a real number in . The procedure
Cover() described in Algorithm 1 will return a set of edges which gives a -approximation of roundtrip distance if for .
Note that in this algorithm, initially and the balls are considered in . In the end of every iteration we remove a ball from , and the following balls are based on the roundtrip distances in . However, does not need to change during the algorithm, which can still be based on roundtrip distances in the original graph . The analysis for the size of the returned set and the stretch are as follows.
The returned edge set of
Cover() has size.
When processing a vertex , by the selection of in line 5, and . When it is because of ’s minimality, and when it is because .
So each time
InOutTrees is called, the size of ball to build shortest path trees is no more than times the size of ball to remove.
During an execution of
Cover(), each vertex is removed
once from .
Therefore the total size of edges added in is .
We can also see the if the procedure
Cover() is run on a subgraph induced on a subset , then the size of is bounded by . It is also easy to see that is at most by our choice of :
The selected at line 5 in
Cover() satisfies .
In , the ball must have size no greater than since the distance in cannot be decreased and some vertices may be removed. Since and , we get , thus . ∎
Next we analysis the roundtrip distance stretch in . Note that in order to make the final stretch , for the roundtrip distance approximated by edges in we can make the stretch , but for the roundtrip distance approximated by we need to make the stretch at most as stays the same.
Consider any pair of vertices with roundtrip distance , and a shortest cycle going through with length .
Cover(), consider the vertices on that are first removed from . Suppose is one of the first removed vertices, and is removed as a member of centered at .
This is to say .
Case 1: . Then
The second inequality holds because is the remaining vertex set before removing , so by definition of , all vertices on are in .
InOutTrees( builds a detour cycle passing with length .
By Lemma 7, we have . Also , therefore we build a detour of length in .
Case 2: . Because , this case can only occur when . Because is chosen before , . By Lemma 5, can give a -approximation of .
3.3 Main Construction
Now we can proceed to prove the first part of the main theorem based on a scaling on lengths of the cycles from to .
For any directed graph with real edge weights in , there exists a polynomial time constructible -roundtrip-spanner of with edges.
Note that the roundtrip distance between any pair of vertices must be in the range .
First do the preprocessing in Section 3.1.
Then devide the range of roundtrip distance into intervals , where .
Cover() for , and merge all returned edges to form a spanner.
First we prove that the edge size is .
Preprocessing adds edges.
Cover() is called for
By Lemma 6, each call generates edges.
So the total number of edges in the roundtrip spanner is .
Next we prove the stretch is .
For any pair of vertices with roundtrip distance , let , then .
By Lemma 8, either the returned edge set of
Cover() can form a detour cycle passing through of length at most , or the edges in can form a detour cycle passing through of length at most .
In conclusion this algorithm can construct a -roundtrip-spanner with edges. ∎
3.4 Construction Time
The running time of the algorithm in the proof of Theorem 9 is , in which the bottleneck is the single-source shortest paths calls. It is also easy to see that the algorithm is deterministic. Next we analysis construction time in detail.
Cover call’s while loop runs at most times since each time at least one node is removed.
In a loop, can be found in , and all other operations regarding roundtrip balls can be done in linear time by Dijkstra searches starting at on .
Cover call takes time.
Cover is called times.
Combined with the preprocessing time, the total construction time is .
4 Removing the Dependence on
The size of the roundtrip spanner in Section 3 is dependent on maximum edge weight . In this section we can remove this dependence by designing the scaling approach more carefully, then the stretch will be for any constant .
Our idea is similar to that in . When we consider the roundtrip distances between , all cycles with length have little affect so we can contract them into one node, and all edges with length cannot be in any detour cycles, so it can be deleted. Thus, an edge with length can only be in the iterations for between and (based on the girth of this edge). We can also show that the number of strongly connected components in the graphs considered in all iterations is bounded by , thus we can get an -size spanner. However, to get the -stretch in the presence of contracted nodes, we need a careful analysis.
First we define the girth of an edge, and study its properties:
We define the girth of an edge in to be the length of minimum directed cycle containing , and denote it by .
It is easy to see that for , . In time we can compute for all edges in . We can get the following observation:
Given a length , the edge set returned by
Cover() does not include edges with .
Cover() we include in-out-trees (in a subgraph of G) from with radius , where by Lemma 7 and , so the radius is at most . Any edge with girth greater than cannot be in such in-out-trees.
The main algorithm is shown in Algorithm 2.
We can check that Lemma 8 still holds when calling
Cover() w.r.t. and the weights adjusted in line 8 in the current graph . We adjust the weight in in order to give an upper bound of the roundtrip distance in the original graph :
In the graph during the algorithm, if a contracted vertex in contains original vertices of , then every is in a cycle in the subgraph of length at most . So the roundtrip distances between vertices in are at most .
If an edge is contracted in , then . Every edge in the cycle with length must have , so such edges are also contracted to the same vertex in . It is also easy to see that the roundtrip distance between is at most since every contracted edge corresponds to a cycle of length . ∎
For in the original graph, let the contracted vertices in containing them are , respectively. If and are different and strongly connected in , then their roundtrip distance in the weight adjusted graph satisfies .
In the minimum cycle containing and in the original graph , for the vertices in the cycle which is contracted to a vertex in , find the first and last vertices contracted to in the cycle, and call them and . Then by Lemma 12, if contains original vertices. When we contract and to in and adjust the weights in line 8, we add to every edge pointing to , which is at least the distance from to , thus we have . Also in every roundtrip distance in , the amount of adjustment is at most , so . ∎
Since can be seen as a graph contracted from if , we have the following corollary:
During the algorithm
Spanner(), when more and more edges are contracted, the roundtrip distance between every pair of vertices cannot decrease in the weight adjusted .
By Lemma 11,
Cover() will not include edges with girth longer than in the weight adjusted , thus will not include edges with girth longer than in . We include line 7 for our analysis, but it is not necessary.
The subgraph returned by algorithm
Spanner() has edges.
Preprocessing adds edges as in Section 3.1.
Next we count
Cover()’s returned edges.
We remove the directions of all edges in to get an undirected graph , and remove the directions of all edges in every to get an undirected graph , but define the weight of an edge in and every to be the girth in . Let be a minimum spanning forest of w.r.t. the girth . We can see that in iteration , if we remove edges in with and contract edges with in , then the connected components in will just be the connected components in , which are the strongly connected components in . This is because of the cycle property of MST: If an edge in has , then in all edges in the path connecting have girth , thus are already contracted; If an edge in has , then in all edges in the path connecting have girth , so are in the same component in .
So the total size of connected components in is at most 2 times the number of edges in with , and every edge in can be in at most number of different . Thus, the total number of connected components with size at least 2 in all is bounded by .
By Lemma 6, after calling
Cover(), will have new edges for every connected component with in . Thus the total number of edges in the subgraph returned by
Spanner() is bounded by .
We can now prove the stretch of this roundtrip spanner. Note that in the algorithm is an upper bound for the roundtrip distance in , but not for the original distance in , so we need to analyze it carefully.
Spanner() constructs a -roundtrip-spanner of .
We prove it by the induction on . When is small, there is no contract vertices in , then it is the same as Lemma 8, so we get the -stretch. Next we assume that the distances between vertices of contracted in the same vertex in have a -approximation in . (Thus, they are strongly connected in .)
For any pair of vertices with roundtrip distance on . By Lemma 13 and Corollary 14, there exists a such that in the roundtrip distance between and satisfies , where are the contracted vertices in containing , respectively. (Suppose , then , and . And in the roundtrip distance cannot be smaller than in and , when . So can be or .)
By Lemma 8, either
Cover()’s returned edge set can form a detour cycle with length at most on graph , or .
In the latter case since in weight adjusted distance cannot be decreased, and some vertices are contracted in , in the original graph must also be smaller than , by Lemma 5, in the roundtrip distance between is at most . (This is because we have by Lemma 13.)
In the former case, by inductive hypothesis, the original vertices contracted in one vertex in are strongly connected in , so the roundtrip distance between and in final is at most
( and is not too small.) ∎
Note that we can make the stretch to be for any constant if we contract edges with girth in line 6.
4.1 Construction Time
The analysis of
Spanner’s running time is similar to Section 3.4.
Compared with the primary version,
Spanner adds operations of building and recalculating weights and before each
We also need to calculate in preprocessing, which can done by Dijkstra searches.
can be built in time.
Recalculating takes and recalculating weights takes time.
Cover is called times.
Therefore the total construction time is still .
Donald Aingworth, Chandra Chekuri, Piotr Indyk, and Rajeev Motwani.
Fast estimation of diameter and shortest paths (without matrix multiplication).SIAM Journal on Computing, 28(4):1167–1181, 1999.
-  Ingo Althöfer, Gautam Das, David Dobkin, Deborah Joseph, and José Soares. On sparse spanners of weighted graphs. Discrete & Computational Geometry, 9(1):81–100, Jan 1993.
-  Piotr Berman, Arnab Bhattacharyya, Konstantin Makarychev, Sofya Raskhodnikova, and Grigory Yaroslavtsev. Improved approximation for the directed spanner problem. In International Colloquium on Automata, Languages, and Programming, pages 1–12, Berlin, Heidelberg, 2011. Springer.
-  Piotr Berman, Sofya Raskhodnikova, and Ge Ruan. Finding sparser directed spanners. In IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science, pages 424–435, Dagstuhl, 2010. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.
-  A. Bhattacharyya, E. Grigorescu, K. Jung, S. Raskhodnikova, and D. Woodruff. Transitive-closure spanners. SIAM Journal on Computing, 41(6):1380–1425, 2012.
-  Shiri Chechik, Yang P. Liu, Omer Rotem, and Aaron Sidford. Improved Girth Approximation and Roundtrip Spanners. arXiv e-prints, page arXiv:1907.10779, Jul 2019.
-  Lenore J Cowen and Christopher G Wagner. Compact roundtrip routing for digraphs. In Proceedings of the 10th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 885–886, Philadelphia, 1999. SIAM.
-  Lenore J Cowen and Christopher G Wagner. Compact roundtrip routing in directed networks. In Proceedings of the 19th Annual ACM Symposium on Principles of Distributed Computing, pages 51–59, New York, 2000. ACM.
Michael Dinitz and Robert Krauthgamer.
Directed spanners via flow-based linear programs.
Proceedings of the 43rd Annual ACM Symposium on Theory of Computing, pages 323–332, New York, 2011. ACM.
-  Dorit Dor, Shay Halperin, and Uri Zwick. All-pairs almost shortest paths. SIAM Journal on Computing, 29(5):1740–1759, 2000.
-  Paul Erdös. Extremal problems in graph theory. In Theory of Graphs and Its Applications (Proc. Sympos. Smolenice, 1963), pages 29–36, Prague, 1964. Publ. House Czechoslovak Acad. Sci.
-  Michael L Fredman and Robert Endre Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. Journal of the ACM, 34(3):596–615, 1987.
-  Jakub Pachocki, Liam Roditty, Aaron Sidford, Roei Tov, and Virginia Vassilevska Williams. Approximating cycles in directed graphs: Fast algorithms for girth and roundtrip spanners. In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1374–1392, Philadelphia, 2018. SIAM.
-  Sofya Raskhodnikova. Transitive-closure spanners: A survey. In Property Testing, pages 167–196. Springer, Berlin, Heidelberg, 2010.
-  Liam Roditty, Mikkel Thorup, and Uri Zwick. Roundtrip spanners and roundtrip routing in directed graphs. ACM Trans. Algorithms, 4(3):29:1–29:17, July 2008.
-  Mikkel Thorup and Uri Zwick. Approximate distance oracles. In Proceedings of the 33rd Annual ACM Symposium on Theory of Computing, pages 183–192, New York, 2001. ACM.
-  Chun Jiang Zhu and Kam-Yiu Lam. Deterministic improved round-trip spanners. Information Processing Letters, 129:57 – 60, 2018.
-  Uri Zwick. Exact and approximate distances in graphs: a survey. In European Symposium on Algorithms, pages 33–48, Berlin, Heidelberg, 2001. Springer.