The Complexity of Optimal Design of Temporally Connected Graphs

We study the design of small cost temporally connected graphs, under various constraints. We mainly consider undirected graphs of n vertices, where each edge has an associated set of discrete availability instances (labels). A journey from vertex u to vertex v is a path from u to v where successive path edges have strictly increasing labels. A graph is temporally connected iff there is a (u, v)-journey for any pair of vertices u, v, u ≠ v. We first give a simple polynomial-time algorithm to check whether a given temporal graph is temporally connected. We then consider the case in which a designer of temporal graphs can freely choose availability instances for all edges and aims for temporal connectivity with very small cost; the cost is the total number of availability instances used. We achieve this via a simple polynomial-time procedure which derives designs of cost linear in n. We also show that the above procedure is (almost) optimal when the underlying graph is a tree, by proving a lower bound on the cost for any tree. However, there are pragmatic cases where one is not free to design a temporally connected graph anew, but is instead given a temporal graph design with the claim that it is temporally connected, and wishes to make it more cost-efficient by removing labels without destroying temporal connectivity (redundant labels). Our main technical result is that computing the maximum number of redundant labels is APX-hard, i.e., there is no PTAS unless P = N P. On the positive side, we show that in dense graphs with random edge availabilities, there is asymptotically almost surely a very large number of redundant labels. A temporal design may, however, be minimal, i.e., no redundant labels exist. We show the existence of minimal temporal designs with at least nlogn labels.


Introduction and motivation
A temporal network is, roughly speaking, a network that changes with time.A great variety of modern and traditional networks are not static and change over time.For example, social networks, wired or wireless networks may change dynamically, transport network connections may only operate at certain times, etc. Dynamic networks in general have been attracting attention over the past years [7,10,11,14,28], exactly because they model real-life applications.In this work, following the model of [20,26] and [2], we consider discrete time and restrict our attention to systems in which only the connections between the participating entities may change but the entities remain unchanged.So we consider networks, the links of which are available only at certain discrete time instances, e.g.days or hours.This is a natural assumption when the dynamicity of the system is inherently discrete, e.g., in synchronous mobile distributed systems that operate in discrete rounds.Moreover, it gives a purely combinatorial flavour to the resulting models and problems.
In several such dynamic settings, maintaining connections may come at a cost; consider the transport network example above or an unstable chemical or physical structure, where energy is required to keep a link available.We define the cost as the total number of discrete time instances at which the network links become available.We focus on design issues of temporal networks that are temporally connected; a temporal network is temporally connected if information can travel over time from any node to any other node following journeys, i.e., paths whose successive edges have strictly increasing availability time instances.If one has absolute freedom to design a small cost temporally connected temporal network on an underlying static network, i.e, choose the edge availabilities, then a reasonable design would be to select a rooted spanning tree and choose appropriate availabilities to construct time-respecting paths from the leaves to the root and then from the root back to the leaves.However, in more complicated scenarios one may not be free to choose edge availabilities arbitrarily but instead specific link availabilities might pre-exist for the network; then, one is able to design a temporally connected temporal network using only the pre-existing availabilities or a subset of them.Imagine a hostile network on a complete graph where availability of a link means a break in its security, e.g., when the guards change shifts, and only then are we able to pass a message through the link.So, if we wish to send information through the network, we may only use the times when the shifts change and it is reasonable to try and do so by using as few of these breaks as possible.In such scenarios, we may need to first verify that the pre-existing edge availabilities indeed define a temporally connected temporal network.Then, we may try to reduce the cost of the design by removing unnecessary (redundant) edge availabilities if possible, without loosing temporal connectivity.Consider, again, the clique network of n vertices with one time availability per edge; it is clearly temporally connected with cost Θ(n 2 ).However, it is not straightforward if all these edge availabilities are necessary for temporal connectivity.We resolve here the complexity of finding the maximum number of redundant labels in any given temporal graph.

The model and definitions
It is generally accepted to describe a network topology using a graph, the vertices and edges of which represent the communicating entities and the communication opportunities between them respectively.We consider graphs whose edge availabilities are described by sets of positive integers (labels), one set per edge.
Definition 1 (Temporal Graph).Let G = (V, E) be a (di)graph.A temporal graph on G is an ordered triple G(L) = (V, E, L), where L = {L e ⊆ N * : e ∈ E} is an assignment of labels to the edges (arcs) of G. L is called a labelling of G.
Definition 2 (Time edge).Let e = {u, v} (resp.e = (u, v)) be an edge (resp.arc) of the underlying (di)graph of a temporal graph and consider a label l ∈ L e .The ordered triplet (u, v, l) is called time edge.
Note that an undirected edge e = {u, v} is associated with 2•|L e | time edges, namely both (u, v, l) and (v, u, l) for every l ∈ L e .
The labels of an edge (arc) e are the discrete time instances at which e is available.In many networks and in several applications, the availability of links comes at a cost.For example, in secure networks there is a cost (per discrete time instance) to keep a link secure.We abstract such considerations by the concept of the cost of a temporal graph and wish to have temporal graphs of low cost.
Definition 3 (Cost of a labelling).Let G(L) = (V, E, L) be a temporal (di)graph and L be its labelling.The cost of L is defined as c(L) = e∈E |L e |.
A basic assumption that we follow here is that when a message or an entity passes through an available link at time t, then it can pass through a subsequent link only at some time t > t and only at a time at which that link is available.Definition 4 (Journey).A temporal path or journey j from a vertex u to a vertex v ((u, v)-journey) is a sequence of time edges (u, u 1 , l 1 ), (u 1 , u 2 , l 2 ), . . ., (u k−1 , v, l k ), such that l i < l i+1 , for each 1 ≤ i ≤ k − 1.We call the last time label, l k , arrival time of the journey.
Definition 5 (Foremost journey).A (u, v)-journey j in a temporal graph is called foremost journey if its arrival time is the minimum arrival time of all (u, v)-journeys' arrival times, under the labels assigned to the underlying graph's edges.We call this arrival time the temporal distance, δ(u, v), of v from u.
In this work, we focus on temporally connected temporal graphs, i.e., temporal graphs that have the following property: Definition 6 (Property TC).A temporal (di)graph G(L) = (V, E, L) satisfies the property TC, or equivalently L satisfies TC on G, if for any pair of vertices u, v ∈ V, u = v, there is a (u, v)-journey and a (v, u)-journey in G(L).A temporal (di)graph that satisfies the property TC is called temporally connected.
Example.An undirected complete graph, K n , is temporally connected under any labelling L with L e = ∅ for every e ∈ E(K n ).Indeed, there is a (u, v)journey and a (v, u)-journey between any u, v ∈ V (K n ), u = v, namely the time edge (u, v, l) and the time edge (v, u, l) respectively, for any l ∈ L {u,v} .

Definition 7 (Minimal temporal graph).
A temporal graph G(L) = (V, E, L) over a (strongly) connected (di)graph is minimal if G(L) has the property TC, and the removal of any label from any L e , e ∈ E, results in a G(L ) that does not have the property TC.
Definition 8 (Removal profit).Let G(L) = (V, E, L) be a temporally connected temporal graph.The removal profit r(G, L) is the largest total number of labels that can be removed from L without violating TC on G.
Here, removal of a label l from L refers to the removal of l only from a particular edge and not from all edges that are assigned label l, i.e., if l ∈ L e1 ∩ L e2 and we remove l from both L e1 and L e2 , it counts as two labels removed from L.
Notice that if many edges have the same label, we can encounter trivial cases of minimal temporal graphs.For example, the complete graph where every edge appears at time, say t = 5, is minimal but there are no journeys of length larger than 1.To avoid cases where minimality is caused merely due to the assignment of the same label(s) to many (or all) edges, we will often consider a special sub-category of (single-labelled) temporal graphs: Definition 9 (SLSE temporal graphs).A Single-label-single-edge (SLSE) temporal graph is a temporal graph, each edge of which has a single label and no two edges have the same label, i.e., each label is assigned to (at most) a single edge.A labelling that gives an SLSE temporal graph is also called SLSE labelling.

Previous work and our contribution
In recent years, there is a growing interest in distributed computing systems that are inherently dynamic.For example, temporal dynamics of network flow problems were considered in a set of pioneering papers [22,15,21,16].The model we consider here is very closely related to the single-labelled model of the seminal paper of [20] as well as the multi-labelled model of [26].In [20], the authors consider the case of one real label per edge and examine how basic graph properties change when we impose the temporal condition; here, we extend that model by considering multiple labels per edge but we restrict our focus to integer labels.In [26], the model of [20] is also extended to many labels per edge and the authors mainly examine the number of labels needed for a temporal design of a network to guarantee several graph properties with certainty.The latter also defined the cost notion and, amongst other results, gave an algorithm to compute foremost journeys which can be used to decide property TC.However, the time complexity of that algorithm was pseudo-polynomial, as it was dominated by the cube of the maximum label used in the given labelling.
In fact, the problem of testing whether a dynamic graph is temporally connected has been studied before in various settings [10,33,8].The authors of [10] propose an algorithm for computing foremost journeys in a model of evolving graphs, where nodes and edges are associated with lists of time intervals, representing their existence over time, and each edge has a traversal time.In a similar setting, [33] studies temporal reachability graphs, in which a (u, v)edge is present at time t if (in the corresponding time-varying graph) there is a (u, v)-journey leaving u after t and arriving at v after at most some specified time-interval.In [8], the authors investigate discrete-time evolving graphs, for which they compute the transitive closure of journeys, i.e., a static directed graph whose edges represent potential journeys.The algorithm they propose depends on the maximum label used, the number of vertices, and the maximum number of edges that simultaneously exist.
Here, we show that if the designer of a temporal graph can select edge availabilities freely, then an asymptotically optimal linear-cost (in the size of the graph) design that satisfies TC can be easily obtained (cf.Section 3).We give a matching lower bound to indicate optimality, in the case where the underlying graph is a tree.However, there are pragmatic cases where one is not free to design a temporal graph anew; instead, one is given a set of possible availabilities per edge with the claim that they satisfy TC and the constraint that they may only use them or a subset of them for their design.We also propose a simple algorithm to verify TC in low polynomial time (cf.Section 2).The given design may also be minimal; we partially characterise minimal designs in Section 4. On the other hand, there may be some labels of the initial design that can be removed without violating TC (and also result in a lower cost).In this case, how many labels can we remove at best?Our main technical result is that this problem is APX-hard, i.e. it has no PTAS unless P = N P .On the positive side, we show that in the case of complete graphs and random graphs, if the labels are also assigned at random, there is aymptotically almost surely a very large number of labels that can be removed without violating TC.A preliminary version of this work appeared in the 13 th Workshop on Approximation and Online Algorithms, WAOA 2015 [3].
Stochastic aspects and/or survivability of network design were also considered in [18,24,25].

Further related work
Below, we provide a short survey of papers with studies on networks labelled by time units or segments, in addition to the ones mentioned above.Labelled Graphs.Labelled graphs have been widely used both in Computer Science and in Mathematics, e.g., [29].Continuous Availabilities (Intervals).Some authors have assumed the availability of an edge for a whole time-interval [t 1 , t 2 ] or multiple such timeintervals and not just for discrete moments as we assume here.Examples of such studies are [10,16,4].Dynamic Distributed Networks.In recent years, there is a growing interest in distributed computing systems that are inherently dynamic [6,7,11,13,14,23,27,28,30,32].Distance labelling.A distance labelling of a graph G is an assignment of unique labels to vertices of G so that the distance between any two vertices can be inferred from their labels alone [17,19].Random labellings.Random temporal networks have been considered before, e.g., in [12,13,2].In [12], the authors model opportunistic mobile networks as a type of random temporal networks, where each edge exists at each time-step with a fixed probability, and show a small diameter in general for that type of networks.In [13], the authors examine the speed of information dissemination in a type of dynamic graphs, where each edge exists at each time-step with some probability depending on whether it existed in the previous time-step.The Expected Temporal Diameter of the model of (random) temporal graphs that we consider here was first examined in [2].

A low polynomial time algorithm for deciding TC
In this section, we propose a simple polynomial-time algorithm which, given a temporal (di)graph G(L) = (V, E, L) and a source vertex s ∈ V , computes a foremost (s, v)-journey, for every v = s, if such a journey exists.Curiously enough, the previously known algorithm was pseudo-polynomial [26].Our algorithm significantly improves the running time.In fact, we conjecture it is optimal.
Theorem 1. Algorithm 1 satisfies the following, for every vertex v ∈ V, v = s: Proof sketch.The algorithm actually considers each existing label in the sequence of time labels, from the smallest to the largest one.For each label considered, it computes the foremost journeys from s which arrive at that time1 .The algorithm examines each time edge (resp.time arc) exactly once.Conjecture.We conjecture that any algorithm that computes journeys out of a vertex s must sort the time edges (resp.time arcs) by their labels, i.e., we conjecture that Algorithm 1 is asymptotically optimal with respect to the running time.
Note that Algorithm 1 can even compute foremost (s, v)-journeys, if they exist, that start from a given time t start > 0. Simply, one ignores the time edges (arcs) with labels smaller than the start time.
3 Asymptotically cost-optimal design for TC in undirected graphs.
In this section, we study temporal design issues on connected undirected graphs, so that the resulting temporal graphs are temporally connected.In this scenario, the designer has absolute freedom to choose the edge availabilities of the underlying graph.
Lemma 1.There is an infinite family of graphs G n of n vertices, for which the cost of any labelling that satisfies TC is at least 2n − 3.
Proof  1, x = y, at least one of the vertices v x , v y cannot reach the other via a journey.Therefore, any TC satisfying labelling on the star graph must assign at least 2 labels to all edges of the graph, except possibly on one edge where it assigns a single label.The TC satisfying labelling which assigns labels 1, 3 to all edges except for one and label 2 to the remaining edge has, therefore, minimum cost, namely 2n − 3 (cf.Figure 1).In fact, the result of Lemma 1 is optimal for any tree.Theorem 2 shows a lower bound for trees and an asymptotically optimal 2 way of labelling any connected undirected graph to satisfy TC.
Theorem 2. (a) For any tree G = (V, E) of n vertices and for any labelling L that satisfies the property TC on G, the cost of L is c(L) ≥ 2n − 3.
(b) Given a connected undirected graph G = (V, E) of n vertices, we can design a labelling L of cost c(L) = 2(n − 1) that satisfies the property TC on G. L can be computed in polynomial time.
Proof.(a) We prove the statement by induction on the number of vertices of the tree.
Base Case.It is easy to see that the statement holds for any tree of n ≤ 4 vertices.
Induction Hypothesis.Assume that at least 2n − 3 labels are necessary to satisfy TC on any tree of n ≤ k vertices, k ∈ N.

Inductive
Step.We will show that at least 2(k + 1) − 3 = 2k − 1 labels are necessary to satisfy TC on any tree of k + 1 vertices.Let G = (V, E) be an arbitrary tree of k + 1 vertices and let L be an arbitrary labelling of G that satisfies TC on G. Consider a leaf, u ∈ V , of G and its unique neighbour, u ∈ V .Note that L must assign at least one label to the edge {u, u } to "enable" a journey between them.Now, let L be the sub-labelling of L on G \ u.First, we show that, for L to satisfy TC on G, it must be that L satisfies TC on G \ u.Assume, to the contrary, that L does not satisfy TC on G \ u.Then, there exist two vertices x, x ∈ V (G \ u) such that the only journey(s) from x to x in G(L) go through u; let J be a (x, x )-journey in G(L).
It must be: for some v 0 , . . ., v last and l 0 < . . .< l z < l small < l big < l z < . . .< l last (cf.Figure 2).But, then the sub-journey of J which "ignores" the time-edges (u , u, l small ), (u, u , l big ) is still a (x, x )-journey in G(L), which contradicts the fact that all (x, x )-journeys in G(L) go through u.Therefore, L must satisfy TC on G \ u.Since G \ u is a tree of k vertices itself, it must be that c(L ) ≥ 2k − 3 (by Induction Hypothesis).
If c(L ) ≥ 2k − 2, then (since L assigns at least one label to the edge {u, u }), we have c(L) ≥ 2k − 2 + 1 = 2k − 1 and the Theorem holds.It remains to check the case where c(L ) = 2k − 3 and L satisfies TC on G \ u.L must assign at least one label to every edge of G \ u to satisfy TC on it.Also, it must assign exactly one label to at least one edge {x, Let l unique be the unique label of the edge {x, x }.Also, without loss of generality, assume that x is furthest from u than x is, i.e., the unique path from u to x goes through x .For L to enable a (u, x)-journey in G(L), it must assign to the edge {u, u } (at least) one label l that is strictly smaller than l unique .Also, to enable a (x, u)-journey, L must assign to the edge {u, u } (at least) one label l that is strictly greater than l unique and, thus, different from label l (cf Figure 3).So, L assigns to {u, u } at least two labels, which makes the cost of L: (b) Consider a fixed, but arbitrary, spanning tree T of G and let w be the root of T .Let r be the length of the longest path from w to any leaf of T , i.e., r is the radius of T .We assign labels to the edges of T as follows: Going upwards.Any edge incident to a leaf of T gets label 1.Any edge e = {u, v}, with d(w, v) = d(w, u) + 1, where the subtree T rooted at v has been labelled going upwards to the root, gets a label l e = max{all labels in T } + 1 (cf.Figure 4).
Going downwards.Any edge incident to the root gets a label r + 1.
Any edge e in a path from the root to a leaf, the parent edge3 of which has been labelled, going downwards, with label l , gets a label l e = l + 1.We can easily implement the above process by topologically ordering the vertices of T in levels using Breadth First Search and implement the "going upwards" and "going downwards" procedures accordingly.The above method results in a labelling where: 1. each edge of T has 2 labels, 2. each edge of E \ T has no label and 3. for each ordered pair of vertices u, v ∈ V, u = v, there is a (u, v)journey.
To show 3, just notice that one can go from any vertex u ∈ V to any other vertex v ∈ V by going up in T from u to w and then going down in T from w to v via strictly increasing labels, by construction.
Example. Figure 5 shows an example of the procedure described above.Notice the existence of journeys from any vertex to every other vertex in the resulting temporal graph.

Minimal Temporal Designs
Suppose now that a temporal graph on a (strongly) connected (di)graph G = (V, E) is given to a designer with the claim that it satisfies TC.In this scenario, the designer is allowed to only use the given set of edge availabilities, or a subset of them.If the given design is not minimal, they may wish to remove as many labels as possible, thus reducing the cost.Minimality of a design can be verified by running Algorithm 1 (cf.Section 2) for every s ∈ V .

A partial characterisation of minimal temporal graphs
As mentioned earlier, if many edges have the same label, we can encounter trivial cases of minimal temporal graphs.To avoid such cases, we focus our attention here to the class of SLSE temporal graphs, in which every edge only becomes available at one moment in time and no two different edges become available at the same time.Are there minimal SLSE temporal graphs with non linear (in the size of the graph) cost?For example, any complete SLSE temporal graph satisfies TC.Are all these Θ(n 2 ) labels needed for TC, i.e., are there minimal temporal complete graphs?As we prove in Theorem 4, the answer is negative.However, we give below a minimal temporal graph on n vertices with non-linear in n cost, namely with O(n log n) labels.

A minimal temporal design of n log n cost
Definition 10 (Hypercube graph).The k-hypercube graph, commonly denoted Q k , is a k-regular graph of 2 k vertices and 2 k−1 • k edges.The 1-hypercube is the graph of two vertices and one edge.Recursively, the n-hypercube is produced by taking two isomorphic copies of the (n − 1)-hypercube and adding edges between the corresponding vertices.
Definition 11 (Flat).In geometry, a flat is a subset of the n-dimensional space that is congruent to a Euclidean space of lower dimension, e.g., the flats in the two-dimensional space are points and lines.In the n-dimensional space, there are flats of every dimension from 0, i.e., points, to n − 1, i.e., hyperplanes.Theorem 3.There exists an infinite class of minimal temporal graphs on n vertices with Θ(n • log n) edges and Θ(n • log n) labels, such that different edges have different labels.
Proof.We present a minimal temporal graph on the hypercube graph of n vertices.Consider Protocol 2 for labelling the edges of G = Q k = (V, E).The temporal graph, G(L), that this labelling procedure produces on the hypercube is minimal.Indeed, first we will prove that the temporal graph produced by Protocol 2 satisfies TC on G = Q k .
Consider vertices u, v ∈ V and the steps described in Protocol 3 to reach v, starting from u, via temporal edges.The procedure described in Protocol 3 gives a journey from u to v, which is also unique.It suffices to consider the k-bit binary representation of the vertices of G. Notice that if the hamming distance of the labels of two vertices u, v ∈ V (G) is exactly m, then to reach v from u via a temporal path in the temporal graph on G, we need to move through vertices by consecutively swapping the bits in which u and v differ in the order of dimensions.This way, we maintain the strictly increasing order of the time labels we use and, swap by swap, we approach the destination.Note also that swapping only the bits in which u and v differ is the only way to not violate the increasing order of time labels we use: without loss of generality, suppose that the j th bit of u is 1 and so is j th bit of v. If, starting from u, we swap the j th bit to 0, i.e., we use an edge, e, on the j th dimension, then at a future step, we again need to swap the j th bit back to 1 (otherwise, we never reach v).However, the two swaps cannot be consecutive, because then we would use edge e twice and we violate the increasing order of labels.So, we would need to move to a higher dimension after the first of the two swaps; but, then, we have used labels that are larger than all the labels of the j th dimension, so using any edge of the j th dimension would also violate the increasing order of labels.
Let X i := {e i1 , e i2 , . . ., e i2 k−1 } be the list of edges in dimension x i , in an arbitrary order; Let L i be the (sorted from smallest to largest) list of labels Remove the (current) first label of L i from the list; Remove the (current) first edge of X i from the list; end for end for return the produced temporal graph, G(L); Find the flat of the smallest dimension, m, which both u and v lie on; Consider the increasing order of the m dimensions in that flat:

Use the incident edge of x[i − 1] that lies on dimension d[i] and let
x[i] be the other endpoint of that edge; end for Since our labelling gives a unique (u, v)-journey, for every u, v ∈ V , and since all labels assigned to the edges of E are used in the union of all those journeys, the deletion of any single label will violate TC.Therefore, G(L) is minimal.Finally, note that the temporal graph G(L) on the hypercube graph G = Q k has n = 2 k vertices, 1  2 n • log n edges and 1 2 n • log n labels.

A minimal temporal design of linear in n cost
In the previous section, we showed that there are graphs of non-linear cost (in the number of vertices) that are minimal.Here, we show that there are classes of minimal graphs whose cost is linear in the number of their vertices.Indeed, as seen in Lemma 1 (Section 3), the star graph of n vertices needs at least Θ(n) labels to satisfy TC and, in fact, we present there a TC satisfying labelling of Θ(n) labels (cf. Figure 1).Theorem 2(b) (Section 3) also gives a class of minimal temporal graphs of linear cost in the number of vertices.Therefore, we have the following Corollary: Corollary 2. There exists an infinite class of minimal temporal graphs on n vertices with Θ(n) edges and Θ(n) labels.

SLSE Cliques of at least 4 vertices are not minimal
The complete graph on n vertices, K n , with an SLSE labelling L, i.e., a labelling that assigns a single label per edge, different labels to different edges, is an interesting case, since K n (L) always satisfies TC.However, it is not minimal as the theorem below shows.Proof.The proof is divided in two parts, as follows: (a) We first show that any SLSE labelling on the complete graph on 4 vertices produces a temporal graph that is not minimal, i.e., the theorem holds for K 4 .Consider the six different labels a, b, c, d, x, y assigned by an SLSE labelling to the edges of K 4 as shown in Figure 6.It is easy to see that in this case, both diagonals can be removed: v 1 can reach v 3 using labels a and then c; v 3 can reach v 1 using labels d and then b; v 2 can reach v 4 using labels a and then b; v 4 can reach v 2 using labels d and then c.
Here, diagonal x can be removed: v 2 can reach v 4 using labels a and then b; v 4 can reach v 2 using labels d and then c.
This is a more complex case, for which we distinguish the following five sub-cases: i) x < b and y < c.
We can remove label a: v 1 can reach v 2 using labels y and then c; v 2 can reach v 1 using labels x and then b. ii) x < b and y > c.
We can remove label b: v 1 can reach v 4 using labels a, then c and then d; v 4 can reach v 1 using labels x, then c and then y (notice that x < b < c < y).iii) x > b and y > c.
We can remove label a: v 1 can reach v 2 using labels b and then x; v 2 can reach v 1 using labels c and then y. iv) x > b and b < y < c.
We can remove label x: v 2 can reach v 4 using labels a and then b; v 4 can reach v 2 using labels b, then y and then c. v) x > b and y < b.
We can remove label c: v 2 can reach v 3 using labels a, then b and then d; v 3 can reach v 2 using labels y, then b and then x.
Notice that the coverage of the above five cases is complete (cf. Figure 7).
In each 4-clique defined by V i , i = 1, 2, . . ., n 4 , we can remove a "redundant" label, as shown in (a).The resulting temporal graph on K n still preserves TC since for every ordered pair of vertices u, v ∈ V : 4 , then there is a (u, v)journey that uses time edges within the 4-clique on V i , as proven in ((a)).
• if u ∈ V i and v ∈ V j , i = j, then there is a (u, v)-journey that uses the (direct) time edge on {u, v}.

Computing the removal profit is APX-hard
Note that it is straightforward to check in polynomial time whether a given L satisfies TC on a given (di)graph G, by just checking for every possible (ordered) pair (u, v) of vertices in G whether there is a (u, v)-journey in G(L).Recall that the removal profit is the largest number of labels that can be removed from a temporally connected graph without destroying TC.We now show that it is hard to approximate the value of the removal profit arbitrarily well for an arbitrary graph, i.e., there exists no PTAS 4 for this problem, unless P=NP.It is worth noting here that, in our hardness proof below, we consider undirected graphs; the fact that all (u, v)-journeys, u = v exist in any given (unlabelled) connected undirected graph makes the reduction and the analysis much more involved.
We prove our hardness result by providing an approximation preserving polynomial reduction from a variant of the maximum satisfiability problem, namely from the monotone Max-XOR(3) problem.Consider a monotone XOR-boolean formula φ with variables x 1 , x 2 , . . ., x n , i.e., a boolean formula that is the conjunction of XOR-clauses of the form (x i ⊕ x j ), where no variable is negated.The clause α = (x i ⊕ x j ) is XOR-satisfied by a truth assignment τ if and only if x i = x j in τ .The number of clauses of φ that are XOR-satisfied in τ is denoted by |τ (φ)|.If every variable x i appears in exactly r XOR-clauses in φ, then φ is called a monotone XOR( r) formula.The monotone Max-XOR( r) problem is, given a monotone XOR(r) formula φ, to compute a truth assignment τ of the variables x 1 , x 2 , . . ., x n that XOR-satisfies the largest possible number of clauses, i.e., an assignment τ such that |τ (φ)| is maximized.The monotone Max-XOR(3) problem essentially encodes the Max-Cut problem on 3-regular (i.e., cubic) graphs, which is known to be APX-hard [5].Lemma 2. [5] The monotone Max-XOR(3) problem is APX-hard.Now we provide our reduction from the monotone Max-XOR(3) problem to the problem of computing r(G, L).Let φ be an arbitrary monotone XOR(3) formula with n variables x 1 , x 2 , . . ., x n and m clauses.Since every variable x i appears in φ in exactly 3 clauses, it follows that m = 3  2 n.We will construct from φ a graph G φ = (V φ , E φ ) and a labelling L φ of G φ .
First we construct for every variable x i , where 1 ≤ i ≤ n, the gadgetgraph G φ,i together with a labelling L φ,i of its edges, as illustrated in Figure 8.In this figure, the labels of every edge in L φ,i are drawn next to the edge.We call the induced subgraph of G φ,i on the 4 vertices {s xi , u xi 0 , w xi 0 , v xi 0 } the base of G φ,i .Moreover, for every p ∈ {1, 2, 3}, we call the induced subgraph of G φ,i on the 4 vertices {t xi p , u xi p , w xi p , v xi p } the pth branch of G φ,i .Finally, we call the edges {u xi 0 , w xi 0 } and {w xi 0 , v xi 0 } the transition edges of the base of G φ,i and, for every p ∈ {1, 2, 3}, we call the edges {u xi p , w xi p } and {w xi p , v xi p } the transition edges of the pth branch of G φ,i .For every p ∈ {1, 2, 3} we associate the pth appearance of the variable x i with the pth branch of G φ,i .
We continue the construction of G φ,i and L φ,i as follows.First, we add an edge between any possible pair of vertices w xi p , w xj q , where p, q ∈ {0, 1, 2, 3} and i, j ∈ {1, 2, . . ., n}, and we assign to this new edge e = {w xi p , w xj q } the unique label L φ (e) = {7}.Note here that we add this edge {w xi p , w xj q } also in the case where i = j (and p = q).
Intuitively, the base of G φ,i (cf. Figure 8) corresponds to the variable x i and, for every p ∈ {1, 2, 3}, the pth branch of G φ,i , together with the two edges {u xi 0 , u xi p } and {v xi 0 , v xi p }, correspond to the clause of φ in which x i appears for the pth time in φ.
Consider now a clause α = (x i ⊕ x j ) of φ.Assume that the variable x i (resp.x j ) of α corresponds to the pth (resp.to the qth) appearance of x i (resp. of x j ) in φ.Then we identify the vertices u xi p , v xi p , w xi p , t xi p of the pth branch of G φ,i with the vertices v xi q , u xi q , w xi q , t xi q of the qth branch of G φ,j , respectively (cf. Figure 9b).Now we add an edge between any possible pair of vertices t xi p , t xj q , i, j ∈ {1, 2, . . ., n}, and p, q ∈ {1, 2, 3}.We assign to this new edge e = {t xi p , t xj q } the unique label L φ (e) = {7}.Furthermore, for every i ∈ {1, 2, . . ., n} and every p ∈ {1, 2, 3} we define for simplicity of notation the temporal paths 9b) is the following.If variable x i is false in a truth assignment τ of φ, then all edges of the paths P i,1 , P i,2 , P i,3 keep their labels as in L φ .Otherwise, if x i is true in τ , then all edges of the paths Q i,1 , Q i,2 , Q i,3 keep their labels as in L φ .Furthermore, depending on the value of x i in the assignment τ , each of the transition edges {u xi p , w xi p } and {w xi p , v xi p }, where p ∈ {1, 2, 3}, keeps exactly one of its two labels from L φ .Consider now a clause α = (x i ⊕ x j ) of φ which corresponds to the pth branch of G φ,i and to the qth branch of G φ,j .Then the only case where both edges {t xi p , u xi p } and {t xi p , v xi p } keep their labels from L φ , is when the two variables x i , x j have equal truth value in the corresponding truth assignment τ of φ; that is, when the clause α = (x i ⊕ x j ) is not XOR-satisfied by τ .Therefore, intuitively, by a careful counting of the labels it turns out that, if more clauses can be satisfied by a truth assignment τ , then a TC preserving sub-labelling L of L φ can be constructed which avoids more labels from L φ , and vice versa (cf.Theorem 5).

The intuition behind the composition of the gadget-graphs
To finalize the construction of the graph G φ , we add a new vertex t 0 to ensure the existence of a temporal path between each pair of vertices of G φ , as follows.This new vertex t 0 is adjacent to vertex w xn 0 and to all vertices in the set First we assign to the edge {t 0 , w xn 0 } the unique label L φ ({t 0 , w xn 0 }) = {5}.Furthermore, for every vertex t xi p , where 1 ≤ i ≤ n and 1 ≤ p ≤ 3, we assign to the edge {t 0 , t xi p } the unique label L φ ({t 0 , t xi p }) = {5}.Finally, for each of the vertices z ∈ {s xi , u xi p , v xi p : 1 ≤ i ≤ n, 0 ≤ p ≤ 3} we assign to the edge {t 0 , z} the unique label L φ ({t 0 , z}) = {6}.The addition of the vertex t 0 and the labels of the (dashed) edges incident to t 0 are illustrated in Figure 9a.Denote the vertex sets This completes the construction of the graph G φ and its labelling L φ .For every i ∈ {1, 2, . . ., n} the graph G φ,i has 16 vertices.Furthermore, for every p ∈ {1, 2, 3}, the 4 vertices of the pth branch of G φ,i also belong to a branch of G φ,j , for some j = i.Therefore, together with the vertex t 0 , the graph G φ has in total 10n+1 vertices.We now present the auxiliary lemmas 3-5 which are necessary for the proof of Theorem 5.
Lemma 3. The labelling L φ assigns 17  4 n 2 + 28n + 1 labels to the edges of G φ .Proof.The vertex t 0 has in total 3 incident edges (to vertices s xi , u xi 0 , v xi 0 ) to every base of a variable x i of φ, 3 incident edges (to vertices t xi p , u xi p , v xi p , where 1 ≤ p ≤ 3) to every clause (x i ⊕ x j ) of φ (i.e., to one branch to x i and one branch of x j ), and one incident edge to vertex w xn 0 .That is, t 0 has in total 3n + 3m + 1 = 3n + 3 , where x i is associated with the pth branch of G φ,i .That is, L φ assigns in total 7m = 21  2 n labels for all clauses of φ.
Summarizing, the labelling L φ assigns to the edges of the graph G φ a total of 15  2 n + 1 + Proof.We will prove that there exists a temporal path in L φ between any pair of vertices of For any two vertices b, b ∈ B there exists a temporal path from b to b and from b to b, due to the edge {b, b } with label 7. Similarly, for any two vertices c, c ∈ C there exists a temporal path from c to c and from c to c, due to the edge {c, c } with label 7. Let a 1 , a 2 ∈ A. There exists a temporal path from a 1 to a 2 as follows: start from a 1 , follow P i,p (or Q i,p ) upwards until t xi p with greatest label 4, then go to t 0 with label 5, and finally from t 0 to a 2 with label 6.In the special case where a 1 and a 2 lie on the same path P i,p (resp.Q i,p ) and a 1 appears before a 2 in P i,p (resp.Q i,p ), there exists clearly a temporal path from a 1 to a 2 along P i,p (resp.Q i,p ).
Let a ∈ A and b ∈ B. Note that b = w xi p for some i ∈ {1, 2, . . ., n} and some p ∈ {0, 1, 2, 3}.There exists the temporal path from b to a as follows.First follow the edge {w xi p , u xi p } (with label 1), then follow upwards the path P i,p until one of the vertices {t xi 1 , t xi 2 , t xi 3 } (with maximum label 4), then go to t 0 with label 5 and finally reach a with label 6. Furthermore there exists the temporal path from a to b as follows.Assume first that a = s xi , for some i ∈ {1, 2, . . .Proof.(⇒) Assume that there is a truth assignment τ that XOR-satisfies k clauses of φ.We construct a labelling L of G φ by removing 9n + k labels from L φ , as follows.First we keep in L all labels of L φ on the edges incident to t 0 .Furthermore we keep in L the label {7} of all the edges {t xi p , t xj q } and the label {7} of all the edges w xi p w xj q .Moreover we keep in L the label {1} of all the edges {t xi p , w xi p }. Let now i = 1, 2, . . ., n.If x i = 0 in τ , we keep in L the labels of the edges of the paths P i,1 , P i,2 , P i,3 , as well as the label 1 of the edge {v xi 0 , w xi 0 } and the label 2 of the edge {w xi 0 , u xi 0 }.Otherwise, if x i = 1 in τ , we keep in L the labels of the edges of the paths Q i,1 , Q i,2 , Q i,3 , as well as the label 1 of the edge {u xi 0 , w xi 0 } and the label 2 of the edge {w xi 0 , v xi 0 }.We now continue the labelling L as follows.Consider an arbitrary clause α = (x i ⊕ x j ) of φ.Assume that the variable x i (resp.x j ) of the clause α corresponds to the pth (resp.to the qth) appearance of variable x i (resp.x j ) in φ.Then, by the construction of G φ , the pth branch of G φ,i coincides with the qth branch of G φ,j , i.e., , and t xi p = t xj q (cf. Figure 9b).Let α be XOR-satisfied in τ , i.e., x i = x j .If x i = x j = 0 (i.e., x i = 0 and x j = 1) then we keep in L the label 1 of the edge {v xi p , w xi p } and the label 2 of the edge {w xi p , u xi p }, cf. Figure 10a.In the symmetric case, where x i = x j = 1 (i.e., x i = 1 and x j = 0), we keep in L the label 1 of the edge {u xi p , w xi p } and the label 2 of the edge {w xi p , v xi p }. Let now α be XOR-unsatisfied in τ , i.e., x i = x j .Then, in both cases where x i = x j = 0 and , . . ., n}.For every p ∈ {1, 2, 3}, L contains by Lemma 5(f) the labels of all edges of the path P i,p or the labels of all edges of the path Q i,p .Therefore, there exist at least two indices p 1 , p 2 ∈ {1, 2, 3} such that L contains the labels of all edges of the paths P i,p1 , P i,p2 or the labels of all edges of the paths Q i,p1 , Q i,p2 .Without loss of generality let p 1 = 1 and p 2 = 2 and let L contain the labels of all edges of the paths P i,1 , P i,2 (the other cases can be dealt with in the same way by symmetry).Assume that L also contains the  labels of all edges of the path ).Then we can modify the labelling L to a labelling L as follows.First remove from L the labels of the edges {s xi , v xi 0 } and {v xi 0 , v xi 3 } and add instead the labels of the edges {u xi 0 , u xi 3 } and {u xi 3 , t xi 3 } (if they do not exist yet in L).Furthermore change the labels of the transition edges {v xi 0 , w xi 0 } and {w xi 0 , u xi 0 } to the labels 1 and 2, respectively.Note that in the resulting labelling L , both edges {u xi 3 , t xi 3 } and {v xi 3 , t xi 3 } are labelled.Furthermore L ⊆ L φ and L does not have more labels than L, and thus Moreover, it is easy to check that L still satisfies TC on G φ , as L satisfies TC as well.So, it must also be is also minimal.Therefore, we may assume without loss of generality that for any minimal labelling L ⊆ L φ , L contains the labels of all edges of the paths P i,1 , P i,2 , P i,3 or the labels of all edges of the paths From Lemma 5(a), L contains at least 2n + 2m labels on the edges of the form {u Notice that all the labels of L mentioned above are on different edges, so no subset of labels has been accounted for more than once.Therefore, since m = 3n 2 , L contains at least: labels.Now we construct from the labelling L ⊆ L φ a truth assignment τ for the formula φ as follows.For every i ∈ {1, 2, . . ., n}, if L contains the labels of all edges of the paths P i,1 , P i,2 , P i,3 , then we define x i = 0 in τ .Otherwise, if L contains the labels of all edges of the paths Q i,1 , Q i,2 , Q i,3 , then we define x i = 1 in τ .We will prove that |τ (φ)| ≥ k, i.e., that τ XOR-satisfies at least k clauses of the formula φ.
Let α = (x i ⊕x j ), where i, j ∈ {1, 2, . . ., n}, be a clause of φ that is not XORsatisfied by τ in φ.Let x i (resp.x j ) be associated with the pth (resp.qth) branch of G φ,i (resp. of G φ,j ).Since α is not XOR-satisfied, either follows by the definition of the assignment τ that the labelling L contains the labels of all edges of the path P i,p and of the path P j,q .Therefore, the p th branch of G φ,i , which is identified with the q th branch of G φ,j , has both edges {t xi p , u xi p } ≡ {t xj q , v xj q } and {t xi p , v xi p } ≡ {t xj q , u xj q } labelled under L, with one label each.The same holds if x i = x j = 1, where all edges of both paths Q i,p and Q j,q are labelled.So, for all the branches of G φ that correspond to non-satisfied clauses of φ by the truth assignment τ , L contains an additional label (to the ones accounted for by using the result of Lemma 5(f)).The number of clauses that are not satisfied by τ in φ is exactly m − |τ (φ)| = 3  2 n − |τ (φ)|.Thus, it follows by Equation (1), by adding the extra 3  2 n − |τ (φ)|, that L contains in total at least: Recall now that we have already shown in Lemma 3 that L φ has a total of 17 4 n 2 + 28n + 1 labels.Therefore, we have: However, by our initial assumption: , and thus |τ (φ)| ≥ k, i.e., the truth assignment τ satisfies at least k clauses of φ.This completes the proof of the theorem.
The next corollary follows immediately by Theorem 5.
Using Theorem 5 and Corollary 3, we are now ready to prove the main theorem of this section.Theorem 6.The problem of computing r(G, L) on an undirected temporally connected graph G(L) is APX-hard.
Proof.Denote by OPT mon-Max-XOR(3) (φ) the greatest number of clauses that can be simultaneously XOR-satisfied by a truth assignment of φ.The proof is done by an L-reduction [31] from the monotone Max-XOR(3) problem, i.e. by an approximation preserving reduction which linearly preserves approximability features.For such a reduction, it suffices to provide a polynomial-time computable function g and two constants α, β > 0 such that: We will prove the first condition for α = 13.Note that a random truth assignment XOR-satisfies each clause of φ with probability 1  2 , and thus there exists an assignment τ that XOR-satisfies at least m 2 clauses of φ.Therefore OPT mon-Max-XOR(3) (φ) ≥ m 2 = 3 4 n, and thus n ≤ 4 3 OPT mon-Max-XOR(3) (φ).Now Corollary 3 implies that: To prove the second condition for β = 1, consider an arbitrary labelling L ⊆ L φ of G φ .As described in the (⇐)-part of the proof of Theorem 5, we construct in polynomial time a truth assignment g(L) = τ that satisfies at least This completes the proof of the Theorem.
Note.In fact, we have also shown (Theorem 5) that the problem of computing the removal profit is NP-hard in the strong sense, since all numbers used in the reduction are constant integers.

Temporally connected random labellings have high removal profit
In this section, we show that dense graphs with random labels have the property TC and have a very high removal profit asymptotically almost surely.More specifically, we consider the complete graph and the Erdös-Renyi model of random graphs, G n,p and we examine whether we can delete labels from such temporal graphs and continue preserving TC.
The (single-labelled) model of temporal graphs that we consider here is that of uniform random temporal graphs [1].

Definition 12.
[1] A uniform random temporal graph is a graph G on n vertices, n ∈ N, each edge of which receives exactly one label uniformly at random from a set {1, 2, . . ., α}, α ∈ N * and the selection of the label of an edge is independent from the selection of the label of any other edge.

High removal profit in the complete graph
Theorem 7. In the uniform random temporal graph where the underlying graph G is the complete graph (clique) of n vertices and α ≥ 4, we can delete all but Θ(n log n + log 2 n) labels without violating TC, with probability at least 1 − 1 n 2 .Proof.First, note that any set {1, 2, . . ., α} of α consecutive natural numbers can be partitioned into 4 disjoint almost equal subsets of consecutive numbers, A 1 , A 2 , A 3 , A 4 .Indeed, let α = 4k + v, where k ∈ N and v ∈ {1, 2, 3, 4}.
In any of the above four cases, each particular edge of the clique K n receives a single random label l, with: . So, we get the following Lemma: Lemma 6.For each particular edge e of K n and for the label l that it receives, it holds that P rob[l ∈ A i ] ≥ k 4k+3 , ∀i = 1, 2, 3, 4. Now, colour green(g), yellow (y), blue(b) and red (r) the edges that are assigned a label in A 1 , A 2 , A 3 and A 4 respectively.Definition 13.A temporal router (cf. Figure 11) of a clique , with the following properties (all logarithms are with base 2 here): a) V R is the union of a particular vertex v 0 (called the centre of R) and two equisized vertex sets V in and V out , each of γ log n vertices, and b) R is the induced subgraph of G formed from V R (so it is a clique itself ).Let w, w be any two vertices of the clique that are not in V R .We consider the edges connecting w to V in and the edges connecting w to V out ; using those edges and the edges of R, there are γ log n edge-disjoint paths of length 4 (each) connecting w and w .Let us call those paths special paths and note that every such path uses edges of the form {w, v in }, {v in , v 0 }, {v 0 , v out }, {v out , w }, where v in ∈ V in and v out ∈ V out (cf. Figure 12).Each special path P = (w, v in , v 0 , v out , w ) connecting w and w becomes a (w, w )-journey if the label l 1 of {w, v in } is in A 1 , the label l 2 of {v in , v 0 } is in A 2 , the label l 3 of {v 0 , v out } is in A 3 , and the label l 4 of {v out , w } is in A 4 .Then, the probability that P is a journey is at least 1 Since all special paths that connect w and w are edge-disjoint, the probability that none of them is a (w, w )-journey is: Therefore, we have: Lemma 7.For any two particular vertices w, w of V \ V R , the probability that there is a special path P from w to w that is a (w, w )-journey is at least 1 − n −γ log 2 2500 2499 .
Now, we consider only the edges and labels of R and, for each w ∈ V \V R , we consider only the edges connecting w to each vertex of R; the sparsified graph G = (V, E ) has, thus, |E | = (2γ log n+1)•2γ log n 2 + n−(2γ log n+1) •(2γ log n+ 1) = Θ(n log n + log 2 n) edges.We will show that we need only consider the edges (and labels) of G to maintain T C in G, i.e., that G itself is temporally connected, with probability at least 1 − 1 n 2 .Consider any pair, w, w , of vertices of the uniform random temporal graph on K n and a temporal router R. Also, consider the graph G as described above, with the labelling implied by the uniform random labelling on the clique.If w, w ∈ V R , then they are directly connected via a labelled edge in G and thus a journey exists both ways between them.If w ∈ V R and w ∈ V \ V R , then again there is a direct labelled edge in G connecting w and w , so there is a journey between them either way.
It remains to examine the existence in G of journeys between pairs of vertices w, w , w = w , none of which is in V R ; there are at most n 2 such pairs of vertices.Under the random labelling on G, let E 1 be the event that there exists a pair w, w ∈ V \ V R such that there is no (w, w )-journey via a special path through R. Also, let E 2 be the event that for a specific pair w, w ∈ V \ V R , there is no (w, w )-journey via a special path through R.Then, P r[E 1 ] ≤ n 2 P r[E 2 ] (by the Union Bound).
Note that Lemma 7 gives an upper bound on the probability of the event . Then, we have:

High removal profit in dense random Erdös-Renyi graphs
In this section, we consider the underlying graph G = (V, E) to be an instance of the Erdös-Renyi graph model, G n,p , with p ≥ γ ln n n 1 7 , γ ≥ 3. Definition 14 (Erdös-Renyi graphs).An instance of G n,p is formed when for every pair of vertices u, v among a total number of n vertices, the edge {u, v} is chosen to exist with probability p independently of any other edge.
Notice that G n,p is almost surely connected for any p ≥ 2 ln n n [9].As in the previous section, we consider here a uniform random temporal graph on G, i.e., we consider each edge of G to receive exactly one label uniformly at random from a set {1, 2, . . ., α}, with α ≥ 4. The selection of the label of an edge is independent of the selection of the label of any other edge.Also, the label selection process is independent of the process of selection of edges in G n,p .As in Theorem 7, we consider partitioning {1, 2, . . ., α} into four consecutive subsets, A 1 , A 2 , A 3 , A 4 , of consecutive positive integers, where each subset is of size either α 4 or α 4 + 1; such a partition is always possible.Now colour green(g), yellow (y), blue(b) and red (r) the edges that are assigned a label in A 1 , A 2 , A 3 and A 4 , respectively.As in Lemma 6, we have: Lemma 8.For each particular edge of G and for the label l that it receives, it holds that P rob[l ∈ A i ] ≥ 1 7 , ∀i = 1, 2, 3, 4. In such instances of G n,p , we cannot assume the existence of cliques such as the clique of the temporal router used in the previous section.Indeed, even for very dense instances of G n,p , with p = 1 2 , the largest clique is at most of size 2 ln n [9].
In order to "sparsify" labelled instances G of G n,p , by removing labels without violating TC, we need to guarantee the existence of much sparser routing subsets of G. Definition 15.Given two vertices v 1 , v 2 of G n,p , a temporal router, R(v 1 , v 2 ), in an instance I of G n,p is a subgraph of I that has vertices v 1 , v 2 and additional vertices a 1 , . . ., a k and b 1 , . . ., b k so that: • v 1 connects directly to each a i , b i , i = 1, . . ., k, • v 2 connects directly to each a i , b i , i = 1, . . ., k, • each pair a i , b i is directly connected, i = 1, . . ., k, • each edge {a i , b i } receives a green label, i = 1, . . ., k, • each edge {a i , v 1 } receives a yellow label, i = 1, . . ., k, • each edge {v 1 , b i } receives a blue label, i = 1, . . ., k, • each edge {v 2 , a i } receives a blue label, i = 1, . . ., k, • each edge {b i , v 2 } receives a yellow label, i = 1, . . ., k. Note.A temporal router R(v 1 , v 2 ) in an instance I of G n,p is temporally connected since: • any a i can reach any b j , via a journey through v 1 , i.e., (a i , v 1 , b j ) is a journey,  • any b i can reach any a j , via a journey through v 2 , i.e., (b i , v 2 , a j ) is a journey, • any a i can reach any a j = a i , via a journey through b i and then v 2 , i.e., (a i , b i , v 2 , a j ) is a journey, • any b i can reach any b j = b i , via a journey through a i and then v 1 , i.e., (b i , a i , v 1 , b j ) is a journey, • v 1 can reach v 2 , via any a i , i.e., (v 1 , a i , v 2 ) is a journey, • v 2 can reach v 1 , via any b i , i.e., (v 2 , b i , v 1 ) is a journey, and • all other (temporal) connections are direct.
Definition 16.We denote by R i and call it the i th theta subgraph of R(v 1 , v 2 ) the labelled subgraph of R(v 1 , v 2 ) induced by the vertices v 1 , v 2 , a i , and b i , for some i = 1, . . ., k (cf. Figure 15).
Note that the following Lemma holds: Lemma 9. Let I be an instance of G n,p with a uniform random labelling from the set {1, 2, . . ., α}, α ≥ 4.Then, for each particular i = 1, . . ., k, it holds: P r[R i exists in I] ≥ p 7 Proof.Each edge of R i is realized in G n,p with probability p and receives the correct type of label (green, yellow, blue, or red) with probability at least 1  7 .Note also that the edges of different theta subgraphs R i and R j , i = j, are disjoint.Thus, in G n,p , the random experiments of each of the theta subgraphs R i appearing are independent from each other and each succeeds with probability at least p 7 5 .Now, consider the set of vertices V \ {v 1 , v 2 } and partition it into two almost equal sets V 1 and V 2 ; note that |V i | ≥ n 2 − 2 = n , i = 1, 2. Consider a pairing of n vertices of V 1 to n vertices of V 2 and let the n different pairs be the possible pairs of vertices a i , b i in a theta subgraph R i .By Lemma 9 and since the random experiments are independent, the number of appearances of R i is at least the number of successes in a Bernoulli distribution of n trials, with success probability p
We now condition on the event, E 1 , that the instance I of a labelled G n,p has a temporal router R(v 1 , v 2 ) of at least k = n
Notice that to calculate the probability of the event E 1 , we did not examine at all the appearance of edges from a vertex outside of R(v 1 , v 2 ) to any vertex of R(v 1 , v 2 ).Given that R(v 1 , v 2 ) exists, any vertex u that is not in R(v 1 , v 2 ) can reach any vertex u that is also not in R(v 1 , v 2 ) through R(v 1 , v 2 ) via a journey, if u connects to some a i directly with a green edge, and b i connects to u directly with a red edge.Then, (u, a i , v 1 , b i , u ) is a journey.The probability of the edge {u, a i } being green and the edge {b i , u } being red, for any i, is p Lemma 11.Condition on the event E 1 of the existence of R(v 1 , v 2 ) in G n,p with at least k = n Proof.For the vertices u, u as described above and any one of the k possible journeys of the form (u, a i , v 1 , b i , u ), the probability that such a journey fails (i.e., is not realized) is at most 1 − p Let E 2 be the event that given k pairs of vertices a i , b i in a possible R(v 1 , v 2 ), each vertex pair u, u , with u = u and u, u ∈ V R(v 1 , v 2 ) , satisfies the following: there is at least one pair of vertices a i , b i such that u connects to a i with a green edge and u connects to b i with a red edge.
Notice that Ē2 is the event that there is a pair of vertices u, u that are not in R(v 1 , v 2 ) that fails to connect as described above.Since the number of possible pairs of vertices u, u is less than n 2 , we have: Note now that the following Lemma holds: Lemma 12.The event E 1 and the evnt E 2 (given E 1 ) guarantee that the (labelled) instance I of G n,p is temporally connected "via the temporal router R(v 1 , v 2 )".
Proof.Condition on E 1 and on E 2 (given E 1 ).Then, for each vertex u ∈ V R(v 1 , v 2 ) , keep one of its green edges (to some a i ) and one of its red edges (to the corresponding b i ), since by E 2 , those exist.Remove all edges of I except for the edges of R(v 1 , v 2 ) and the two edges we keep for every vertex that is not in R(v 1 , v 2 ).The resulting labelled subgraph of I is temporally connected, since: a) R(v 1 , v 2 ) is temporally connected itself, by construction, b) any u ∈ V R(v 1 , v 2 ) has a journey via R(v 1 , v 2 ) to any other u ∈ V in the graph, c) any a i or b j can reach any u ∈ V R(v 1 , v 2 ) via a journey through v 1 (using first a green edge, if we start from a b j vertex, and then using a yellow, a blue and a red edge to reach u), and d) v 1 and v 2 can reach any u ∈ V R(v 1 , v 2 ) via a journey through some vertex b i (using first a blue -or yellow, respectively-edge to b i , and then a red edge to u).
The temporally connected instance I of G n,p after the removal of redundant edges as described above has a number of labelled edges (i.e., time-edges) that is at most 2n + Θ(k).Since k = n

( a )
If arrival_time[v] < +∞, then there exists a foremost journey from s to v, the arrival time of which is exactly arrival_time[v].This journey can be constructed by following the parent[v] pointers in reverse order.(b) If arrival_time[v] = +∞, then no (s, v)-journey exists.(c) The time complexity of Algorithm 1 is dominated by the sorting time of the set of time edges (resp.time arcs).

Corollary 1 .
The time complexity of Algorithm 1 is O c(L) • log c(L) .Proof.The time complexity of the algorithm is dominated by the sorting time of S(L).One can sort S(L) by comparison-based sorting resulting in running time O(|S(L)| • log |S(L)|) = O c(L) • log c(L) .

Figure 1 :
Figure 1: Labelling a star graph in an optimal way

Figure 3 :
Figure 3: L must assign to {u, u } at least 2 labels.Therefore, in any case, for L to satisfy TC on G, it needs to have cost c(L) ≥ 2k − 1.

Figure 5 :
Figure 5: Labelling a connected undirected graph to satisfy TC

Theorem 4 .
Let n ∈ N, n ≥ 4 and denote by K n the complete graph on n vertices.There exists no minimal SLSE temporal graph on K n (L).In fact, we can remove (at least) n 4 labels from any SLSE labelling on K n (L) without violating TC.

Figure 6 :
Figure 6: Any SLSE labelling on K 4 is not minimal.

Figure 7 :
Figure 7: The six sub-cases cover all possible scenarios of "entanglement".
b) The gadget for the clause (xi ⊕ xj).

5 .
, n}.If b = w xi 0 then there exists the temporal path on the edges {s xi , u xi 0 } (with label 1) and {u xi 0 , w xi 0 } (with label 2).If b = w xi 0 then there exists the temporal path from s xi to w xi 0 (with maximum label 2), followed by the edge {w xi 0 , b} (with label 7).Assume now that a = s xi , for every i ∈ {1, 2, . . ., n}.That is, a = u xi p or a = v xi p , for some i ∈ {1, 2, . . ., n} and some p ∈ {0, 1, 2, 3}.If b = w xi p then there exists the temporal path from a to b on the edge {a, b} (with Theorem There exists a truth assignment τ of φ with |τ (φ)| ≥ k if and only if there exists a TC satisfying labelling L ⊆ L φ of G φ such that |L φ \L| ≥ 9n+k.

Figure 10 :
Figure 10: The labelling L ⊆ L φ of the edges of fig.9b for the clause α = (x i ⊕x j ) of φ.
xi p , w xi p } or {w xi p , v xi p }, since there are exactly 2n transition edges on the different bases of G φ and 2m transition edges on the different branches of G φ .From Lemma 5(b), L contains m additional labels, one for each branch, more specifically for the respective edge {t xi p , w xi p } of the branch.From Lemma 5(c), L contains m(m−1) 2 extra labels among the vertices {t xi p : 1 ≤ i ≤ n, 1 ≤ p ≤ 3}.From Lemma 5(d), L also contains (n+m)(n+m−1) 2 additional labels among the vertices {w xi p : 1 ≤ i ≤ n, 0 ≤ p ≤ 3}.From Lemma 5(e), L also contains 15 2 n+1 labels on the edges incident to t 0 .Finally, from Lemma 5(f), L contains at least 4n + m additional labels: for each G φ,i , L contains at least 4 labels, namely one label on the base edge {s xi , u xi 0 } or on the base edge {s xi , v xi 0 } and, for every p ∈ {1, 2, 3}, one label on the edge {u xi 0 , u xi p } or on the edge {v xi 0 , v xi p }; also, for each branch of G φ , L contains at least 1 label, namely a label on the edge {u xj p , t xj p } or on the edge {v xj p , t xj p }, for some p ∈ {1, 2, 3} and j ∈ {1, 2, . . ., m}.

Figure 12 :
Figure 12: A special path connecting w and w .

Figures 13 and 14
Figures 13 and 14 show a temporal router R(v 1 , v 2 ) for k = 1 and k = 2 respectively.

Figure 15 :
Figure 15: The i th theta subgraph, R i .

7 5 2 p 7 5 5 ≥ 1 − e − n 12 ( p 7 ) 5 (since n ≥ n 3 ). Corollary 4 .n p 7 5 4 n 12 ( p 7 )
per trial.Therefore, by the Chernoff bound, we have the following Lemma: Lemma 10.In any instance I of a G n,p that has been labelled uniformly at random, the probability that there is a temporal router R(v 1 , v 2 ) consisting of at least k = n theta subgraphs R i is at least 1 − e − 1 4 n ( p 7 ) Note that, again by the Chernoff bound, k asymptotically almost surely does not exceed3  2 , since P r[k > 1 + 1 2 E(k)] ≤ e − 1

≤ n 2 e −k( p 7 ) 2 = e −k( p 7 ) 2
+2 ln n ≤ i ≤ n, 0 ≤ p ≤ 3}, each of them having one label in L φ .Therefore, since m =32 n, L φ assigns in total174 n 2 − 2n labels for these edges.Moreover, the labelling L φ assigns to every variable x i of φ in total 12 labels, i.e., two labels for each of the transition edges {u xi φ assigns to every clause (x i ⊕ x j ) of φ in total 7 labels, i.e.
we keep in L the label 1 of both edges {v xi p , w xi p } and {w xi p , u xi p }, cf. Figure 10b.This finalizes the labelling L of G φ .It is easy to check that L satisfies TC on G φ .Summarizing, the labelling L misses in total 6 labels of L φ for the edges {{s xi , u xi 0 }, {s xi , v xi ≤ 3, i = 1, 2, . . ., n}.That is, L misses in total 6n labels of L φ for all variables x 1 , x 2 , . . ., x n .For each of the k XOR-satisfied clauses (x i ⊕ x j ) of φ, the labelling L misses in total 3 labels of L φ for the edges where x i is associated with the pth branch of G φ,i .That is, L misses in total 3k labels of L φ for all XOR-satisfied clauses.Furthermore, for each of the m − k XOR-satisfied clauses (x i ⊕ x j ) of φ, the labelling L misses in total 2 labels of L φ for the edges