## 1 Introduction

### 1.1 Graph Spanners

Sparse graph spanners, which are compact data structures approximating shortest path distances, have received considerable research interests since they were proposed in the late 80’s PS89 .
An *-spanner* (*i.e.* a spanner of stretch ) for an undirected graph , is a subgraph of such that for every , their distance in is at most times of their original distance in .
It is well-known that for any positive integer , every -vertex graph has a -spanner of size (number of edges) ADD+93 ; TZ05 .
The stretch-size trade-off is optimal if we believe the Erdos’s girth Conjecture Erdos64 .
Research efforts were then devoted to -additive spanners, where the distance between every two vertices is no larger than their distance in the original graph by an additive term .
For any undirected graph, there exists a -additive spanner of size ACI+99 with the log factor shaved in EP04 later, a -additive spanner of size (the notation suppresses polylogarithmic factors in this paper) Chechik13 , and a 6-additive spanner of size BKM+10 ; Woodruff10 .
Recently, Abboud *et al.* AB16 proved that one cannot obtain any purely additive spanner using size .
Mixed spanners -spanner are subgraphs where the distance between any pair of vertices is no larger than with being their distance in the original graph. For different constructions of mixed spanners, readers are referred to EP04 ; TZ06 ; Pettie09 ; BKM+10 .

The definition of spanners can be naturally extended to directed graphs but it becomes trivial to study spanners in this setting because of the well-known lower bound on the size RTZ08 .
Therefore, instead of studying one-way distances, Cowen and Wagner CW99 ; CW00 firstly studied *round-trip distances* of digraphs.
In a digraph, the round-trip distance between vertex and is the sum of the one-way distance from to and the one-way distance from to .
A *-round-trip spanner* of a digraph is a subgraph such that for every , the round-trip distance between and in is at most times of the original round-trip distance in , for a positive integer .
In the two work CW99 ; CW00 , they studied the round-trip routing schemes which implied a -round-trip spanner of size .
Later, Roditty *et al.* RTZ08 proposed a randomized algorithm to construct a -round-trip spanner of size essentially in time with (2.373 is the matrix multiplication exponent), for a graph with vertices, edges and maximum edge weight , a positive integer and a parameter , significantly improving the spanners of Cowen and Wagner CW99 ; CW00 .
Recently, Zhu *et al.* ZL18 reduced the spanner size from RTZ08 by a factor of by proposing a deterministic algorithm to construct a -round-trip spanner of size in the same asymptotical time for the same input parameters.

However, the time to construct a round-trip spanner of a digraph using any algorithm above, , is still extremely large, asymptotically the same as computing All-Pairs Shortest Paths (ASAP) in Orlin17 ; WW10 .
Recently, Pachocki *et al.* PRS+18 studied fast constructions of round-trip spanners.
In particular, they proposed the state-of-the-art *fastest* algorithm, for any -vertex -edge graph and any positive integer , which in time with high probability constructs an -round-trip spanner of size

. Their approach combines exponential distribution based graph decomposition

MPX13 and sampling based reachability vertex size estimation Cohen97 . The former enables reasoning about the probability of separating two vertices of bounded round-trip distance in different clusters. In the graph decomposition, they used a subset of vertices chosen with the help of the reachability vertex size estimation, as the starting vertices to construct clusters centered around. This ensures that their algorithm terminates in a small levels of recursions. They also proposed an algorithm with high probability constructing a nearly tight additive round-trip spanner of additive term and size in time , for an unweighted digraph and a parameter .### 1.2 Source-Wise Spanners

Another research direction focuses on constructing graph structures approximating distances for *some pairs* of vertices, instead of all vertex pairs.
Along this direction, Coppersmith and Elkin CE06 made the first contribution and they considered exact source-wise spanners (or called preservers).
For any -vertex undirected graph and -sized source vertex set (or pairs of vertices), they proved that there exists a source-wise preserver (pair-wise preserver) of size () preserving distances with respect to set (, respectively) in a combinatorial way.
Recently, Bodwin Bodwin17 improved the size of pair-wise preservers to , even for digraphs.
For any -sized source vertex set in an -vertex -edge undirected graph and positive integer , Roditty *et al.* RTZ05 studied approximate source-wise distance spanners and proposed an algorithm to construct in expected time a source-wise -spanner of size .
There have also been polynomial-time algorithms to construct source-wise spanners of additive stretches and and sizes KV13 , and Kavitha15 , respectively.
For other stretch-size trade-offs of source-wise spanners, readers are referred to CGK13 ; Parter14 .

Recently, *source-wise* round-trip spanners, a natural extension of standard round-trips spanners in the source-wise setting, were firstly studied by Zhu and Lam ZL17 .
Given any source vertex set in a digraph , an *-source-wise -round-trip spanner* is a subgraph such that, for every , the round-trip distance in between and is at most times of their original round-trip distance in .
Source-wise round-trip spanners can have many practical applications, to name a few, source-wise round-trip compact routing schemes, source-wise round-trip distance oracles, source-wise low distortion embeddings ZL17 .
For any -sized source vertex set in an -vertex -edge digraph with maximum edge weight , any positive integer and any , they proposed an algorithm, in time with , constructing an -source-wise -round-trip spanner of size .
However, the construction time of a source-wise round-trip spanner by ZL17 is very large, especially when the size is a large integer.

### 1.3 Our Contribution

In this paper, we study the problem of efficiently constructing source-wise round-trip spanners for weighted digraphs, and propose a nearly linear time algorithm. As an important building block, we first propose a graph partitioning algorithm to partition a graph into clusters of bounded radius, and prove that for a vertex in a source vertex set and of small round-trip distance, the probability of separating them in different clusters is small. Instead of taking a specific set as input and constructing a partitioning working for , the algorithm takes an integer , size of , as input and constructs one partitioning working for all source vertex sets of the same size . We believe that this “one partitioning for all sources of the same size”-style algorithm can be of independent interest in graph algorithm design. The second algorithm we propose is an algorithm for estimating the size of in-balls and out-balls around some center vertices with a radius. Informally, an in-ball (resp. out-ball) around a vertex with a radius is the vertices that can be reachable (or reach) within a distance . It can perform size estimations only for vertices in an arbitrary set of vertices, instead of all vertices , providing desirable flexibility in the source-wise setting. With these two algorithms, we show that the recursive algorithm for constructing standard round-trip spanners PRS+18 can be adapted to the source-wise setting by thoroughly setting the source vertex set in every recursion. More importantly, we rigorously prove the correctness and complexity of the proposed algorithms. Finally, we show how to remove the dependence of the edge weights in the source-wise setting. Our main result is summarized in the following theorem.

###### Theorem 1 (Round-Trip Spanners).

For a weighted digraph with vertices and edges, a source vertex set of size and a positive integer , there is an algorithm, in time , with high probability constructing an -source-wise -round-trip spanner of size .

On the one hand, compared with the state-of-the-art algorithm ZL17 for constructing source-wise round-trip spanners, our algorithm significantly improves their construction time, (where ), to nearly linear , while still keeping a spanner stretch and size , asymptotically near to their stretch and size , respectively. On the other hand, compared with the fastest algorithm for constructing standard round-trip spanners for all vertex pairs, we improve the size and construction time from and , to and respectively, and the improvement is significant especially when the source vertex set size is small.

The remainder of the paper is organized as follows. In Section 2, we present notations and definitions to be used in this work. We then present details of our algorithms for constructing source-wise round-trip spanners of digraphs in Section 3. Finally, we conclude the paper with a brief discussion on future work in Section 4.

## 2 Notations and Definitions

We consider weighted digraphs in this paper. A digraph consists of a vertex set , an edge set and a weight function . assigns weights to each edge and can be omitted from the presentation if it is clear from the context. The maximum edge weight amongst all edges is denoted by . The subgraph induced by an arbitrary set of vertices is denoted as .

A *(one-way) shortest path* from to in a digraph is a path with the minimum distance amongst all paths from to in .
Its distance is called the *(one-way) shortest distance* from to in .
A *round-trip shortest path* between and is the concatenation of a one-way shortest path from to in and a one-way shortest path from to in .
Its distance is called the *round-trip distance* between and in .
There may exist multiple round-trip shortest paths between any vertex pair and this does not invalidate the algorithms proposed in this paper.
The *radius* and *diameter* of a graph are defined as and , respectively.

A *(round-trip) ball* of a vertex with radius , denoted as , is the set of vertices whose round-trip distances from in are no larger than .
Similarly, we use - and - to denote the set of vertices whose shortest distances from and to in are no larger than , respectively.
A *shortest path tree* from a vertex to an arbitrary vertex set in a digraph is a subgraph that is a tree of , such that for every , in is in .
For a ball , let its *round-trip tree* - be the union of a shortest path tree in from to all vertices of , and a shortest path tree in from all vertices of to .
We say that an event happens *with high probability (w.h.p.)*, if it happens with probability where is the size of the input of the problem and is a constant.
When we can choose a sufficiently large to make the probability arbitrarily close to one, we also say that the event happens w.h.p..

## 3 Fast Algorithms for Source-Wise Round-Trip Spanners of Digraphs

Following existing techniques for constructing round-trip spanners in the standard and source-wise settings RTZ08 ; ZL17 ; PRS+18 , the key to construct source-wise round-trip spanners is the construction of *round-trip covers* in the source-wise setting, a collection of round-trip balls with bounded radius such that for every vertex pair, one of which is a source, of small round-trip distance, there is a ball containing the pair of vertices.
The notion of round-trip covers is formally defined in Definition 1.
Then our result to efficiently constructing round-trip covers are summarized in Theorem 2.

###### Definition 1 (Zl17 ).

In a directed graph , a collection of round-trip balls is a -cover for a vertex set , if and only if each ball in has a radius at most , and for every with , there is a ball containging both and , i.e., .

###### Theorem 2 (Round-Trip Cover).

For a digraph with vertices and edges, a source vertex set of size , a positive integer and a parameter , there is an algorithm, in time , w.h.p. constructing a -cover for . Each vertex is contained in balls of .

With Theorem 2, we can get Theorem 3, an intermediate result for constructing round-trip spanners, before getting the main theorem, Theorem 1. Specifically, for , we construct -cover for . We take the union of - for each as the resulting -source-wise -round-trip spanner. Compared to each round-trip cover , both the size and constructing time of the round-trip spanner are larger by a factor of . In the remainder of the section, we first present a fast algorithm for constructing round-trip covers and prove Theorem 3 in Section 3.1. We then prove, in Section 3.2, Theorem 1 by removing the dependence on edge weights for the bounds in Theorem 3.

###### Theorem 3.

For a weighted digraph with vertices and edges, a source vertex set of size and a positive integer , there is an algorithm, in time , w.h.p. constructing an -source-wise -round-trip spanner of size , where is the maximum edge weight of .

### 3.1 A Fast Algorithm for Constructing Round-Trip Covers

We apply a graph partitioning technique to partition the input graph into clusters, recurse on each of the clusters, and reason about the probability that the partitioning does not cut a cycle we would like to approximate is high. Similar to PRS+18 , in order to guarantee that the algorithm terminates in a small levels of recursions, we use an algorithm to estimate sizes of in-balls and out-balls with a radius, and only construct clusters around selected “good” center vertices. However, in the source-wise setting, we are only interested in vertex pairs involving at least one source vertex. Therefore, we need to derive a probability of separating the vertex pairs of interest in different balls dependent on the size of the source vertex set, which eventually resulting in round-trip covers and a round-trip spanner of size dependent on the size of the source vertex set. In this way, the source-wise round-trip covers and round-trip spanner can have a smaller size than their counterparts in the standard setting.

We first provide an algorithm for constructing a collect of balls, which we call a *cover* (instead of a round-trip cover in Definition 1), such that (1) each ball in has a bounded radius, (2) each vertex is contained in exactly one ball of , and (3) for every vertex pair, one of which is a source, of bounded round-trip distance, there exists a ball containing both vertices with at least some fixed probability, or equivalently the probability of separating them in different balls is at most some fixed probability.
By repeating the algorithm a logarithmic number of times and taking union of the constructed covers, w.h.p. we get a round-trip cover.

For a graph and a source vertex set , we consider two cases in constructing a cover.
For the case that there is a vertex which can reach and be reachable from a large portion of vertices in within a distance with , we construct a round-trip ball, , include edges of its round-trip tree into the cover and then recurse on the graph induced by the remaining vertices, .
We prove that the probability of separating any pair of vertices of bounded round-trip distance in different balls is small.
Please refer to an illustrating example in Figure 0(a).
For the case when there is no vertex that can reach and be reachable from a large portion of vertices within a distance , we partition the graph into clusters with a bounded radius using a *source-wise* graph partitioning algorithm, and then recurse on each of the clusters.
We rigorously show that the probability of separating any of bounded round-trip distance in different balls for this case is also small.
An illustrating example is provided in Figure 0(b).
Because the graph size is reduced by at least a constant factor in each recursion, we bound the number of levels of recursions (in each level we can have multiple recursions) to a logarithmic number.
Finally, we prove by the union bound that the probability of separating any of bounded round-trip distance in different balls over all recursions is small.

In the sequel, we first present the two important algorithms, a source-wise graph partitioning algorithm and a sampling based in-ball and out-ball size estimation algorithm in Sections 3.1.1 and 3.1.2, respectively. We then present the algorithm for constructing covers in Section 3.1.3. Finally, we present the algorithm for constructing round-trip covers in Section 3.1.4.

#### 3.1.1 A Source-Wise Graph Partitioning Algorithm

In this section, we propose a graph partitioning algorithm that takes as input, a graph , an integer and an arbitrary set of vertices, and then partitions vertices of into clusters centered around vertices in , such that (1) each cluster except the last cluster (based on indices) has a bounded radius with at least some fixed probability; (2) the last cluster has a bounded size; and (3) for every of bounded round-trip distance, where is an arbitrary source vertex set of size , the probability of separating and in different clusters (or balls) is small.
There have been several graph partitioning algorithms closely related to our algorithm MPX13 ; EMP+16 ; PRS+18 .
Miller *et al.* MPX13 proposed a seminal graph partitioning algorithm based on parallel ball growing where the radius of a ball is independently randomly drawn from an exponential distribution.
Ene *et al.* EMP+16 then extends the partitioning algorithm MPX13 from undirected graphs to directed graphs.
Recently, Pachocki *et al.* PRS+18 enhanced the algorithms of MPX13 ; EMP+16 by providing the capability of constructing clusters centered around a chosen set of vertices.

Different from prior work MPX13 ; EMP+16 ; PRS+18 , the proposed graph partitioning algorithm is designed for the source-wise setting. Specifically, it is for bounding the probability of separating specific vertex pairs at bounded round-trip distance, in different clusters, instead of all vertex pairs at bounded round-trip distance.
The ability to choose source vertex pairs and have a probability dependent on is key to deriving our algorithm for constructing covers.
More importantly, rather than taking a fixed source vertex set as input and constructing a graph partitioning of for , it can take a source vertex set size as input and then construct one graph partitioning, working for *all* source vertex sets of the same size *simultaneously*.
This is the first contribution to design an algorithm for constructing “one partitioning for all sources of the same size” in graph partitioning literature.
Such a property is especially useful in cases that (1) the source vertex set is not known in advance but only its cardinality is given, and (2) the source vertex set changes over times but the cardinality remains unchanged, thereby saving the effort to continuously update the partitioning.
Given the importance of round-trip distance metric for digraphs, we hope the algorithm may find further applications.

Specifically, Algorithm 1 summarizes the two proposed algorithms, CLUSTER-OUT and CLUSTER-IN. CLUSTER-OUT assigns each vertex a random radius drawn from the exponential distribution Exp, independently. Note that the parameter depends on the value of and this is crucial to our algorithm. Then each vertex is assigned to the cluster maximizing the quantity , if which is larger than 0. Otherwise, it is assigned to the last cluster.

The algorithm is inherently parallellizable and it can be easily parallelized as follows. We pick a start time for every vertex from the exponential distribution, and then explore the graph, starting the search from at time and proceeding at unit speed. Each vertex is assigned to the vertex that reached it first. Analogously for CLUSTER-IN that uses distance , instead of , for a vertex .

Theorem 4 summarizes properties of Algorithm 1. We first show properties of the exponential distribution, Exp

, and a random variable

picked from Expto be used in the proof. By the cumulative distribution function of the exponential distribution, we have for any

, the probability that , denoted as , is . The*memoryless*property of the exponential distribution is that, for any , .

###### Theorem 4 (“One Partitioning for All Sources of the Same Size”).

For a digraph with vertices and edges, an arbitrary set of vertices, a parameter and an integer , CLUSTER-OUT(-IN), in time , constructs a partitioning of such that (1) for any , the radius of all clusters , except the last cluster , is at most with probability at least ; (2) the last cluster has size at most ; (3) for every , where is an arbitrary vertex set of size , and at round-trip distance , with probability at least there is a cluster containing both vertices and .

###### Proof.

We only prove the theorem for CLUSTER-OUT. The proof for CLUSTER-IN is similar, and thus omitted. We first prove Property (1). By construction, each cluster with centered at can have a radius at most . By the cumulative distribution function of the exponential distribution, we have that . Therefore, the probability of all clusters , except the last one , having radii at most is at least , by union bound.

We then prove Property (2). Each vertex can be assigned to the cluster centered at itself, in the case when there does not exist another vertex such that . This is because . It implies . Therefore, by construction, .

For Property (3), we prove a stronger argument: for every of round-trip distance , instead of , there is a cluster containing both and with probability at least . Assume that is the vertex maximizing and the quantity is larger than (otherwise, both and are contained in the last cluster .) Let be the second largest quantity of amongst all , or 0 if the quantity is smaller than . Assume without loss of generality (w.l.o.g.) that . Under the above assumptions, is assigned to the cluster centered at , and thus , i.e., . and are separated in different balls if . Because of the triangle inequality, . Therefore, . By the memoryless property of the exponential distribution, the probability of both vertices and containing in the same cluster is at least . ∎

#### 3.1.2 Estimating In-Ball and Out-Ball Sizes

In this section, we present a random sampling based algorithm to estimate, for a graph and every vertex in an arbitrary set of vertices, a distance parameter and an error parameter , the sizes and of the - and - such that the estimated sizes are no larger or smaller than and by at most , respectively. The algorithm is summarized in Algorithm 2. As in Algorithm 2, we first sample a subset of vertices from , and then compute distances between vertices in and , and finally estimate and based on the distances. The algorithm is a simple generalization of Cohen’s work Cohen97 . However, it has a useful property that we can only perform size estimation for vertices in an arbitrary set instead of all vertices , thereby allowing flexibility in the source-wise setting.

###### Theorem 5.

For a digraph with vertices and edges, an arbitrary vertex set of size , parameters and , let (and ) be the

-length vector such that the value corresponding to a vertex

, (), is the fraction of vertices such that (, respectively). In time , Algorithm 2 constructs their estimations and such that for every , both the inequalities and , w.h.p. hold.###### Proof.

Under the Chernoff bound, we easily have that

By a similar application of the Chernoff bound, the inequality for also holds. The running time follows from that we have to run a single-source shortest path algorithm at most times, and each call has a running time, . ∎

#### 3.1.3 Cover Construction

Based on Algorithms 1 and 2, we are ready to provide an algorithm to construct covers as in Algorithm 3. The key is to maintain an appropriate source vertex set in each recursion and make the probability of separating vertex pairs involving at least one source in different clusters, dependent on the source vertex set. Given a source vertex set in a digraph and a parameter , we first handle special cases of and . For the case that either or , we directly return an empty set. For the case that and , we include the ball, , of radius around into the cover returned.

Otherwise (that is the case when and ), we run Algorithm 2, ESTIMATE-IN-OUT-BALL, to estimate sizes of in-balls and out-balls of a radius , from and to every vertex in Line 10, where is a sufficiently large constant. If there is a vertex that can reach and be reachable from many vertices, we directly include its ball of a radius randomly picked from into the cover , and then recurse on the graph as in Line 18. Otherwise, we have that there is no vertex that can reach and be reachable from many vertices in the graph. In this case, we can apply Algorithm 1, CLUSTER-OUT(-IN), to partition the graph into clusters, as in Line 21 or Line 23, and then recurse on each of the clusters as in Line 31. In either case of the if-test in Line 12, we are able to prove that the probability of separating two vertices at bounded round-trip distance in different balls is small and depends on .

###### Theorem 6.

For a digraph with vertices and edges, an -sized source vertex set and a parameter , in time Algorithm 3 constructs a cover of such that, (1) for every and of round-trip distance , they are in the same ball of with probability at least ; (2) each ball in has a radius w.h.p.; (3) each vertex is contained in at most one ball of .

###### Proof.

We first define notations to be used in the proof. We use and to denote the original graph and its vertex set respectively, and use and to denote the graph and its vertex set respectively, at each recursion of both Algorithm 2, ESTIMATE-IN-OUT-BALLS, and Algorithm 1 CLUSTER-OUT(-IN). Clearly we have . For a chosen sufficiently large constant , a single call of Algorithm 2 w.h.p. yields properties of Theorem 5. Similarly, a single call of Algorithm 1 w.h.p. yields Property (1) of Theorem 4, because the probability in Property (1) of Theorem 4 can be made arbitrarily close to 1. Therefore, by the union bound, the event that, all calls of Algorithms 1 and 2 yield properties in Theorems 4 and 5 respectively, happens w.h.p. and we assume it happens in the proof.

We first prove that Algorithm 3 never fails and terminates through the exits in Line 14 or Line 26. For Line 14, consider w.l.o.g. that in Line 12. We have that - by Theorem 5. Similarly, - holds. Then their intersection, - -, have size , which implies . For the case when the if-test in Line 12 fails, we have either or . (Otherwise, their intersection must not be empty.) We assume w.l.o.g. that , and thus the algorithm CLUSTER-OUT is applied in Line 21. Note that we use as the centering vertices in running CLUSTER-OUT. By Property (1) of Theorem 4 that the clusters returned, except the last cluster, can have radii at most in and Theorem 5, we have - for a vertex . The last cluster can have size at most , by Theorem 4. Therefore, Algorithm 3 never terminates through the exist in Line 26.

We then prove each of the properties, staring from Property (2). By the proof above for the algorithm never fails w.h.p. and the constructions of balls in Lines 8 and 18, w.h.p. each ball in has a radius in , which implies that w.h.p. each ball in has a radius in since . Property (3) also follows from the constructions of balls in Lines 8 and 18, and the construction that for the partitioning returned by Algorithm 1 CLUSTER-OUT(-IN), .

We now prove Property (1). In each call of Algorithm 3, there are only two lines, Lines 18 and 31, that can separate vertices into different balls. For Line 31, the probability of not separating and at round-trip distance in different balls, if they have not been separated before, is at least by Theorem 4. For Line 18, the probability is at least . Note that in Lines 18 and 31, the sizes of are multiplied by at most 7/8 and 3/8, respectively. Therefore, the total levels of recursions can be at most . Finally, the probability of not separating and in different balls over all recursions is at least . The running time follows from that the total levels of recursions is and the fact that the running time of each recursion is dominated by the running time of Algorithm 2, ESTIMATE-IN-OUT-BALLS, . ∎

#### 3.1.4 Round-Trip Cover Construction

We now prove Theorem 2 that is achieved by Algorithm 4. Given a source vertex set in a digraph , a stretch parameter and a radius , by running Algorithm 3 with the same parameters multiple times and then taking union of the resulting collections of balls, we can prove that the final collection of balls is a round-trip cover of for . Note that we only need to run Algorithm 3, times, which is dependent on , thereby resulting in a small round-trip spanner when is a small value.

###### Proof.

(*Theorem 2.*)
By Property (1) of Theorem 6, we have that for every of round-trip distance , the probability that they are in the same ball in any call of Algorithm 3 is at least .
Then the probability that they are in a ball , for a structure constructed by calls of Algorithm 3, is at least .
Therefore, the probability that they are in a ball , for a structure constructed by calls of Algorithm 3, is at least .
For a sufficiently large constant , the event that they are in a ball happens w.h.p..
We have that each ball has a radius at most , by construction and Property (2) of Theorem 6.
Therefore, w.h.p. the constructed is a -cover for .
Finally, by construction and Property (3) of Theorem 6, each vertex is contained in balls of .
∎

### 3.2 Removing the Dependence on the Edge Weights

In this section, we remove the dependence on the edge weights for the bounds in Theorem 3 in order to obtain the major theorem, Theorem 1. Although there has been a technique PRS+18 ; RTZ08 that can remove the dependence on the edge weights for standard round-trip spanners, it is still not clear whether and how it can be adapted to the source-wise setting. In this paper, we provide an affirmative answer on the former question, show an adaptation of the technique and then rigorously prove its correctness. Similar to PRS+18 ; RTZ08 , the intuition is that we do not need to consider all edges of the original graph in every construction of a round-trip cover. We introduce contraction operations in the source-wise setting, so that when exponentially increasing round-trip distances are considered, the number of times that each edge is presented is bounded by a logarithm in the number of vertices.

We first describe contraction operations for the standard setting as defined in PRS+18 , and then show the adapted contractions in the source-wise setting.
For a graph and two real numbers and , is contracted to by, (1) merging vertices in any strongly connected component (or for short *SCC*) with maximum edge weight at most into a single vertex; (2) removing all edges of weights larger than ; (3) removing all edges which *do not* participate in any *SCC* with maximum edge weight at most ; (4) removing all vertices with no edge after the above steps.
In the source-wise setting, we have a source vertex set for the original graph .
We can construct a new source vertex set for the newly contracted graph (in the standard setting), by adding additional work in some above steps.
Initially, is equal to .
In Step (1), if a source vertex participates in an *SCC* and gets merged into a single vertex , replacing by in . In Step (4), if a source vertex has no edge (after all the above steps) and gets removed, removing from .

We will use the following definition and lemma in our proof shortly.

###### Definition 2.

(Definition 5.6 from PRS+18 ) For two vertices and in a digraph , their -round-trip distance, , is defined as the minimum value of such that there is a (simple) cycle with maximum edge weight containing and .

###### Lemma 1.

(Implicit in Lemma 5.7 from PRS+18 ) For a digraph and every , let be contracted to . If the value of for each edge in can be computed efficiently, we can construct all non-empty efficiently. The total number of edges and vertices in all non-empty are and , respectively.

We now prove the following variant of Lemma 1 in the source-wise setting.

###### Lemma 2.

For a digraph and every , let be contracted to . If the value of for each edge in can be computed efficiently, we can construct all non-empty and the corresponding source vertex sets together efficiently. The total number of edges and vertices in all non-empty are and , respectively.

###### Proof.

Based on Lemma 1, we only need to prove that for each can be constructed efficiently. This holds because the additional work for constructing besides constructing can be completed in linear time. ∎

We will use the algorithm, Roundtrip--Spanner, in PRS+18 to construct, for a digraph , a tree for efficient computations of for each edge in , and a sparse edge set preserving pairwise -round-trip distances in . The following lemma summarizes properties of the algorithm.

###### Lemma 3.

(Lemma 5.9 from PRS+18 ) For a digraph , in time , Roundtrip --Spanner constructs (1) an -sized edge set such that for any vertex pair contained in a cycle in with maximum edge weight , there exists a cycle in containing and with maximum edge weight ; (2) a tree such that for every , the label of the lowest common ancestor of and in is exactly .

Now we are ready to present the algorithm for constructing source-wise round-trip spanners of size independent of the maximum edge weight, as summarized in Algorithm 5. Consider a source vertex set in a digraph . We first run Roundtrip--Spanner on to construct an edge set and a tree . Next, for every , we construct a contracted graph and its corresponding source vertex set together with the help of , according to Lemmas 2 and 3. After that, for every non-empty , we run Algorithm 4, RT-Cover, with parameters and to get a round-trip cover . For each ball , we include edges in - into the edge set . Finally, is returned to be the constructed round-trip spanner.