Temporal Vertex Cover with a Sliding Time WindowThis work was partially supported by the NeST initiative of the School of EEE and CS at the University of Liverpool and by the EPSRC Grants EP/P020372/1 and EP/P02002X/1.

# Temporal Vertex Cover with a Sliding Time Window††thanks: This work was partially supported by the NeST initiative of the School of EEE and CS at the University of Liverpool and by the EPSRC Grants EP/P020372/1 and EP/P02002X/1.

Eleni C. Akrida Department of Computer Science, University of Liverpool, Liverpool, UK. Email: e.akrida@liverpool.ac.uk    George B. Mertzios Department of Computer Science, Durham University, Durham, UK. Email: george.mertzios@durham.ac.uk    Paul G. Spirakis Department of Computer Science, University of Liverpool, Liverpool, UK. Email: p.spirakis@liverpool.ac.uk    Viktor Zamaraev Department of Computer Science, Durham University, Durham, UK. Email: viktor.zamaraev@durham.ac.uk
###### Abstract

Modern, inherently dynamic systems are usually characterized by a network structure, i.e. an underlying graph topology, which is subject to discrete changes over time. Given a static underlying graph , a temporal graph can be represented via an assignment of a set of integer time-labels to every edge of , indicating the discrete time steps when this edge is active. While most of the recent theoretical research on temporal graphs has focused on the notion of a temporal path and other “path-related” temporal notions, only few attempts have been made to investigate “non-path” temporal graph problems. In this paper, motivated by applications in sensor and in transportation networks, we introduce and study two natural temporal extensions of the classical problem Vertex Cover. In our first problem, Temporal Vertex Cover, the aim is to cover every edge at least once during the lifetime of the temporal graph, where an edge can only be covered by one of its endpoints at a time step when it is active. In our second, more pragmatic variation Sliding Window Temporal Vertex Cover, we are also given a natural number , and our aim is to cover every edge at least once at every consecutive time steps. In both cases we wish to minimize the total number of “vertex appearances” that are needed to cover the whole graph. We present a thorough investigation of the computational complexity and approximability of these two temporal covering problems. In particular, we provide strong hardness results, complemented by various approximation and exact algorithms. Some of our algorithms are polynomial-time, while others are asymptotically almost optimal under the Exponential Time Hypothesis (ETH) and other plausible complexity assumptions.

Keywords: Temporal networks, temporal vertex cover, APX-hard, approximation algorithm, Exponential Time Hypothesis.

## 1 Introduction and Motivation

A great variety of both modern and traditional networks are inherently dynamic, in the sense that their link availability varies over time. Information and communication networks, social networks, transportation networks, and several physical systems are only a few examples of networks that change over time [22, 33]. The common characteristic in all these application areas is that the network structure, i.e. the underlying graph topology, is subject to discrete changes over time. In this paper we adopt a simple and natural model for time-varying networks which is given with time-labels on the edges of a graph, while the vertex set remains unchanged. This formalism originates in the foundational work of Kempe et al. [25].

###### Definition 1 (temporal graph).

A temporal graph is a pair , where is an underlying (static) graph and is a time-labeling function which assigns to every edge of a set of discrete-time labels.

For every edge in the underlying graph of a temporal graph , denotes the set of time slots at which is active in . Due to its vast applicability in many areas, this notion of temporal graphs has been studied from different perspectives under various names such as time-varying [17, 35, 1], evolving [5, 16, 11], dynamic [19, 8], and graphs over time [29]; for a recent attempt to integrate existing models, concepts, and results from the distributed computing perspective see the survey papers [8, 6, 7] and the references therein. Data analytics on temporal networks have also been very recently studied in the context of summarizing networks that represent sports teams’ activity data to discover recurring strategies and understand team tactics [27], as well as extracting patterns from interactions between groups of entities in a social network [26].

Motivated by the fact that, due to causality, information in temporal graphs can “flow” only along sequences of edges whose time-labels are increasing, most temporal graph parameters and optimization problems that have been studied so far are based on the notion of temporal paths and other “path-related” notions, such as temporal analogues of distance, diameter, reachability, exploration, and centrality [2, 14, 31, 32, 3]. In contrast, only few attempts have been made to define “non-path” temporal graph problems. Motivated by the contact patterns among high-school students, Viard et al. [37, 38], and later Himmel et al. [21], introduced and studied -cliques, an extension of the concept of cliques to temporal graphs, in which all vertices interact with each other at least once every consecutive time steps within a given time interval.

In this paper we introduce and study two natural temporal extensions of the problem Vertex Cover in static graphs, which take into account the dynamic nature of the network. In the first and simpler of these extensions, namely Temporal Vertex Cover (for short, TVC), every edge has to be “covered” at least once during the lifetime of the network (by one of its endpoints), and this must happen at a time step when is active. The goal is then to cover all edges with the minimum total number of such “vertex appearances”. On the other hand, in many real-world applications where scalability is important, the lifetime  can be arbitrarily large but the network still needs to remain sufficiently covered. In such cases, as well as in safety-critical systems (e.g. in military applications), it may not be satisfactory enough that an edge is covered just once during the whole lifetime of the network. Instead, every edge must be covered at least once within every small -window of time (for an appropriate value of ), regardless of how large the lifetime is; this gives rise to our second optimization problem, namely Sliding Window Temporal Vertex Cover (for short, SW-TVC). Formal definitions of our problems TVC and SW-TVC are given in Section 2.

Our two temporal extensions of Vertex Cover are motivated by applications in sensor networks and in transportation networks. In particular, several works in the field of sensor networks considered problems of placing sensors to cover a whole area or multiple critical locations, e.g. for reasons of surveillance. Such studies usually wish to minimize the number of sensors used or the total energy required [28, 20, 13, 39, 34]. Our temporal vertex cover notions are an abstract way to economically meet such covering demands as time progresses.

### 1.1 Our contribution

In this paper we present a thorough investigation of the complexity and approximability of the problems Temporal Vertex Cover (TVC) and Sliding Window Temporal Vertex Cover (SW-TVC) on temporal graphs. We first prove in Section 3 that TVC remains NP-complete even on star temporal graphs, i.e. when the underlying graph is a star. Furthermore we prove that, for any , TVC on star temporal graphs cannot be optimally solved in time, assuming the Strong Exponential Time Hypothesis (SETH), as well as that it does not admit a polynomial-time -approximation algorithm, unless NP has -time deterministic algorithms. On the positive side, we prove that TVC on star temporal graphs with vertices can be -approximated in polynomial time, where is the th harmonic number. Moreover we prove that TVC on general temporal graphs admits a polynomial-time randomized approximation algorithm with expected ratio .

In Section 4 and in the reminder of the paper we deal with SW-TVC. For our second problem, SW-TVC, we prove in Section 4.1 a strong complexity lower bound on arbitrary temporal graphs. More specifically we prove that, for any (arbitrarily growing) functions and , there exists a constant such that SW-TVC cannot be solved in time, assuming the Exponential Time Hypothesis (ETH). This ETH-based lower bound turns out to be asymptotically almost tight, as we present an exact dynamic programming algorithm with running time . This worst-case running time can be significantly improved in certain special temporal graph classes. In particular, when the “snapshot” of at every time step has vertex cover number bounded by , the running time becomes . That is, for small values of  (say, when is or ), this algorithm is polynomial in the input size on temporal graphs with bounded vertex cover number at every time step. Notably, when every snapshot is a star (i.e. a superclass of the star temporal graphs studied in Section 3) the running time of the algorithm is .

In Section 5 we prove strong inapproximability results for SW-TVC even when restricted to temporal graphs with length of the sliding window. In particular, we prove that this problem is APX-hard (and thus does not admit a Polynomial Time Approximation Scheme (PTAS), unless P = NP), even when , the maximum degree in the underlying graph is at most , and every connected component at every graph snapshot has at most vertices. Finally, in Section 6 we provide a series of approximation algorithms for the general SW-TVC problem, with respect to various incomparable temporal graph parameters. In particular, we provide polynomial-time approximation algorithms with approximation ratios (i) , (ii) , where is the maximum number of times that each edge can appear in a sliding time window (thus implying a ratio of in the general case), (iii) , where is the maximum vertex degree at every snapshot of . Note that, for , the latter result implies that SW-TVC can be optimally solved in polynomial time whenever every snapshot of is a matching.

## 2 Preliminaries and notation

A theorem proving that a problem is NP-hard does not provide much information about how efficiently (although not polynomially, unless P = NP) this problem can be solved. In order to prove some useful complexity lower bounds, we mostly need to rely on some complexity hypothesis that is stronger than“P  NP”. The Exponential Time Hypothesis (ETH) is one of the established and most well-known such complexity hypotheses.

###### Exponential Time Hypothesis (Eth [24]).

There exists an such that 3SAT cannot be solved in time, where is the number of variables in the input 3-CNF formula.

In addition to formulating ETH, Impagliazzo and Paturi proved the celebrated Sparsification Lemma [23], which has the following theorem as a consequence. This result is quite useful for providing lower bounds assuming ETH, as it expresses the running time in terms of the size of the input 3-CNF formula, rather than only the number of its variables.

###### Theorem 1 ([23]).

3SAT can be solved in time if and only if it can be solved in time  on 3-CNF formulas with variables and clauses.

Given a (static) graph , we denote by and the sets of its vertices and edges, respectively. An edge between two vertices and of is denoted by , and in this case and are said to be adjacent in . The maximum label assigned by to an edge of , called the lifetime of , is denoted by , or simply by when no confusion arises. That is, . For every , where , we denote . Throughout the paper we consider temporal graphs with finite lifetime , and we refer to each integer as a time point (or time slot) of . The instance (or snapshot) of at time is the static graph , where . For every , where , we denote by the restriction of to the time slots , i.e.  is the sequence of the instances . We assume in the remainder of the paper that every edge of appears in at least one time slot until , namely .

Although some optimization problems on temporal graphs may be hard to solve in the worst case, an optimal solution may be efficiently computable when the input temporal graph has special properties, i.e. if belongs to a special temporal graph class (or time-varying graph class [6, 8]). To specify a temporal graph class we can restrict (a) the underlying topology , or (b) the time-labeling , i.e. the temporal pattern in which the time-labels appear, or both.

###### Definition 2.

Let be a temporal graph and let be a class of (static) graphs. If  then is an temporal graph. On the other hand, if for every , then is an always temporal graph.

In the remainder of the paper we denote by and the number of vertices and edges of the underlying graph , respectively, unless otherwise stated. Furthermore, unless otherwise stated, we assume that the labeling is arbitrary, i.e.  is given with an explicit list of labels for every edge. That is, the size of the input temporal graph is . In other cases, where is more restricted, e.g. if is periodic or follows another specific temporal pattern, there may exist a more succinct representations of the input temporal graph.

For every and every time slot , we denote the appearance of vertex at time by the pair . That is, every vertex has different appearances (one for each time slot) during the lifetime of . Similarly, for every vertex subset and every time slot we denote the appearance of set at time by . With a slight abuse of notation, we write . A temporal vertex subset of is a set of vertex appearances in . Given a temporal vertex subset , for every time slot we denote by the set of all vertex appearances in at the time slot . Similarly, for any pair of time slots , where , is the restriction of the vertex appearances of within the time slots . Note that the cardinality of the temporal vertex subset is .

### 2.1 Temporal Vertex Cover

Let be a temporal vertex subset of . Let be an edge of the underlying graph and let be a vertex appearance in . We say that vertex covers the edge if , i.e.  is an endpoint of ; in that case, edge is covered by vertex . Furthermore we say that the vertex appearance temporally covers the edge if (i) covers and (ii) , i.e. the edge is active during the time slot ; in that case, edge is temporally covered by the vertex appearance . We now introduce the notion of a temporal vertex cover and the optimization problem Temporal Vertex Cover.

###### Definition 3.

Let be a temporal graph. A temporal vertex cover of is a temporal vertex subset of such that every edge is temporally covered by at least one vertex appearance in .

Temporal Vertex Cover   (TVC) Input: A temporal graph . Output: A temporal vertex cover of with the smallest cardinality .

Note that TVC is a natural temporal extension of the problem Vertex Cover on static graphs. In fact, Vertex Cover is the special case of TVC where . Thus TVC is clearly NP-complete, as it also trivially belongs to NP.

### 2.2 Sliding Window Temporal Vertex Cover

In the notion of a temporal vertex cover given in Section 2.1, the optimal solution actually depends on the lifetime (and thus also on the size) of the input temporal graph . On the other hand, in many real-world applications where scalability is important, the lifetime can be arbitrarily large. In such cases it may not be satisfactory enough that an edge is temporally covered just once during the whole lifetime of the temporal graph. Instead, in such cases it makes sense that every edge is temporally covered by some vertex appearance at least once during every small period of time, regardless of how large the lifetime is. Motivated by this, we introduce in this section a natural sliding window variant of the TVC problem, which offers a greater scalability of the solution concept.

For every time slot , we define the time window as the sequence of the consecutive time slots . We denote by the set of all time windows in the lifetime of . Furthermore we denote by the union of all edges appearing at least once in the time window . Finally we denote by the restriction of the temporal vertex subset to the window . We are now ready to introduce the notion of a sliding -window temporal vertex cover and the optimization problem Sliding Window Temporal Vertex Cover.

###### Definition 4.

Let be a temporal graph with lifetime and let . A sliding -window temporal vertex cover of is a temporal vertex subset of such that, for every time window and for every edge , is temporally covered by at least one vertex appearance in .

Sliding Window Temporal Vertex Cover   (SW-TVC) Input: A temporal graph with lifetime , and an integer . Output: A sliding -window temporal vertex cover of with the smallest cardinality .

Whenever the parameter is a fixed constant, we will refer to the above problem as the -TVC (i.e.  is now a part of the problem name). Note that the problem TVC defined in Section 2.1 is the special case of SW-TVC where , i.e. where there is only one -window in the whole temporal graph. Another special case333The problem -TVC has already been investigated under the name “evolving vertex cover” in the context of maintenance algorithms in dynamic graphs [9]; similar “evolving” variations of other graph covering problems have also been considered, e.g. the “evolving dominating set” [7]. of SW-TVC is the problem -TVC, whose optimum solution is obtained by iteratively solving the (static) problem Vertex Cover on each of the static instances of ; thus -TVC fails to fully capture the time dimension in temporal graphs.

### 2.3 Alternative models

In this section we briefly discuss two alternative variations of the problem SW-TVC, namely the problems Flexible SW-TVC and the Disjoint Window TVC. Although both these temporal variations of the (static) problem Vertex Cover could also be considered as being natural, it turns out that each of these problems is equivalent to iteratively solving either the static Vertex Cover problem or the TVC problem (defined in Section 2.1). We first introduce the notion of a flexible sliding -window temporal vertex cover and the optimization problem Flexible SW-TVC.

###### Definition 5.

Let be a temporal graph with lifetime and let . A flexible sliding -window temporal vertex cover of is a temporal vertex subset of such that, for every time window and for every edge , there exists at least one vertex appearance where is covered by .

Note by Definitions 4 and 5 that a sliding -window temporal vertex cover is also a flexible sliding -window temporal vertex cover, but not vice versa. To illustrate the differences between these two notions, consider a temporal graph , a time window , and an edge . Furthermore let be a temporal vertex subset of . In order for to be a sliding -window temporal vertex cover (see Definition 4), it is required that contains at least one of the vertex appearances and , where is a time slot in which is active in . In contrast, in order for to be a flexible sliding -window temporal vertex cover (see Definition 5), it is required that contains at least one of the vertex appearances and , where is any time slot in , i.e not necessarily a time slot of in which is active.

The problem Flexible Sliding Window Temporal Vertex Cover (for short, Flexible SW-TVC) asks to compute a flexible sliding -window temporal vertex cover of with the smallest cardinality . The next lemma shows that Flexible SW-TVC is equivalent to iteratively solving Vertex Cover on static graphs that are easily derived from the input temporal graph , and thus Flexible SW-TVC fails to fully capture the time dimension in temporal graphs. For the sake of the presentation of the next lemma, for every we define the interval .

###### Lemma 1.

Let be a temporal graph with lifetime , let , and let . For every , let be a minimum vertex cover of the (static) graph , where the union of the graph snapshots is understood as their edge-union. Then is an optimum solution of Flexible SW-TVC for .

###### Proof.

First we prove that is a flexible sliding -window temporal vertex cover of . Consider an edge of the underlying graph such that , i.e.  is active at the time slot . Then is active at least once at each of the time windows , where . Consider any of these time windows . Note that contains at least one time slot that is a multiple of , say , where . Therefore belongs to the static graph . Thus, since is a vertex cover of this graph, it follows that there exists at least one vertex appearance where is covered by . Therefore, since is arbitrary by assumption, is a flexible sliding -window temporal vertex cover of by Definition 5.

We now prove that is an optimum solution of Flexible SW-TVC. To this end, let be a flexible sliding -window temporal vertex cover of with minimum cardinality. Let be arbitrary. Consider the (static) graph (resp. ) which is the edge-union of all snapshots , where (resp. ). Let and be minimum vertex covers of and , respectively. Then, by Definition 5, must contain at least one vertex occurrence for every vertex in . That is, . Consider now the static graph , which is the edge-union of and , and let be a vertex cover of . Then note that , and thus . Therefore is an optimum solution of Flexible SW-TVC. ∎

We now introduce the notion of a disjoint -window temporal vertex cover and the optimization problem Disjoint Window TVC.

###### Definition 6.

Let be a temporal graph with lifetime , let , and let . A disjoint -window temporal vertex cover of is the union , where is a temporal vertex cover of the temporal graph .

The problem Disjoint Window Temporal Vertex Cover (for short, Disjoint Window TVC) asks to compute a disjoint -window temporal vertex cover of with the smallest cardinality . As it immediately follows by Definition 6, an optimum solution to Disjoint Window TVC is obtained by iteratively solving TVC (as defined in Section 2.1) on each of the temporal graphs , where . Therefore Disjoint Window TVC does not provide any additional temporal insights compared to the problems TVC and SW-TVC (cf. Sections 2.1 and 2.2, respectively).

## 3 Hardness and approximability of Tvc

In this section we investigate the complexity of Temporal Vertex Cover (TVC). First we prove in Section 3.1 that TVC remains NP-complete even on star temporal graphs, i.e. where the underlying graph is a star. Furthermore we prove that, for any , TVC on star temporal graphs cannot be optimally solved in time, unless the Strong Exponential Time Hypothesis (SETH) fails, as well as that it does not admit a polynomial-time -approximation algorithm, unless NP has -time deterministic algorithms.

In contrast, we prove that TVC on star temporal graphs can be -approximated in polynomial time, where is the th harmonic number. In Section 3.2 we use randomized rounding to prove that TVC on general temporal graphs admits a polynomial-time randomized approximation algorithm with expected ratio . This result is complemented by our results in Section 6.1 where we prove that SW-TVC (and thus also TVC) can be deterministically approximated with ratio in polynomial time.

### 3.1 Hardness on star temporal graphs

In the next theorem we prove that TVC on star temporal graphs (i.e. when the underlying graph is a star, cf. Definition 2) is equivalent to Set Cover, and thus the known (in)approximability results for Set Cover carry over to TVC. This hardness result of TVC is in wide contrast to the (trivial) solution of Vertex Cover on a static star graph.

###### Theorem 2.

TVC on star temporal graphs is NP-complete and it admits a polynomial-time -approximation algorithm. Furthermore, for any , TVC on star temporal graphs does not admit any polynomial-time -approximation algorithm, unless NP has -time deterministic algorithms.

###### Proof.

First we reduce Set Cover to TVC on star temporal graphs, and vice versa.

Set Cover Input: A universe and a collection of of subsets of such that . Output: A subset with the smallest cardinality such that .

Given an instance of Set Cover, we construct an equivalent instance of TVC on star temporal graphs as follows. We set and we let be a star graph on vertices, with center and leaves . The labeling is such that, at every time slot , is a star centered at and with leaves all the vertices such that .

Conversely, let be an instance of TVC on star temporal graphs, where is a star on vertices, with center and leaves . From we construct an equivalent instance of Set Cover as follows. We set and, for every , we define to be the set of all elements such that .

In both reductions, we will now prove that there exists a temporal vertex cover in such that if and only if there exists a set cover of such that .

• Let be a minimum-cardinality temporal vertex cover of , and let . Since has minimum cardinality and is a star, it follows that, for every , either or . Then the collection is a set cover of . Indeed, if then the appearance in covers all the edges of , where . Thus, as the sequence of all non-empty sets covers all edges of , it follows that the union of all sets covers all elements of . Finally, since , it follows by construction that .

• Let be an optimal solution to Set Cover, and let . We define the temporal vertex set . For every , the appearance of in covers all edges of , where . Thus, as the sets of cover all elements of , it follows that is a temporal vertex cover of . Finally, since , it follows by construction that .

Therefore TVC on star temporal graphs is equivalent to Set Cover, and thus in particular TVC on star temporal graphs is NP-complete.

The polynomial-time greedy algorithm of [10] for Set Cover achieves an approximation ratio of , where is the maximum size of a set in the input instance and is the th harmonic number. Therefore, since in an input instance of Set Cover with elements in the universe , the maximum size of a set in is at most , the approximation algorithm of [10] has ratio on such an instance. Furthermore, due to the above polynomial-time reduction of TVC on star temporal graphs to Set Cover, it follows that TVC on star temporal graphs with vertices can be approximated in polynomial time within ratio .

Finally, it is known that, for any , Set Cover cannot be approximated in polynomial time within a factor of unless NP has -time deterministic algorithms [15]. Therefore, due to the above polynomial-time reduction of Set Cover to TVC on star temporal graphs, it follows that TVC on star temporal graphs does not admit such polynomial-time approximation algorithms as well. ∎

In the next theorem we complement our hardness results for TVC on star temporal graphs by reducing Hitting Set to it.

###### Theorem 3.

For every , TVC on star temporal graphs cannot be optimally solved in  time, unless the Strong Exponential Time Hypothesis (SETH) fails.

###### Proof.

The proof is done via a reduction of Hitting Set to TVC on star temporal graphs. This reduction has a similar flavor as the one presented in Theorem 2, since the problems Set Cover and Hitting Set are in a sense dual to each other444That is seen by observing that an instance of Set Cover can be viewed as an arbitrary bipartite graph, with sets represented by vertices on the left, the universe represented by vertices on the right, and edges representing the inclusion of elements in sets. The task is then to find a minimum-cardinality subset of left-vertices which covers all of the right-vertices. In the Hitting Set problem, the objective is to cover the left-vertices using the smallest number of right vertices. Converting from one problem to the other is therefore achieved by interchanging the two sets of vertices.. We first present the definition Hitting Set.

Hitting Set Input: A universe and a collection of of subsets of such that . Output: A subset with the smallest cardinality such that contains at least one element from each set in .

Given an instance of Hitting Set, we construct an equivalent instance of TVC on star temporal graphs as follows. We set and let be a star on vertices with center vertex and leaves . The labeling is such that, at every time slot , is a star centered at and with leaves all the vertices such that . Following a similar argumentation as in Theorem 2, it follows that there exists a temporal vertex cover in such that if and only if there exists a hitting set of such that .

Assume now that there exists an -time algorithm for optimally solving TVC on star temporal graphs, for some . Then, due to the above reduction from Hitting Set, we can use this algorithm to optimally solve Hitting Set in -time. This is a contradiction, unless the Strong Exponential Time Hypothesis (SETH) fails [12]. ∎

### 3.2 A randomized rounding algorithm for Tvc

In this section we provide a linear programming relaxation of TVC, and then, with the help of a randomized rounding technique, we construct a feasible solution whose expected size is within a factor of of the optimal size.

Let be a temporal graph with lifetime ; let , where and . First we give an integer programming formulation of TVC. We introduce a variable , for every vertex and time slot pair, that will be if the vertex appearance is selected in the candidate temporal vertex cover and otherwise. The objective then is to minimize the sum of vertex appearances selected in the candidate temporal vertex cover, while covering every edge at a time slot in which it appears. Since every edge must be covered by at least one of its endpoints’ appearances at a time slot , we require for every edge the inequality:

 ∑t∈λ(e)(xut+xvt)≥1

This inequality constraint together with the integrality constraint for all variables yields the following integer programming formulation of TVC:

 minimize∑v∈V,t∈[T]\leavevmode\nobreak xvtsubject to∑t∈λ(uv)(xut+xvt)≥1,for all uv∈E\leavevmode\nobreak xvt∈{0,1},for all v∈V,t∈[T]

If is the optimal value of this integer program, then it is not hard to see that , where OPT is the value of an optimal solution to TVC.

The corresponding linear programming relaxation of this integer program is:

 minimize∑v∈V,t∈[T]\leavevmode\nobreak xvtsubject to∑t∈λ(uv)(xut+xvt)≥1,for all uv∈E\leavevmode\nobreak xvt≥0,for all v∈V,t∈[T]

We could also add the constraints , for all but they would be redundant, since in any optimal solution to the problem all the variables are at most ; indeed, notice that any can be reduced to without affecting the feasibility of the solution. If is the optimal value of this linear program, then clearly .

###### Theorem 4.

There exists a polynomial-time randomized approximation algorithm for Temporal Vertex Cover with expected approximation factor .

###### Proof.

We apply randomized rounding to our linear program. Let be an optimal solution to the linear programming relaxation. For every vertex appearance we pick to our solution (equivalently, we set to ) with probability independently.

We begin by analyzing the probability that a given edge is covered. Pick an arbitrary edge . Let , for some . For all denote by the value and denote by the value . Then, by applying the arithmetic-geometric mean inequality555For any nonnegative , , we see that:

 Pr[edge e=uv is not covered] = ∏t∈λ(e)(1−x∗ut)(1−x∗vt) (1) = k∏i=1(αiβi) ≤ (12k(k∑i=1αi+k∑i=1βi))2k.

Since is an optimal solution to the linear programming relaxation, it holds that:

 ∑t∈λ(e)(x∗ut+x∗vt) ≥ 1⇔k∑i=1(x∗uli+x∗vli)≥1⇔k∑i=1((1−αi)+(1−βi))≥1⇔ k∑i=1αi+k∑i=1βi ≤ 2k−1.

Hence, equation (1) becomes:

 Pr[edge e=uv is not covered]≤(1−12k)2k≤e−1. (2)

We now repeat the above random experiment times independently, for some constant . Let denote the union of all of the sets of selected vertex appearances per experiment, i.e.  contains all vertex appearances which have been picked in at least one experiment. The probability that there is an edge of the graph that is not covered by is, by the union bound, bounded from above by the product of the number of edges and the probability that a particular edge is not covered by . By equation (2), we get that the probability of a particular edge not being covered by is bounded from above by . Therefore, we have that the probability that is a Temporal Vertex Cover is:

 Pr[C∗ is a temporal vertex cover] = 1−Pr[∃e=uv∈E that is not covered by C∗] ≥ 1−n2e−γlnn = 1−1nγ−2.

Consider a particular experiment (out of the ). Let be a Bernoulli random variable that takes value if was picked in this experiment, and otherwise. Then . Now, notice that the expected size of is:

 E[|C∗|]≤γlnn E[∑v,tXvt]=γlnn Z∗LP≤γlnn Z∗IP=γlnn OPT.

If is not a temporal vertex cover, then one may select as a temporal vertex cover the trivial temporal vertex cover, , which selects for every edge an appearance or at a time slot with ; has size at most . Then the expected temporal vertex cover size that we get is:

 E[size of temporal vertex cover] ≤ γlnn OPT(1−1nγ−2)+n21nγ−2 = γlnn OPT+1nγ−4−γlnnnγ−2 OPT ≤ γlnn OPT+1\leavevmode\nobreak \leavevmode\nobreak \leavevmode\nobreak \leavevmode\nobreak \leavevmode\nobreak \leavevmode\nobreak \leavevmode\nobreak (since γ≥4).

Since we can assume that the input temporal graph has at least one edge, we have , and so the expected approximation ratio is:

 E[size of temporal vertex cover]OPT≤γlnn+2. (3)

The time complexity of our proposed algorithm is at most , where is the time required to solve the linear programming relaxation of the problem. Indeed, performing a single randomized rounding experiment takes time , then verifying if is a temporal vertex cover takes time at most and finding a trivial temporal vertex cover (if needed) takes time .

## 4 An almost tight algorithm for Sw-Tvc

In this section we investigate the complexity of Sliding Window Temporal Vertex Cover (SW-TVC). First we prove in Section 4.1 a strong lower bound on the complexity of optimally solving this problem on arbitrary temporal graphs. More specifically we prove that, for any (arbitrarily growing) functions and , there exists a constant such that SW-TVC cannot be solved in time, assuming the Exponential Time Hypothesis (ETH). This ETH-based lower bound turns out to be asymptotically almost tight. In fact, we present in Section 4.2 an exact dynamic programming algorithm for SW-TVC whose running time on an arbitrary temporal graph is , which is asymptotically almost optimal, assuming ETH. In Section 4.3 we prove that our algorithm can be refined so that, when the vertex cover number of each snapshot is bounded by a constant , the running time becomes . That is, for small values of (say, when is or ), this algorithm is polynomial in the input size on temporal graphs with bounded vertex cover number at every slot. Notably, for the class of always star temporal graphs (i.e. a superclass of the star temporal graphs studied in Section 3.1) the running time of the algorithm is .

### 4.1 A complexity lower bound

In the classic textbook NP-hardness reduction from 3SAT to Vertex Cover (see e.g. [18]), the produced instance of Vertex Cover is a graph whose number of vertices is linear in the number of variables and clauses of the 3SAT instance. Therefore the next theorem follows by Theorem 1 (for a discussion see also [30]).

###### Theorem 5.

Assuming ETH, there exists an such that Vertex Cover cannot be solved in , where is the number of vertices.

In the the following theorem we prove a strong ETH-based lower bound for SW-TVC. This lower bound is asymptotically almost tight, as we present in Section 4.2 a dynamic programming algorithm for SW-TVC with running time , where and  are the numbers of vertices and edges in the underlying graph , respectively.

###### Theorem 6.

For any two (arbitrarily growing) functions and , there exists a constant such that SW-TVC cannot be solved in time assuming ETH, where is the number of vertices in the underlying graph of the temporal graph.

###### Proof.

We reduce Vertex Cover to SW-TVC as follows. Let be an instance graph of Vertex Cover with vertices. We construct the temporal graph with such that and is an independent set on vertices. Then, clearly the optimum solutions of Vertex Cover on coincide with the optimum solutions of SW-TVC on .

For the sake of contradiction assume that, for every , there exists an algorithm  that solves SW-TVC in time. Then we optimally solve SW-TVC on the temporal graph by applying the algorithm , where and is the constant of Theorem 5 for Vertex Cover. Note that is a constant, since both and  are constants. Furthermore note that the result of the algorithm is also a minimum vertex cover in the original (static) graph . The running time of is by assumption . Therefore, since is also a constant, the existence of the algorithm for SW-TVC implies an algorithm for Vertex Cover with running time , which is a contradiction, assuming ETH, due to Theorem 5. ∎

### 4.2 An exact dynamic programming algorithm

The main idea of our dynamic programming algorithm for SW-TVC is to scan the temporal graph from left to right with respect to time (i.e. to scan the snapshots increasingly on ), and at every time slot to consider all possibilities for the vertex appearances at the previous time slots. Before we proceed with the presentation and analysis of our algorithm, we start with a simple but useful observation.

###### Observation 1.

Let be a temporal graph with lifetime . Let be a sliding -window temporal vertex cover of . Then, for every , the temporal vertex subset  is a sliding -window temporal vertex cover of .

Let be a temporal graph with vertices and lifetime , and let . For every and every -tuple of vertex subsets of , we define to be the smallest cardinality of a sliding -window temporal vertex cover of , such that . If there exists no sliding -window temporal vertex cover  of  with these prescribed vertex appearances in the time slots , then we define . Note that, once we have computed all possible values of the function , then the optimum solution of SW-TVC on has cardinality

 OPT\textscSW−TVC(G,λ)=minA1,A2,…,AΔ⊆V{f(T−Δ+1;A1,A2,…,AΔ)}. (4)
###### Observation 2.

If the temporal vertex set is not a temporal vertex cover of then .

Due to Observation 2 we assume below without loss of generality that is a temporal vertex cover of . We are now ready to present our main recursion formula in the next lemma.

###### Lemma 2.

Let be a temporal graph, where . Let and let be a -tuple of vertex subsets of the underlying graph . Suppose that is a temporal vertex cover of . Then

 f(t;A1,A2,…,AΔ)=|AΔ|+minX⊆V{f(t−1;X,A1,…,AΔ−1)}. (5)
###### Proof.

First consider the case where . Assume that and let be a sliding -window temporal vertex cover of the instance , in which the vertex appearances in the the last time slots are given by . Then, by Observation 1, is a sliding -window temporal vertex cover of the instance . Moreover, the vertex appearances of in the the last time slots are given by . Now let be the set of vertices of which are active in during the time slot . Then note that is upper-bounded by the cardinality of , and thus , which is a contradiction. That is, if then also , and in this case the value of is correctly computed by (5).

Now consider the case where , and let be a vertex subset for which is minimized. Furthermore let be a minimum-cardinality sliding -window temporal vertex cover of the instance , in which the vertex appearances in the the last time slots are given by . Then is a sliding -window temporal vertex cover of the instance , since