Temporal Graph Realization with Bounded Stretch
Abstract
A periodic temporal graph, in its simplest form, is a graph in which every edge appears exactly once in the first time steps, and then it reappears recurrently every time steps, where is a given period length. This model offers a natural abstraction of transportation networks where each transportation link connects two destinations periodically. From a network design perspective, a crucial task is to assign the time-labels on the edges in a way that optimizes some criterion. In this paper we introduce a very natural optimality criterion that captures how the temporal distances of all vertex pairs are “stretched”, compared to their physical distances, i.e. their distances in the underlying static (non-temporal) graph. Given a static graph , the task is to assign to each edge one time-label between 1 and such that, in the resulting periodic temporal graph with period , the duration of the fastest temporal path from any vertex to any other vertex is at most times the distance between and in . Here, the value of measures how much the shortest paths are allowed to be stretched once we assign the periodic time-labels.
Our results span three different directions: First, we provide a series of approximation and NP-hardness results. Second, we provide approximation and fixed-parameter algorithms. Among them, we provide a simple polynomial-time algorithm (the radius-algorithm) which always guarantees an approximation strictly smaller than , and which also computes the optimum stretch in some cases. Third, we consider a parameterized local search extension of the problem where we are given the temporal labeling of the graph, but we are allowed to change the time-labels of at most edges; for this problem we prove that it is W[2]-hard but admits an XP algorithm with respect to .
Keywords and phrases:
Temporal graph, periodic temporal labeling, fastest temporal path, graph realization, temporal connectivity, stretchFunding:
George B. Mertzios: Supported by the EPSRC grant EP/P020372/1.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysis ; Mathematics of computing Discrete mathematicsEditors:
Paweł Gawrychowski, Filip Mazowiecki, and Michał SkrzypczakSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Graph realization is a classical problem where one is asked to decide whether a graph with a certain property, such as prescribed distances between vertex pairs or prescribed degrees for vertices, exists [7, 20, 28, 29]. These types of problems have a natural analog in the temporal graph setting111A temporal graph is a graph where one or more time-labels are assigned to every edge, indicating at which times this edge is active. We give a formal definition in Section 2.. Here we are given a static graph, and the task is to assign time-labels to each edge in order to create a temporal graph with some desired property. Temporal graph realization is an emerging topic in temporal graph algorithmics, and several connectivity-related properties have been considered. Previous work considered the property of temporal connectivity between every vertex pair or subsets thereof [3, 32, 39, 6], the size of so-called reachability sets [19], exact reachability graphs [21], fastest temporal paths222A temporal path uses edges with strictly increasing time-labels. A fastest temporal path is a temporal path that minimizes the difference between the arrival time and the starting time. We give a formal definition in Section 2. of a prescribed (exact) duration between every vertex pair [23, 33], and fastest temporal paths with a prescribed upper bound on the duration for every vertex pair [40, 41]. The latter two problems have been studied in the periodic setting, where every edge reappears after some given period length .
We focus on the last among the mentioned problem settings, where we assume that the input consists of a graph and an upper bound for every (ordered) vertex pair that shall be respected by a fastest temporal path connecting the vertices. This problem is naturally motivated in the area of network design: we are given a transportation infrastructure and are tasked to develop a (periodic) schedule that guarantees fast delivery. In previous work [40], we showed that this problem is NP-hard even if the input graph is a star and the period length is constant. This suggests that a lot of complexity is “hidden” in the prescribed upper bounds. However, it is arguably unnatural to have arbitrary upper bounds in the input that can be completely unrelated to the topology of the input graph. This leads us to the following problem.
We investigate the setting where we wish that the durations of all fastest temporal paths to be by at most some factor times the distances of the respective vertex pairs in the (static) input graph. We then say that the realization has a bounded (multiplicative) stretch. This is a well-motivated and well-established concept in network design, especially in the context of spanning trees [1, 2, 8, 16, 17] or temporal spanners [5]. It allows the duration of connections between entities of the network to be related to the physical distance of those entities in a natural way. We formally define the problem as follows. The required terminology is formally defined in Section 2.
Stretched Temporal Graph Realization (STGR) Input: A graph (static, undirected), , and a rational number . Question: Let be the distance matrix of . Can we assign one label in to every edge such that in the resulting -periodic temporal graph, for every vertex pair the duration of a fastest path from to is at most ?
Our Contribution.
STGR is a natural and well-motivated special case of the problem that we investigated in previous work [40], where the upper bounds can be arbitrary. In this work, we show that STGR is NP-hard and hard to approximate, where we consider the goal of the optimization version of the problem to minimize the stretch . Formally, we prove the following in Section 3.
-
For every and every , STGR is NP-hard to approximate within a factor of or within a factor of .
Note that a stretch of can trivially be achieved by assigning the same label to each edge. To complement these results, we show that we can achieve a strictly better approximation ratio than , especially on graphs with small radius or diameter. Formally, we prove the following in Section 4.
-
We can compute in polynomial time a solution for a STGR instance with stretch at most , where and denote the diameter and the radius of , respectively.
Next, we focus on the decision version of the problem. We show that STGR is NP-hard even if and are small constants and in cases where the input graphs have a constant diameter. Formally, we prove the following in Section 5.
-
STGR is NP-hard if , , and the input graph has diameter 2. This answers an open question by Erlebach et al. [23].
-
STGR is NP-hard for each , even if the diameter is in .
Recall that we can assume that is at most . We also show that STGR is NP-hard for each constant value of . To complement these hardness results, we give the following algorithmic results in Section 6. We use standard terminology from parameterized complexity theory [11].
-
STGR is fixed-parameter tractable when parameterized by the neighborhood diversity of the input graph and .
-
STGR is fixed-parameter tractable when parameterized by the treewidth of the input graph, the diameter of the input graph, and .
These results are obtained by using extensions of monadic second order logic (MSO) [9, 10, 34] to formulate STGR, and then applying extensions of Courcelle’s theorem [9, 10, 34].
Finally, we develop a local search algorithm for our problem. This algorithm, given a labeling, checks whether the stretch can be improved by changing at most a given number of labels. We call the search radius. We show the following in Section 7.
-
Given a periodic labeling for a graph and some constant , we can compute the best possible stretch that can be obtained by changing at most labels in polynomial time; that is, we present an algorithm that is in XP with respect to the parameter .
-
We show that the above-described local search problem is W[2]-hard when parameterized by the search radius .
Proofs of results marked with are deferred to the full version of the paper [38].
Related Work.
Since the 1960s, graph realization problems have been studied in many different settings. A complete literature review is beyond the scope of this work. While in the static setting, many different properties for realization have been studied, in particular, the realization of degree sequences, the previous work in the temporal setting considers mostly connectivity-related properties. We review the relevant work in the introduction.
The local search variant of our problem can also be seen as a temporal graph modification problem: we may modify up to labels to manipulate the graph’s connectivity properties. Many problems in this setting have been studies, where the modifications are typically edge removal, edge delay [14, 18, 37, 42], or vertex removal [25, 31, 46]. Finally, periodic temporal graphs also have been investigated in other problem settings, most prominently in the context of cop and robber games [13, 12, 4, 22, 44, 45].
2 Preliminaries
An undirected graph consists of a set of vertices and a set of edges. We denote by and the vertex and edge set of , respectively. Whenever no confusion arises, we denote and by just and , respectively. We use standard concepts and terminology from graph theory like diameter, radius, and eccentricity [15].
Let and , and let be an edge-labeling function that assigns to every edge of exactly one of the labels from . Then we denote by the -periodic temporal graph , where for every edge we have . In this case, we call a -periodic labeling of . When it is clear from the context, we drop and denote the (-periodic) temporal graph by . We assume that is encoded in binary in instances of STGR. Hence, the size of an instance is linear in , , , and the encoding length of .
A temporal -walk (or temporal walk) of length from vertex to vertex in a -periodic temporal graph is a sequence of triples that we call transitions, such that for all we have that and for all we have that . Moreover, we call a temporal -path (or temporal path) of length if for all with . Given a temporal path , we denote the set of vertices of by . A temporal -path is fastest if for all temporal -path we have that . We say that the duration of is .
Let be a temporal path on the edges in a -periodic labeling of . For every let be the label assigned to edge , and let be the common vertex of the edges and . The waiting time of on vertex is (if ), or (if ), or (if ). Then, the duration of is .
The next observation follows easily from the fact that, the worst-case for the stretch for is realized when all edges of the graph have the same time-label.
Observation 2.1.
Let be a -labeling for a graph . Then for any two vertices and , the stretch for under is at most .
Finally, we give a brief argument that we can use polynomially many calls to a decision oracle for STGR so find the optimal stretch for a given input graph. Note that naïvely trying out all possible values for does not yield polynomial time.
Lemma 2.2 ().
Given a graph and , one can compute the smallest , s.t. is a yes-instance of STGR with calls to a decision oracle for STGR.
3 Approximation Hardness
In this section, we show that STGR is NP-hard to approximate. In particular, we rule out constant factor approximations and even approximation algorithms with approximation factors that are sublinear in or single exponential in . Formally, we show the following.
Theorem 3.1.
Assume that P NP. Then, for all constants and :
-
there is no polynomial-time -approximation algorithm for STGR;
-
there is no polynomial-time -approximation algorithm for STGR.
Proof.
We present a straightforward gap-introducing reduction from Gossiping [26].
Gossiping Input: A graph . Question: Is there a labeling , such that for each pair of vertices of , there is a temporal path in the temporal graph ?
Given an instance of Gossiping, we produce a STGR instance as follows. We use the same graph and specify how to set later to get the two approximation hardness results.
Intuitively, if is a yes-instance of Gossiping, then there exists a labeling where it is not necessary to use any label from the second -period and hence the stretch is independent from . Whereas if is a no-instance of the gossiping problem, then there exists no such labeling. Then, informally speaking, there must be a path that crosses the period and has a duration that depends on and hence also the stretch depends on . Now we can set to a very large value to create a gap.
Formally, assume that is a yes-instance of Gossipingand let be a labeling such that the non-periodic temporal graph is temporally connected. We can assume without loss of generality that the largest label in is . Now we use this labeling for our STGR instance. A very naïve estimation yields that the stretch is at most : Consider a vertex pair of distance in . Then the temporal path from to in has duration at most .
Now assume that is a no-instance of Gossipingand consider the instance (for some that we specify later) of STGR. Let be a -periodic labeling for that minimizes the stretch. Note that we can obtain an equivalent labeling by adding a constant (modulo ) to every label. Hence, assume that is maximized. Then we have that . Since is a no-instance of the gossiping problem, there is a vertex pair in such that the temporal path from to in the -periodic temporal graph uses labels from different periods and hence has duration at least and hence a stretch of at least .
Let denote the optimal stretch of . Summarizing, we have the following.
-
If is a yes-instance of Gossiping, then we have that .
-
If is a no-instance of Gossiping, then we have that .
If follows that if we set , then we create a gap that allows us to distinguish yes-instance of Gossipingfrom no-instances.
In the remainder, we show how to set to obtain the approximation hardness results in the theorem statement. Note that in particular, we can distinguish yes-instance from no-instances whenever , since . This will make the calculations easier.
For the first statement, let and let . Note that . Now we set . Then we have that . It follows that and hence . We can conclude that there is no -approximation algorithm.
For the second statement, let and set . Note that the encoding of is polynomial in , as . We have that and hence . We can conclude that there is no -approximation algorithm.
4 Approximation Algorithm
In this section, we give an approximation algorithm for STGR that runs in polynomial time and achieves an approximation ratio of , where and denote the diameter and the radius of the input graph , respectively. Formally, we show the following.
Theorem 4.1.
A solution for STGR with stretch at most can be computed in polynomial time.
Note that this is strictly better than the “trivial” stretch obtained by ˜2.1 if the radius and diameter differ. To show Theorem 4.1, we give the following algorithm, which we will refer to as the radius algorithm. Assume we are given an instance of (the optimization version of) STGR. We perform the following steps.
-
Take an arbitrary root, that is, a vertex of eccentricity equal to the radius.
-
For each , label all edges of with label if is odd, and with label , otherwise.
-
All other edges are labeled arbitrarily.
For an illustration see Figure 1. We show that this algorithm achieves the following stretch.
Lemma 4.2.
Let be an instance of STGR. Then, the radius algorithm computes a labeling with stretch at most .
Proof.
Let be an arbitrary vertex of eccentricity equal to and let be the -labeling produced by the radius algorithm for root . We give for each distance an upper bound for the stretch of distance- vertex pairs.
For , let be a pair of vertices of distance exactly in . Due to ˜2.1, is an upper bound for the stretch of distance- vertex pairs.
For , let be a pair of vertices of distance exactly in . Consider the journey that starts in , goes over any shortest path to and then goes over any shortest path to . The edges of () are alternatively labeled with and by the algorithms. Moreover, both path each have a length of at most . Hence, in the worst case, traverses edges. This implies that the duration of is at most , since only waits a full period at vertex and otherwise alternates between waiting and . Note that this also implies that there is a path of at most that duration from to . Consequently, is an upper bound for the stretch of distance- vertex pairs.
Note that the stretch achieved by is thus at most , if . (For , the stretch is always .) We show that the maximum is achieved for if , and for if .
Claim 4.3 ().
Let if , and let if . Then, .
This thus proves that the stretch achieved by is at most .
Theorem 4.1 follows directly from Lemma 4.2 and the straightforward observation that the radius algorithm runs in polynomial time. However, we can show that in several restricted cases, the algorithm is guaranteed to achieve a better stretch.
Lemma 4.4 ().
Let be an instance of STGR. If and there is a root such that for each distance- vertex pair , , then the radius algorithm (for root ) computes a labeling with stretch at most .
As we will show in Section 5, there are instances, where this stretch is achieved by the radius algorithm and it is NP-hard to decide whether a better stretch is possible. This then shows that this simple algorithm produces the best possible stretch for some instances in polynomial time, unless P NP.
Finally, we can show that the radius algorithm performs well if the input graph is a tree.
Lemma 4.5.
Let be an instance of STGR where is a tree. Then the radius algorithm computes a labeling with stretch at most .
Proof.
Similar to the previous proofs, we give for each distance an upper bound for the stretch of distance vertex pairs.
Let be a vertex pair of distance-. We make the following case distinction. Consider the case where is an ancestor of if the graph is rooted at or is an ancestor of . In both cases, the edges of the fastest paths from to are alternatively labeled with and by the algorithm. Hence, we have that the duration of the fastest path from to is at most if is even, and at most if is odd. Hence, the stretch is . Since , we have that .
Now consider the case that neither is an ancestor of , nor is an ancestor of . Let be the closest common ancestor of and . Then we have that a fastest temporal path from to can be decomposed into a fastest temporal path from to and a fastest temporal path from to . Note that the waiting time at is , since all edges from to its children have the same label. All other waiting times are and , alternatingly. It follows that the duration of a fastest temporal path from to is at most if is even, and at most if is odd. Then, again, we have that the stretch is . Since , we have that .
On trees with a large maximum degree, we can show that our algorithm is optimal.
Lemma 4.6 ().
The radius algorithm computes the optimum stretch for trees with maximum degree at least and it is a 2-approximation algorithm on general trees.
5 General Hardness Results
In this section, we present NP-hardness results for STGR for (i) all constant values of and (ii) all constant values of . All of our results are achieves by reductions from 3-Coloring, which is NP-hard [30].
3-Coloring Input: A graph . Question: Is there a proper -coloring of , that is, a function , such that for each edge , ?
First, we will present two hardness results for : one for and one for . The first reduction answers an open question by Erlebach et al. [23] and the second reduction proves that our presented radius-algorithm is tight on some hard instances. That is, we show that on the build instances, the radius-algorithm is guaranteed to achieve a stretch of and it is NP-hard to decide whether a better stretch is possible on these instances. Afterwards, we present hardness results for all other constant values of and . To this end, we will adapt the latter reduction for by replacing parts of the instance by some gadgets that we define for each .
Hardness for .
We now start by presenting our first hardness result.
Lemma 5.1.
For each , STGR is NP-hard even if and has diameter .
Proof.
We reduce from 3-Coloring. Let be an instance of 3-Coloring and assume that each vertex of has at least one non-neighbor. Moreover, let . We obtain an instance of STGR as follows: We initialize the graph as the star with center vertex and leaf set . Additionally, we add for each non-edge of the vertices and , and the edges , and to . That is, is a diamond. Finally, we add another vertex to and making into a clique in . This completes the construction of . Note that has a diameter of , since both vertices and are adjacent to all vertices. In the following, let be the distance matrix of and let . The intuition of this reduction is that for each edge of , and are the only paths of length less than . Hence, on both paths, the labels of both edges need to be distinct in any labeling of stretch at most . Next, we show that is -colorable if and only if is a yes-instance of STGR.
Let be a -coloring of . We define a edge labeling of of stretch as follows: For each vertex , we set and . For each non-edge of , we set and . For all other edges of , we set . Note that these latter edges are the edges of the clique . We now show that has a stretch of , that is, for each pair of vertices of distance in , there are temporal paths of duration between them. Let be a pair of vertices of distance two in . Since is a clique in , at least one of and is a vertex of . Without loss of generality assume that . We distinguish two cases.
First, assume that . By construction of this implies that for some non-edge of with . Since we assumes that each vertex of has at least one non-neighbor in , there is a vertex such that the vertices and exist. Hence, by definition of , the path uses the labels and , and the path uses the labels and . Consequently, there are temporal paths between and of durations .
Second, assume that . If is a non-edge of , then the vertices and exist. Hence, by definition of , the paths and uses the labels and . Consequently, there are temporal paths between and of durations . Otherwise, that is, if is an edge of , then since is a proper coloring of . Since , this implies that (modulo ) or that (modulo ). Assume without loss of generality that the first is the case. Hence, by definition of , the path uses consecutive time-labels (modulo ) and the path uses consecutive lime labels (modulo ). Consequently, there are temporal paths between and of durations . Concluding, has a stretch of , which implies that is a yes-instance of STGR.
Let be an edge labeling of with stretch at most . We define a -coloring of the vertices of as follows: For each vertex , we set . Next, we show that for each edge , and receive distinct colors under . Recall that for to have a stretch of for , at least one path of length at most from to in has duration at most . Since is an edge of , the vertices and do not exist, which implies that and are the only paths from to in of length less than and that and are the only paths from to in of length less than . Assume towards a contradiction that . This implies that . Hence, the paths and have a duration of exactly . Consequently, for to have a stretch of for , both paths and must have a duration of . Since , this is impossible. This contradicts the assumption that is an edge labeling of with stretch at most . Thus, , which implies that is a proper -coloring for
Note that Lemma 5.1 answers (by setting ) an open question by Erlebach et al. [23] about the complexity of finding a periodic -labeling for a diameter-2 graph , such that the fastest paths between any two vertices of equals their distance.
Next, we show that for each , it is NP-hard to decide whether a stretch in can be achieved. To this end, we define gadget graphs for each and some associated labelings. First, we define this gadgets for and present the first reduction. Afterwards, we define these gadgets for odd values of and even values of and present similar reductions.
Definition 5.2 (Sunglasses gadgets for ).
A -sunglasses gadget with docking points and is the graph shown in Figure 2, where the black vertices indicate the docking points and , and the white vertices are central vertices.
Figure 2 also shows what we call the sunglasses labeling.
Definition 5.3.
Let , let be a graph, and let . Moreover, let and be vertices of distance exactly in . We call a vertex of a nice neighbor of and , if (i) is a common neighbor of and and (ii) .
Observation 5.4.
Let , let be a graph, and let . Moreover, let and be vertices of distance exactly in . If and have a nice common neighbor , then and are paths of duration at most each.
We now show that there are graphs with diameter 3 and radius 2, for which it is NP-hard to decide whether one can achieve a better stretch than the one achieved by the radius-algorithm. This then shows that this simple and natural algorithm is tight on some hard instances.
Lemma 5.5.
For and each , STGR is NP-hard even on graphs with diameter , radius , and where the radius algorithm produces a labeling of stretch .
Proof.
Let and let . We again reduce from 3-Coloring. Let be an instance of 3-Coloring. Again, assume that each vertex of has at least one non-neighbor, as otherwise we would know that this vertex receives a unique color in any -coloring and the remaining vertices can only be colored in two colors, which can be checked in polynomial time. We obtain an equivalent instance of STGR as follows: We initialize the graph as the star with center vertex and leaf set . Additionally, we add for each non-edge of a -sunglasses gadget with docking points and to . Let denote the set of the central vertices of all added sunglasses gadgets.
To complete the definition of , we add the vertices to and making each vertex of adjacent to each vertex of in .
This completes the construction of . In the following, let be the distance matrix of . The intuitive idea is that for each edge , the path () is the only path of length less than from () to () in . Hence, each labeling of of stretch at most has to assign distinct labels to the edges and . In other words, if labeling of has stretch at most , then the edges between and the vertices of imply a -coloring for .
Structural Properties.
Note that radius of is at most : The neighborhood of vertex is and each vertex of is a neighbor of each vertex of . Moreover, has a diameter of , since (i) each vertex of has distance at most to each vertex of by going over and thus distance at most to each vertex of and (ii) each vertex of has distance at most to each vertex of by going over some vertex of and thus distance at most to each vertex of . In particular, all vertex pairs of distance exactly in contain one vertex of and one vertex of . Since is a neighbor of all vertices of , fulfills the property of Lemma 4.4, which implies that the radius algorithm produces a labeling of stretch of at most .
Correctness.
We now show that is -colorable if and only if is a yes-instance of STGR.
Let be an edge labeling of with stretch at most . We define a -coloring as follows: For each vertex , we set . Next, we show that for each edge , and receive distinct colors under . Since is an edge of , there is no sunglasses gadget with docking points and in . This implies that is the only path from to in of length less than . Assume towards a contradiction that . This would imply that . Hence, the unique path from to in of length less than has a duration of exactly . This contradicts the assumption that is an edge labeling of with stretch at most . Thus, , which implies that is a proper -coloring for .
Let be a -coloring of . Assume without loss of generality that each of the three colors is assigned at least once. We define an edge labeling of of stretch as follows: For each vertex , we set . For each non-edge of (that is, for each added sunglasses gadget), we label the edges of the sunglasses gadget according the sunglasses labeling (see Figure 2). To complete the definition of , it remains to define the labels of the edges incident with the vertices of . For each vertex , we set . For each other edge incident with at least one vertex of , we set .
This completes the definition of . Next, we show that has a stretch of .
First, we consider vertex pairs of distance 2 in . For these vertex pairs, we show that there are paths of duration at most between and .
-
If , then by the initial argumentation, . Hence, is a nice neighbor of and , which implies that the path has duration at most is both directions.
-
If , then by the initial argumentation, . Since is the docking point of at least one sunglasses gadget, there are at least two vertices and of adjacent to . For at least one , . Hence, the edge receives label under . This implies that is a nice neighbor, since the edge receives label either 1 or 3 under . Consequently, the path has duration at most is both directions.
-
If , then . The case for is covered by the above cases. If , the path has labels and thus has duration at most in both directions. Otherwise, if , then by construction, is a docking point of the sunglasses gadget that contains . Hence, by the sunglasses labeling, there is a nice neighbor of and in this sunglasses gadget which implies the existence of paths of duration at most between in and .
-
If , then . The case for is covered by the above cases. If , we consider two cases. If is an edge of , is a nice neighbor of and , since is a proper 3-coloring of . Otherwise, if is not an edge of , there is a sunglasses gadget with docking points and . By the sunglasses labeling, this gadget contains a path with labels from to and a path with labels from to . In both cases, there are paths of duration at most between and .
Next, we consider vertex pairs of distance 3 in . For these vertex pairs, we show that there are paths of duration at most between and . By the initial argumentation about the structural properties of , we can assume without loss of generality that and . Moreover, is not part any sunglasses gadget attached to , as otherwise, the distance between and would be at most . Take an arbitrary sunglasses gadget attached to and let and be the neighbors of in this sunglasses gadget. By the sunglasses labeling, we can assume that the label of is equal to for each . Since , is a vertex of , , and . This implies that the path has labels and thus a duration of . For the other direction, the path has labels and thus a duration of . Hence, there are paths of duration at most between and .
This implies that the stretch of is at most , which completes the proof.
In combination with Lemma 5.1, this implies that for , STGR is NP-hard for each .
Corollary 5.6.
For , STGR is NP-hard for each .
Hardness for .
We now proceed by showing that also for each , STGR is NP-hard for each . To obtain this result, we define for each , -sunglasses gadgets and replace the -sunglasses gadgets in the reduction of the proof of Lemma 5.5 by the larger -sunglasses gadgets. The definition of these larger gadgets and the reduction is deferred to the attached full version.
Theorem 5.7 ().
For each and each , STGR is NP-hard on graphs of diameter .
Recall that Lemma 5.1 shows that STGR is NP-hard for each . Moreover, since for each constant , there is a constant , such that , Lemmas 5.1, 5.5, and 5.7 imply the following.
Theorem 5.8.
For each constant , STGR is NP-hard. For each constant , STGR is NP-hard.
6 Fixed-parameter Algorithms through Monadic Second-Order Logic
In this section, we show that STGR is fixed-parameter tractable with respect to combinations of , the treewidth , the diameter , and the neighborhood diversity of the input graph . Formally, we show the following two results.
Theorem 6.1.
STGR is in FPT when parameterized by .
Theorem 6.2 ().
STGR is in FPT when parameterized by .
Note that Theorem 6.2 implies that for all graph classes that have locally bounded treewidth (such as planar graphs), we get that STGR is in FPT when parameterized by the diameter of the input graph and . Furthermore, Theorem 6.2 implies that STGR is in FPT when parameterized by the treedepth of the input graph and , since both the treewidth and the diameter of a graph can be upper bounded by a function of the treedepth. We remark that the neighborhood diversity of a graph is unrelated to the combination of the treewidth and the diameter of a graph. Finally, by Lemma 2.2, both theorem statements also hold for the optimization version of STGR.
To show Theorems 6.2 and 6.1 we show that STGR is expressible in monadic second-order (MSO) logic in certain specific ways that allows us to employ Courcelle’s famous theorem (and extensions thereof) [9, 10]. Since we define the MSO formulas directly on the input graph , we do not give the formal definitions of treewidth and neighborhood diversity, since they are not necessary to obtain the results. For more information on treewidth, we refer to standard textbooks on graph theory, e.g. the one by Diestel [15], and for more information on the neighborhood diversity, we refer to Lampis [35], who introduced this parameter.
Assume we are given a graph , an integer , and a real number . Let . A monadic second-order (MSO) formula over is a formula that uses
-
the incidence relation of vertices and edges,
-
the logical operators , , , , and parentheses,
-
a finite set of variables, each of which is either taken as an element or a subset of or ,
-
and the quantifiers and .
Additionally we will use some folklore shortcuts such as , , , , and , which can themselves be replaced by MSO formulas. For an edge set we use to denote the set of vertices that are incident with the edges in . Furthermore, we use the formula to express that sets form a partition of . It is well-known that this formula has size .
We use two different extensions of MSO. The first one is called CMSO and allows for testing the cardinality of a set. We remark that this does not allow for comparing the cardinalities of sets.
-
if and only if .
This extension of MSO was already considered by Courcelle [9]. We have the following, where denotes the length of the formula .
The second extension is stronger and allows for linear cardinality constraints, that is, expressions of the type , where and are linear expressions over cardinalities of sets. This extension is called MSO [34] and the following is known.
Theorem 6.4 ([34]).
MSO model checking is in FPT when parameterized by .
We now introduce some basic MSO formulas that we will use to compose the formulas to express STGR. It is well-known that connectivity and various related concepts can be expressed in MSO.
-
tests whether the subgraph of is connected.
-
tests whether the two vertices are connected by a path that only uses edges from .
-
tests whether the two vertices are connected by a path that exactly uses edges from .
It is well-known that all these formulas have constant size. We provide the formulas in the full version of the paper [38].
We first show Theorem 6.1. To this end, we introduce additional predicates that use linear cardinality constraints and hence are MSO formulas. Afterwards, we show how to replace these predicates with equivalent (larger) CMSO formulas.
-
tests whether the two vertices are connected by a path that exactly uses edges from and whether this is a shortest path:
Now we are ready to give an MSO formula that expresses STGR. We are looking for a partition of into . We interpret with edge receiving label .
| (1) | ||||
| (2) | ||||
| (3) | ||||
| (4) | ||||
| (5) | ||||
| (6) |
Observe that the size of the formula is in and that it can be computed in time. Now we prove that expresses STGR.
Lemma 6.5 ().
Given an instance of STGR, we have that is satisfiable if and only if is a yes-instance.
Now we have all the ingredients to prove Theorem 6.1.
Proof of Theorem 6.1.
Theorem 6.1 follows directly from Lemma 6.5, Theorem 6.4, and from the fact that is an MSO-formula with a size in that can be computed in time.
7 A Parameterized Local Search Approach
Based on our classical hardness and inapproximability results, it is natural to ask for good polynomial-time heuristic approaches for our problem. From this standpoint, we now consider a “parameterized local search” version of our problem, that is, we try to improve the stretch of a given labeling by changing the labels of just a few edges. In general, in parameterized local search the goal is to improve a given solution by performing a modification that is upper-bounded by (according to some specified measurement between solutions). Here, is an additional parameter often referred to as the search radius [43]. Marx [36] first considered parameterized local search for the Traveling Salesperson problem in 2008 and since then, these kind of local search problems were considered for many optimization problems (see [36, 24, 27, 43] for some collections of problems).
The following problem we consider in this section generalizes the classical parameterized local search version of STGR, as it does not only ask for any improvement but rather for an improvement to some desired stretch . It is formally defined as follows.
Local Search STGR (LS STGR) Input: A graph , , a labeling , , and a number . Question: Does there exist a labeling that disagrees with on at most edges, such that the stretch of is at most ?
Note that this problem can also be seen as a generalization of STGR, as STGR is obtained by setting to the number of edges of the input graph. Generally, our goal is to analyze the parameterized complexity of LS STGR with respect to the parameter . We present an XP-algorithm for , showing that we can efficiently decide whether a stretch of can be achieved from our current labeling by changing only a constant number of edge-labels. Note that by Lemma 2.2, we can also find the optimal stretch in this search space with an additional polynomial factor in the running time. A natural question is then to ask for an FPT algorithm for . As we show, such an algorithm presumably does not exist, as the problem is W[2]-hard for , even when asking for any improvement.
Theorem 7.1.
LS STGR admits an XP algorithm when parameterized with .
Proof.
Our algorithm iterates over all subsets of size at most . For each such subset , we then ask the question, whether we can achieve a stretch of by changing only the labels of edges of . That is, we iteratively solve the following intermediate problem.
Fixed Edges Relabel STGR Input: A graph , , a set , a labeling , and a number . Question: Does there exist a labeling , such that the stretch of is at most ?
Based on the time (which is XP time) for the iteration over all candidate sets , to present our XP algorithm, it suffices to show that Fixed Edges Relabel STGR admits an XP algorithm for .
Let be the edges of the given set , enumerated arbitrarily, and assume that , that is, there exists at least one edge of that is not in . For every denote by and the endpoints of the edge ; note that some edges of may have common endpoints. Denote the set of all endpoints of the edges of by . We now define the set of all edges in that are not in but share at least one common endpoint with some edge in . Furthermore, we define the set of all distinct time-labels that appear in at least one edge of . Let be the labels of in increasing order. For simplicity of the presentation, we assume without loss of generality that ; this can be achieved by subtracting from the time-label of every edge. Note that . Finally, we define the subsets of time-labels, called zones, as follows. For every , we define and . For , we define and .
For every edge , we guess in which zone the label lies. These are in total different cases, as we have edges in and potential zones for the label of each edge. Furthermore, for every allocation of the edges of to the different zones of time-labels, we also guess a permutation of the time-labels of the edges of which are allocated to the same zone. These are in total different permutations. Each of these permutations corresponds to a different relative order of the time-labels of the edges of . For each of these permutations, we also guess whether two consecutive time-labels within the same zone are equal or not; these are different choices. Summarizing, for every allocation of the edges of to the different zones of time-labels, we guess the relative order of the time-labels of the edges of in each zone, by distinguishing which time-labels are equal and which are different. We call each of these relative orders a time-label profile; there are at most different profiles.
Let be an arbitrary temporal path, and let be any two consecutive edges in , with being their common endpoint. Note that, once we have fixed an allocation of the edges of to the different zones and a time-label profile, we know the relative order of the time-labels and of the edges and , respectively. More specifically, if , then the waiting time at is ; if , then the waiting time at is ; if , then the waiting time at is .
Consider two arbitrary vertices and in and an arbitrary edge of . Let be a fastest temporal path from to , and assume that passes through . Without loss of generality, let first visit and then . Note that, given a fixed allocation of the edges of to the different zones and a fixed time-label profile, if is neither the first nor the last edge of , then the duration of is independent of the exact time-label of the edge . The reason is that, in this case, the relative order of the time-label of , compared to the time-labels of the previous and the next edge on , is fixed in the given time-label profile, regardless of the exact value of the time-label of .
Now suppose that is the last (resp. first) edge of , i.e. (resp. ). Then, the duration of is smallest when the time-label of is the smallest (resp. largest) possible, while still respecting the relative order of the time-labels in the given profile.
Note that, if we fix a specific time-label for each edge of , we can trivially compute the stretch of this specific time-labeling. This can be done by just computing the fastest temporal path from every vertex to every other vertex , dividing its duration by the length of the shortest path between and in the underlying graph , and returning the largest of these ratios as the stretch of this time-labeling.
Our algorithm proceeds as follows, while examining a fixed time-label profile. For each edge , we perform binary search for the time-label of in the zone in which is allocated (indepentently of any other edge ), until we find a time-labeling (if it exists) that gives a stretch that is at most the stretch threshold . During this procedure of performing multiple binary searches on each edge of independently, we only consider those time-labelings that conform with the current time-label profile.
We iterate over all possible different profiles and, for each of them, we perform the above binary searches. If, during this procedure, we detect a time-labeling of the edges of that gives a stretch , then we return this time-labeling; otherwise, we return that such a labeling does not exist. The running time of this algorithm is
as there are at most different allocations of each of the edges of to a time-label zone, at most different profiles, all independent binary searches on the edges can be performed in time, which is XP time, since the input size includes . Thus this is an XP algorithm for Fixed Edges Relabel STGR with respect to the parameter . By implementing the above algorithm iteratively for each of the subsets of edges, we obtain an XP algorithm for LS STGR with respect to .
Finally note that, if , that is, every edge of the graph is in the set , then and . In this case, we create just one time-label zone that contains all possible time-labels, and then we perform exactly the same algorithm as above.
We now show that there is presumably no FPT algorithm for LS STGR for parameter ; recall that is part of the input.
Theorem 7.2 ().
LS STGR is W[2]-hard when parameterized by .
8 Conclusion
In this paper, we investigated a natural temporal graph realization problem, where the durations of the fastest connections in the produced (periodic) temporal graph shall be at most a multiplicative factor times the corresponding distances in the static graph. Among other results, showed that the problem is hard to solve exactly and also hard to approximate within a constant factor on general instances. We also designed a polynomial time algorithm for general graphs and that achieves a factor-2 approximation on trees, whereas there are NP-hard instances for which the guaranteed stretch is tight. Our work leaves several natural future work directions: Are there instances where the optimal stretch is strictly larger than ? What is the complexity of STGR for ? Can we identify larger graph classes than trees, where we can achieve a constant-factor approximation? What is the parameterized complexity of STGR with respect to structural parameters of the input graph (independent of , e.g. treewidth by itself)? What types of results can we achieve when we allow an additive stretch, or if we want to minimize the average stretch?
References
- [1] Ittai Abraham, Yair Bartal, and Ofer Neiman. Nearly tight low stretch spanning trees. In Proceedings of the 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 781–790. IEEE Computer Society, 2008. doi:10.1109/FOCS.2008.62.
- [2] Ittai Abraham and Ofer Neiman. Using petal-decompositions to build a low stretch spanning tree. SIAM Journal on Computing, 48(2):227–248, 2019. doi:10.1137/17M1115575.
- [3] Eleni C Akrida, Leszek Gąsieniec, George B. Mertzios, and Paul G Spirakis. The complexity of optimal design of temporally connected graphs. Theory of Computing Systems, 61:907–944, 2017. doi:10.1007/S00224-017-9757-X.
- [4] Emmanuel Arrighi, Niels Grüttemeier, Nils Morawietz, Frank Sommer, and Petra Wolf. Multi-parameter analysis of finding minors and subgraphs in edge-periodic temporal graphs. In Proceedings of the 48th International Conference on Current Trends in Theory and Practice of Computer Science (SOFSEM), pages 283–297, 2023. doi:10.1007/978-3-031-23101-8_19.
- [5] Davide Bilò, Gianlorenzo D’Angelo, Luciano Gualà, Stefano Leucci, and Mirko Rossi. Sparse temporal spanners with low stretch. In Proceedings of the 30th Annual European Symposium on Algorithms (ESA), pages 19:1–19:16, 2022. doi:10.4230/LIPICS.ESA.2022.19.
- [6] Arnaud Casteigts, Michelle Döring, and Nils Morawietz. Realization of Temporally Connected Graphs Based on Degree Sequences. CoRR, abs/2504.17743, 2025. doi:10.48550/arXiv.2504.17743.
- [7] Wai-Kai Chen. On the realization of a -digraph with prescribed degrees. Journal of the Franklin Institute, 281(5):406–422, 1966.
- [8] Edith Cohen. Fast algorithms for constructing t-spanners and paths with stretch t. SIAM Journal on Computing, 28(1):210–236, 1998. doi:10.1137/S0097539794261295.
- [9] Bruno Courcelle. The monadic second-order logic of graphs. I. Recognizable sets of finite graphs. Information and computation, 85(1):12–75, 1990. doi:10.1016/0890-5401(90)90043-H.
- [10] Bruno Courcelle and Joost Engelfriet. Graph structure and monadic second-order logic: a language-theoretic approach, volume 138. Cambridge University Press, 2012.
- [11] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. doi:10.1007/978-3-319-21275-3.
- [12] Jean-Lou De Carufel, Paola Flocchini, Nicola Santoro, and Frédéric Simard. Copnumbers of periodic graphs. CoRR, abs/2310.13616, 2023. doi:10.48550/arXiv.2310.13616.
- [13] Jean-Lou De Carufel, Paola Flocchini, Nicola Santoro, and Frédéric Simard. Cops & robber on periodic temporal graphs: Characterization and improved bounds. In Sergio Rajsbaum, Alkida Balliu, Joshua J. Daymude, and Dennis Olivetti, editors, Structural Information and Communication Complexity - 30th International Colloquium (SIROCCO), pages 386–405, 2023. doi:10.1007/978-3-031-32733-9_17.
- [14] Argyrios Deligkas and Igor Potapov. Optimizing reachability sets in temporal graphs by delaying. Information and Computation, 285:104890, 2022. doi:10.1016/J.IC.2022.104890.
- [15] Reinhard Diestel. Graph Theory, 5th Edition, volume 173 of Graduate Texts in Mathematics. Springer, 2016.
- [16] Michael Elkin, Yuval Emek, Daniel A. Spielman, and Shang-Hua Teng. Lower-stretch spanning trees. SIAM Journal on Computing, 38(2):608–628, 2008. doi:10.1137/050641661.
- [17] Yuval Emek and David Peleg. Approximating minimum max-stretch spanning trees on unweighted graphs. SIAM Journal on Computing, 38(5):1761–1781, 2008. doi:10.1137/060666202.
- [18] Jessica Enright, Kitty Meeks, George B. Mertzios, and Viktor Zamaraev. Deleting edges to restrict the size of an epidemic in temporal networks. Journal of Computer and System Sciences, 119:60–77, 2021. doi:10.1016/J.JCSS.2021.01.007.
- [19] Jessica Enright, Kitty Meeks, and Fiona Skerman. Assigning times to minimise reachability in temporal graphs. Journal of Computer and System Sciences, 115:169–186, 2021. doi:10.1016/J.JCSS.2020.08.001.
- [20] Paul Erdös and Tibor Gallai. Graphs with prescribed degrees of vertices. Mat. Lapok, 11:264–274, 1960.
- [21] Thomas Erlebach, Othon Michail, and Nils Morawietz. Recognizing and Realizing Temporal Reachability Graphs. In Proceedings of the 33rd Annual European Symposium on Algorithms (ESA), 2025. To appear. Full version: http://arxiv.org/abs/2503.15771. doi:10.48550/arXiv.2503.15771.
- [22] Thomas Erlebach, Nils Morawietz, Jakob T. Spooner, and Petra Wolf. A cop and robber game on edge-periodic temporal graphs. Journal of Computer and System Sciences, 144:103534, 2024. doi:10.1016/J.JCSS.2024.103534.
- [23] Thomas Erlebach, Nils Morawietz, and Petra Wolf. Parameterized algorithms for multi-label periodic temporal graph realization. In Proceedings of the 3rd Symposium on Algorithmic Foundations of Dynamic Networks (SAND), pages 12:1–12:16, 2024. doi:10.4230/LIPICS.SAND.2024.12.
- [24] Michael R. Fellows, Fedor V. Fomin, Daniel Lokshtanov, Frances A. Rosamond, Saket Saurabh, and Yngve Villanger. Local search: Is brute-force avoidable? Journal of Computer and System Sciences, 78(3):707–719, 2012. doi:10.1016/J.JCSS.2011.10.003.
- [25] Till Fluschnik, Hendrik Molter, Rolf Niedermeier, Malte Renken, and Philipp Zschoche. Temporal graph classes: A view through temporal separators. Theoretical Computer Science, 806:197–218, 2020. doi:10.1016/J.TCS.2019.03.031.
- [26] Frits Göbel, J Orestes Cerdeira, and Hendrik Jan Veldman. Label-connected graphs and the gossip problem. Discrete Mathematics, 87(1):29–40, 1991. doi:10.1016/0012-365X(91)90068-D.
- [27] Jiong Guo, Danny Hermelin, and Christian Komusiewicz. Local search for string problems: Brute-force is essentially optimal. Theoretical Computer Science, 525:30–41, 2014. doi:10.1016/J.TCS.2013.05.006.
- [28] S. Louis Hakimi. On realizability of a set of integers as degrees of the vertices of a linear graph. I. Journal of the Society for Industrial and Applied Mathematics, 10(3):496–506, 1962.
- [29] S. Louis Hakimi and Stephen S. Yau. Distance matrix of a graph and its realizability. Quarterly of applied mathematics, 22(4):305–317, 1965.
- [30] Richard M. Karp. Reducibility among combinatorial problems. In Complexity of computer computations (Proc. Sympos., IBM Thomas J. Watson Res. Center, Yorktown Heights, N.Y., 1972), pages 85–103. Plenum, New York, 1972. doi:10.1007/978-1-4684-2001-2_9.
- [31] David Kempe, Jon M. Kleinberg, and Amit Kumar. Connectivity and inference problems for temporal networks. Journal of Computer and System Sciences, 64(4):820–842, 2002. doi:10.1006/JCSS.2002.1829.
- [32] Nina Klobas, George B. Mertzios, Hendrik Molter, and Paul G. Spirakis. The complexity of computing optimum labelings for temporal connectivity. Journal of Computer and System Sciences, 146:103564, 2024. doi:10.1016/J.JCSS.2024.103564.
- [33] Nina Klobas, George B. Mertzios, Hendrik Molter, and Paul G. Spirakis. Temporal graph realization from fastest paths. In Proceedings of the 3rd Symposium on Algorithmic Foundations of Dynamic Networks (SAND), pages 16:1–16:18, 2024. doi:10.4230/LIPICS.SAND.2024.16.
- [34] Dusan Knop, Martin Koutecký, Tomás Masarík, and Tomás Toufar. Simplified algorithmic metatheorems beyond MSO: treewidth and neighborhood diversity. Log. Methods Comput. Sci., 15(4), 2019. doi:10.23638/LMCS-15(4:12)2019.
- [35] Michael Lampis. Algorithmic meta-theorems for restrictions of treewidth. Algorithmica, 64:19–37, 2012. doi:10.1007/S00453-011-9554-X.
- [36] Dániel Marx. Searching the -change neighborhood for TSP is W[1]-hard. Operations Research Letters, 36(1):31–36, 2008. doi:10.1016/J.ORL.2007.02.008.
- [37] Kitty Meeks. Reducing reachability in temporal graphs: Towards a more realistic model of real-world spreading processes. In Proceedings of the 18th Conference on Computability in Europe (CiE), pages 186–195, 2022. doi:10.1007/978-3-031-08740-0_16.
- [38] G.B. Mertzios, H. Molter, N. Morawietz, and P.G. Spirakis. Temporal graph realization with bounded stretch. CoRR, abs/2504.14258, 2025. doi:10.48550/arXiv.2504.14258.
- [39] George B. Mertzios, Othon Michail, and Paul G. Spirakis. Temporal network optimization subject to connectivity constraints. Algorithmica, 81(4):1416–1449, 2019. doi:10.1007/S00453-018-0478-6.
- [40] George B. Mertzios, Hendrik Molter, Nils Morawietz, and Paul G. Spirakis. Realizing temporal transportation trees. In Proceedings of the 51st Workshop on Graph-Theoretic Concepts in Computer Science (WG), 2025. To appear. Full version: https://arxiv.org/abs/2403.18513. URL: https://arxiv.org/abs/2403.18513.
- [41] Julia Meusel, Matthias Müller-Hannemann, and Klaus Reinhardt. Directed temporal tree realization for periodic public transport: Easy and hard cases. CoRR, abs/2504.07920, 2025. doi:10.48550/arXiv.2504.07920.
- [42] Hendrik Molter, Malte Renken, and Philipp Zschoche. Temporal reachability minimization: Delaying vs. deleting. Journal of Computer and System Sciences, 144:103549, 2024. doi:10.1016/J.JCSS.2024.103549.
- [43] Nils Morawietz. On the complexity of local search problems with scalable neighborhoods. PhD thesis, Friedrich-Schiller-Universität Jena, 2024. Dissertation.
- [44] Nils Morawietz, Carolin Rehs, and Mathias Weller. A timecop’s work is harder than you think. In Proceedings of the 45th International Symposium on Mathematical Foundations of Computer Science (MFCS), pages 71:1–71:14, 2020. doi:10.4230/LIPICS.MFCS.2020.71.
- [45] Nils Morawietz and Petra Wolf. A timecop’s chase around the table. In Proceedings of the 46th International Symposium on Mathematical Foundations of Computer Science (MFCS), pages 77:1–77:18, 2021. doi:10.4230/LIPICS.MFCS.2021.77.
- [46] Philipp Zschoche, Till Fluschnik, Hendrik Molter, and Rolf Niedermeier. The complexity of finding separators in temporal graphs. Journal of Computer and System Sciences, 107:72–92, 2020.
