Abstract 1 Introduction 2 Preliminaries 3 Hardness and Tractability of Temporal Edge Cover 4 Approximation of Temporal Edge Cover 5 Temporal Matching: Hardness and Tractability 6 Approximation of Temporal Matching 7 Relation between Max Temporal Matching and Min Temporal Edge Cover 8 Conclusion References

Matching and Edge Cover in Temporal Graphs

Lapo Cioni ORCID Università degli Studi di Firenze, Italy Riccardo Dondi ORCID Università degli Studi di Bergamo, Italy Andrea Marino ORCID Università degli Studi di Firenze, Italy Jason Schoeters ORCID Università degli Studi di Firenze, Italy Ana Silva ORCID Universidade Federal do Ceará, Fortaleza, Brasil
Abstract

Temporal graphs are a special class of graphs for which a temporal component is added to edges, that is, each edge possesses a set of times at which it is available and can be traversed. Many classical problems on graphs can be translated to temporal graphs, and the results may differ.

In this paper, we define the Temporal Edge Cover and Temporal Matching problems and show that they are NP-complete even when fixing the lifetime or when the underlying graph is a tree. We then describe two FPT algorithms, with parameters lifetime and treewidth, that solve the two problems. We also find lower bounds for the approximation of the two problems and give two approximation algorithms which match these bounds. Finally, we discuss the differences between the problems in the temporal and the static framework.

Keywords and phrases:
graphs, temporal graphs, edge cover, matching, parameterized algorithm, approximation algorithm
Copyright and License:
[Uncaptioned image] © Lapo Cioni, Riccardo Dondi, Andrea Marino, Jason Schoeters, and Ana Silva; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Graph algorithms
; Mathematics of computing Matchings and factors ; Mathematics of computing Approximation algorithms ; Theory of computation Problems, reductions and completeness ; Theory of computation Fixed parameter tractability
Related Version:
arxiv preprint: https://arxiv.org/abs/2504.06762 [4]
Funding:
This paper was partially funded by Italian PNRR CN4 Centro Nazionale per la Mobilità Sostenibile, NextGeneration EU - CUP, B13C22001000001. MUR of Italy, under PRIN Project n. 2022ME9Z78 – NextGRAAL: Next-generation algorithms for constrained GRAph visuALization, PRIN PNRR Project n. P2022NZPJA – DLT-FRUIT: A user centered framework for facilitating DLTs FRUITion.
Editors:
Kitty Meeks and Christian Scheideler

1 Introduction

A temporal graph is a graph where the edges are available only at prescribed moments. More formally, a temporal graph with lifetime τ is a pair 𝒢=(G,λ) where G is a graph (called the underlying graph) and λ is the time labelling that assigns to each edge a finite non-empty subset of [τ]. Alternatively, a temporal graph can be seen as a finite sequence of spanning subgraphs of G called snapshots. A temporal vertex is an occurrence of a vertex in time, i.e. an element of V(G)×[τ], and a temporal edge is an occurrence of an edge in time, i.e. (e,t) with eE(G) and tλ(e). They appear in the literature under many distinct names (temporal networks [8], edge-scheduled networks [2], dynamic networks [16], time-varying graphs [3], stream graphs, link streams [11], etc). We refer the reader to [8] for a plethora of applications. In the recent years, many papers have focused on studying how well-known problems in static graph theory translate into the temporal setting. In this paper we focus on edge covering and matching problems.

A matching111The definitions for matching and edge cover, as well as their relationship, can be found in most graph theory books. We refer to [15]. is a set of edges such that no two edges share a common vertex. An edge cover is a set of edges ensuring that every vertex in the graph is incident to at least one edge in the set. The maximum matching problem seeks to find a matching of the largest possible size, while the minimum edge cover problem aims to determine the smallest edge cover222We assume that the graph G has no isolated vertices.. These are fundamental problems in graph theory, known to be dual to each other and solvable in polynomial time. To illustrate their duality, consider a maximum matching M in a graph G. A minimum edge cover S of size |V(G)||M| can be obtained from M by greedily adding edges until all vertices in G are covered. Applying similar combinatorial reasoning, one can obtain a maximum matching from a minimum edge cover, bringing us to the equality α(G)+β(G)=|V(G)| [7], where α(G) is the size of a maximum matching and β(G) is the size of a minimum edge cover. This is known as Gallai’s Theorem.

The above concepts naturally extend to temporal graphs in multiple ways, depending on whether we aim to cover or saturate vertices versus temporal vertices, and whether we achieve this using edges or temporal edges. This distinction gives rise to four possible variations, as summarized in Tables 1 and 2. It is straightforward to show that most of these variations reduce to solving the corresponding minimum edge cover or maximum matching problem in static graphs. Indeed, whenever vertices are considered, the temporal component of the edges does not play a role in the problems, and the solutions are the same as those of the corresponding static problems on the underlying graph. On the other hand, if both temporal edges and temporal vertices are considered, then the snapshots of the temporal graph are independent and can be solved as they where static graphs (the resulting graph is called static expansion of a temporal graph [13]). For this reason, we focus on the cases highlighted in pink. In the following, we formally define the relevant concepts. We say that a temporal vertex (v,t) is isolated if tλ(uv) for every uN(v) (in other words, if v is isolated in snapshot Gt).

Table 1: Temporal variations of edge cover.
Table 2: Temporal variations of matching.
Definition 1 (Temporal Edge Cover).

Given a temporal graph 𝒢=(G,λ), a temporal edge cover of 𝒢 is a subset SE(G) such that, for every non-isolated (v,t)V(G)×[τ], there exists an edge eS incident to v such that tλ(e).

Examples of temporal edge cover are shown in Figure 2. Observe that the temporal edge covers presented are minimal, with the one on the right having the smallest cardinality among all edge covers of that temporal graph.

Definition 2 (Temporal Matching).

Given a temporal graph 𝒢=(G,λ), a subset ME(G) is a temporal matching of 𝒢 if for every e,eM, ee, either ee= or λ(e)λ(e)=.

Examples of temporal matching are shown in Figure 2. Observe that the temporal matchings are maximal, with the one on the right having maximum cardinality among all temporal matchings.

Figure 1: Two minimal temporal edge covers of a temporal graph. The one on the right has minimum cardinality.
Figure 2: Two maximal temporal matchings of a temporal graph. The one on the right has maximum cardinality.

We call Temporal Edge Cover (resp. Temporal Matching) the problem of, given a temporal graph 𝒢 and a nonnegative integer k, deciding whether there exists a temporal edge cover (resp. temporal matching) of 𝒢 of size at most (resp. at least) k.

Our Contributions.

Our results are summarized in Theorems 3 and 4. We prove that both problems are 𝖭𝖯-complete, even when τ=2 or when the underlying graph is a tree. This implies that both problems are para-𝖭𝖯-complete when parameterized by either the lifetime or the treewidth of the underlying graph. We then show that combining these parameters allows us to obtain 𝖥𝖯𝖳 algorithms. It is worth noting that the apparent similarity between the two problems is not due to shared proof techniques; rather, all proofs are independent. Finally, the problems differ in terms of approximation: while Temporal Edge Cover can be approximated within a logarithmic factor, Temporal Matching cannot. In particular, note that our approximation factors are asymptotically optimal.

Theorem 3.

Temporal Edge Cover

  1. 1.

    is 𝖭𝖯-complete even if τ=2;

  2. 2.

    is 𝖭𝖯-complete even if the underlying graph is a tree;

  3. 3.

    is 𝖥𝖯𝖳 parameterized by τ plus the treewidth of the underlying graph;

  4. 4.

    cannot be approximated within factor blogτ for any b with 0<b<1, unless 𝖯=𝖭𝖯;

  5. 5.

    can be approximated within factor O(logτ).

Theorem 4.

Temporal Matching

  1. 1.

    is 𝖭𝖯-complete even if τ=2;

  2. 2.

    is 𝖭𝖯-complete even if the underlying graph is a tree;

  3. 3.

    is 𝖥𝖯𝖳 parameterized by τ plus the treewidth of the underlying graph;

  4. 4.

    cannot be approximated within factor τ1ε, for any ε>0.

  5. 5.

    can be approximated within factor τ.

As previously noted, despite the apparent similarity, the proofs of Theorems 3 and 4 are fundamentally different. This independence arises from the fact that the size of a minimum temporal edge cover is unrelated to the size of a maximum temporal matching, unlike the case of static graphs. In fact, in Section 7 we prove a stronger result, namely that having a minimum temporal edge cover does not facilitate the computation of a maximum temporal matching, and vice versa. More specifically, we show that, given a temporal matching of maximum cardinality, finding a minimum temporal edge cover remains 𝖭𝖯-complete. Likewise, given a minimum temporal edge cover, finding a maximum temporal matching is also 𝖭𝖯-complete. Observe that this implies that a temporal version of Gallai’s Theorem cannot hold unless 𝖯=𝖭𝖯. A complete version of this paper can be found in [4].

Related Works.

Many variations of the temporal matching problem have been explored in the literature. The first definition of a temporal matching appears in [14], where it is defined as a set of temporal edges {(e1,t1),,(eq,tq)} such that {e1,,eq} forms a matching in the underlying static graph, and all timestamps are distinct. This constraint can be quite restrictive, as it permits selecting at most one edge per snapshot.

A relaxation of this constraint was introduced in [12] with the concept of a Δ-temporal matching. In this variation, temporal edges incident to the same vertex must have timestamps that differ by at least Δ. This concept arises from the idea of analyzing the graph through temporal windows of size Δ, which led to the definition of several Δ-related problems, summarized in [10]. In the latter work, they also introduce the notion of a Δ-edge cover, leaving open the related problem.

A closely related concept is that of a γ-matching in a link stream, introduced in [1], where γ is a fixed positive integer. Using our terminology, this corresponds to a set of temporal edges {(e1,t1),,(eq,tq)} such that {ti,,ti+γ1}λ(ei) for each i[q], and whenever |titj|<γ, then eiej=. Observe that this is a special case of Δ-temporal matching.

2 Preliminaries

A (undirected, loopless) graph G is an ordered pair (V,E), where V is a finite set and E{{u,v}u,vV,uv}. The elements of V are called vertices and the elements of E are called edges. Sometimes we use V(G) and E(G) to refer to the set of vertices and edges of G, respectively. Also, for simplicity, we write the elements of E(G) as uv instead of {u,v}, while still using the notation uuv. Given vV(G), let δG(v)={eE(G)ve} be the set of edges incident to v in G. Given a graph G, a positive integer τ and a function λ:E(G)𝒫([τ]), with 𝒫([τ]) being the power set of {1,,τ}, such that each edge is assigned a finite non-empty subset of [τ]. Then 𝒢=(G,λ) is a temporal graph with lifetime τ. We can see the vertices and edges of 𝒢 in two ways. One is to see them as just the vertices and edges of G. The other is to add a temporal component to them. In this way, we have temporal vertices in the form (v,i)V(G)×[τ], and temporal edges in the form (e,j) with eE(G) and jλ(e).

We recall some NP-complete problems that we use in the reductions of this paper.

3-SAT(2,2): given an input boolean formula F in conjunctive normal form, where each clause has three literals and each variable appears four times, of which exactly two times is negated, decide whether F is satisfiable and, if so, give an assignment that satisfies it.

Set Cover: given a pair (U,𝒮) and a nonnegative integer k, where U=[n] for some n and 𝒮={S1,,Sm} is a collection of subsets of U, determine (if it exists) a subcollection of at most k subsets Si1, …Sik such that Uj=0kSij.

Set Packing: given a collection of sets 𝒮={S1,,Sm} and a nonnegative integer k, determine (if it exists) a subcollection of at least k pairwise disjoint sets in 𝒮.

Finally, we recall the definition of nice tree decomposition, that we use for the 𝖥𝖯𝖳 algorithms.

A tree decomposition of a graph G is a pair (T,{Xt}tV(T)), where T is a tree and {Xt}tV(T) is a collection of subsets of V(G) (called bags), such that the following three conditions hold:

  1. 1.

    Every vertex of G appears in at least one bag:

    tV(T)Xt=V(G).
  2. 2.

    For every edge (u,v)E(G), there exists a bag Xt such that both u and v are in Xt:

    (u,v)E(G),tV(T) such that {u,v}Xt.
  3. 3.

    For every vertex vV(G), the set of nodes {tV(T)vXt} forms a subtree of T.

The width of a tree decomposition is defined as maxtV(T)|Xt|1, i.e., the size of the largest bag minus one. The treewidth of a graph G is the minimum width over all possible tree decompositions of G.

A tree decomposition (T,{Xt}tV(T)) of G is a nice tree decomposition if:

  1. 1.

    T is a rooted tree (call r its root), and each node tV(T) is one of the following types:

    • Leaf node: t is a leaf of T, and Xt=.

    • Introduce node: t has exactly one child t, and Xt=Xt{v} for some vXt. We say that t introduces v.

    • Forget node: t has exactly one child t, and Xt=Xt{v} for some vXt. We say that t forgets v.

    • Join node: t has exactly two children t1 and t2, and Xt=Xt1=Xt2.

  2. 2.

    Br=.

It is largely known that a nice tree decomposition can be obtained from a tree decomposition without increasing the width. We refer the reader to [5] for a very good introduction about how to obtain algorithms that run in 𝖥𝖯𝖳 time when parameterized by the treewidth.

3 Hardness and Tractability of Temporal Edge Cover

In this section, we study the complexity of Temporal Edge Cover. Specifically, we show that Temporal Edge Cover is NP-complete when the lifetime τ of graph is 2, and then we show that it is NP-complete even when the underlying graph is a tree. This suggests that both the lifetime τ and the treewidth w of a graph play an important role in the complexity of Temporal Edge Cover. Indeed, we describe an 𝖥𝖯𝖳 algorithm in τ and w which solves the problem.

3.1 Hardness for 𝝉=𝟐

We prove that Temporal Edge Cover restricted to τ=2 is NP-complete by giving a reduction from 3-SAT(2,2). We first describe some (non temporal) graphs needed by our reduction, that have some edges marked (note that the marking is not the time labelling λ).

Definition 5.

Let i be a positive integer. We define the graph Li=(Vi,Ei) to be a cycle with 10 edges such that (1) two edges of Ei are marked i and two edges of Ei are marked i and (2) there is one unmarked edge between edges with the same marking, and two unmarked edges between edges of opposite marking.

Graph Li is shown in Figure 4. Note that, since it has ten vertices and ten edges, its vertices can be covered using five edges in two ways, denoted by Ei,1 and Ei,2:

  • Ei,1 contains both edges marked by i and no edge marked by i

  • Ei,2 contains both edges marked by i and no edge marked by i

Given three integers j, k, l we define the graph Tj,k,l, with edges marked j, k, l as in Figure 4.

Figure 3: Graph Li.
Figure 4: Graph Tj,k,l.

We use the graphs Li and Ti,j,k to define an instance of Temporal Edge Cover with lifetime 2 corresponding to an instance of 3-SAT(2,2). Consider an instance F of 3-SAT(2,2) consisting of clauses C1, …, Cm over n variables x1, …, xn. Recall that each Cj, j[m] has three literals and each variable xi, i[n], appears in exactly two clauses as a positive literal and in exactly two clauses as a negative literal. We construct a corresponding temporal graph 𝒢, with lifetime τ=2, associated with F as follows:

  • At time 1, 𝒢 is defined as a graph G1 that contains, for each variable xi, i[n], a cycle Li, as defined in Definition 5. Note that these cycles are all vertex disjoint.

  • At time 2, 𝒢 is defined as a graph G2 that contains, for each clause Cp, p[m], over variables xi ,xj, xk, with i,j,k[n], a graph Tj,k,lp isomorphic to Tj,k,l. The marked edges of Tj,k,lp are defined as follows. First, Tj,k,lp shares marked edges with Lq, q{j,k,l}, in G1. For each q{j,k,l}, if xq is positive in Cp, then Tj,k,lp and Lq share an edge marked q, if xq is negative in Cp, then Tj,k,lp and Lq share an edge marked q. Note that we define a one-to-one correspondence between the marked edges of graphs Tj,k,lq and of the graphs Li, since each Li has two edges marked i and two edges marked i, and a formula in 3-SAT(2,2) has precisely two positive occurrences of each variable xi and two occurrences of its negation. Thus, two distinct edges of Li with the same marking corresponds to two distinct edges of some Ti,j,kp, Ti,j,kr.

The resulting temporal graph can be constructed in polynomial starting from an instance F of 3-SAT(2,2). Using this reduction, we can prove that F is satisfiable if and only if there exists an edge cover of 𝒢 having at most 5n+6m edges. The idea behind the proof is that each Li can be covered with 5 edges by Ei,1 or Ei,2, while each Tj,k,lp must be covered using at least 6 non marked edges, with 6 being achieved only if at least one marked edge is part of the covering. Depending on which Ei,a is used for the covering, true or false is assigned to the corresponding variable xi.

Theorem 6.

Temporal Edge Cover for graphs of lifetime 2 is NP-complete.

3.2 Hardness when the Underlying Graph is a Tree

We show that Temporal Edge Cover is NP-complete when the underlying graph is a tree by giving a reduction from Set Cover to Temporal Edge Cover.

Given an instance (U,𝒮,k) of Set Cover, where U=[n] and 𝒮 consists of m sets S1,…, Sm (Si[n], for each i[m], ), we construct a corresponding temporal graph 𝒢 (see Figure 5). 𝒢 has an underlying graph G which is is a tree rooted in r; r has m children x1, …, xm, and each xi has a single child yi, with i[m]. Function λ associates time label to each edge as follows: λ(xiyi)=Si and λ(rxi)=U, for each i[m]. The idea of the reduction is that each edge xiyi, i[m], must be in a temporal edge cover, and that the temporal vertices (r,j), j[m], are covered by edges incident in r that encode a set cover.

Theorem 7.

Temporal Edge Cover is NP-complete even when the underlying graph is a tree.

Figure 5: The temporal graph obtained from an instance of Set Cover.

3.3 FPT algorithm in 𝝉 and treewidth for Temporal Edge Cover

In this subsection we present an 𝖥𝖯𝖳 algorithm that finds the minimum cardinality of a temporal edge cover of 𝒢. Note that we can assume, without loss of generality, that each temporal vertex of the temporal graph 𝒢 can be covered by at least one edge. That is, we can assume that there are no independent temporal vertex in 𝒢, since those would not need to be covered and can be ignored during the computation.

Let 𝒢=(G,λ) be a temporal graph and consider a nice tree decomposition (T,{Xt}tV(T)), with T rooted at r, of a G. For each tV(T), let Gt be the subgraph of G containing all the vertices vXt for any t in the subtree rooted at t. Also, for any XV(G), let E(X) denote the set of edges with some endpoint in X (formally, E(X)={uvE(G)u,vX}).

Given RV(G), we denote by VT(R) the set of temporal vertices R×[τ]; for simplicity, we write VT(G) to denote VT(V(G)). Given SE(G), we denote by VT(S) the set of temporal vertices which are endpoints of S, i.e., VT(S)=eS{(u,i)iλ(e),ue}. Additionally, given SE(G) and (u,i)VT(G), we say that S covers (u,i) if there exists eS such that ue and iλ(e). Observe that S covers VT(S).

As is usual the case when using tree decomposition, we work with partial solutions, i.e., with sets of edges that only partially cover the temporal vertices of Gt. This is because we might cover some temporal vertex (u,i)Xt×[τ] only with an edge introduced later, i.e., with an edge uv such that vV(Gt). Therefore, for each node of T, we keep track of the temporal vertices within Xt×[τ] that are covered and of the edges within E(X) that are chosen. Formally, given tV(T), for each SE(Xt) and each CXt×[τ] with VT(S)C, we define:

If there is no such set S, then Tt(S,C)=+. Essentially, the function gives the minimum cardinality of a partial edge cover S for the temporal graph (Gt,λE(Gt)) such that:

  • S is exactly the set of edges in E(Xt) that are selected by S;

  • C is exactly the set of temporal vertices in Xt×[τ] covered by S. Observe that these must include the endpoints of the temporal edges related to the edges selected in S, and this is why we ask for VT(S) to be contained in C; and

  • Each temporal vertex related to some vertex in GtXt must be covered by S.

Observe that Tr(,) gives us the minimum cardinality of a temporal edge cover for 𝒢. In what follows, we show how to recursively compute Tt(S,C) for each tV(T), SE(Xt), and C(Xt×[τ)) with VT(S)C, depending of the type of node t.

  • leaf: if t is a leaf, then Tt(,)=0;

  • introduce node: let vV(G) be the vertex introduced by t and t be its only child. Also, let D be the set of temporal vertices (u,i) with uv covered by some edge incident to v. Formally, D=VT(SδG(v))({v}×[τ]). Additionally, let S=SδG(v), C=C({v}×[τ]), and k=|SδG(v)|. We have that:

    Tt(S,C)={k+minD^DTt(S,CD^), if VT(S)({v}×[τ])=C({v}×[τ])+, otherwise
  • forget node: let vV(G) be the vertex forgotten by t and let t be its only child. Also, let S=δG(v)E(Xt). Then:

    Tt(S,C)=minS^STt(SS^,C({v}×[τ])).
  • join node: let t1 and t2 be the two children of t. By definition, we know that Xt1=Xt2. Then:

    Tt(S,C)=|S|+min{Tt1(S,C1)+Tt2(S,C2)C1C2=C and VT(S)C1C2}.
Theorem 8.

Temporal Edge Cover can be computed in time O(2w28wτ).

4 Approximation of Temporal Edge Cover

In this section we consider the approximability of Temporal Edge Cover. First, we show a bound on the approximation (blogτ, for any constant 0<b<1), then we present an approximation algorithm of factor O(logτ).

4.1 Inapproximability

We show that Temporal Edge Cover cannot be approximated within factor blogτ, for any constant 0<b<1. We prove this result by giving an approximation preserving reduction from the Set Cover problem333In this section we consider the optimization version of Set Cover, thus we omit k from the instance of the problem.. Consider an instance (U,𝒮) of Set Cover, where U={u1,,un} and 𝒮={S1,,Sm}. We can assume U=[n], therefore each Si, i[m] is a subset of [n]. We define a corresponding instance 𝒢=(G,λ) of Temporal Edge Cover as follows (see Figure 6):

V(G) ={rii[m2]}{xii[m]}{yii[m]}
E(G) ={rixji[m2],j[m]}{xiyii[m]}
λ :E(G)𝒫([n]),λ(e)={Sjif e=rixj for some i[m2]jm,Uif e=xiyi for some i[m].
Figure 6: The temporal graph obtained from an instance of Set Cover. Some edges are dotted for readability, and we are not showing the labels on those edges for the same reason.

Note that 𝒢 has lifetime τ=n. We now show the main properties of the reduction.

Lemma 9.

Consider an instance (U,𝒮) of Set Cover and a corresponding instance 𝒢 of Temporal Edge Cover. Given a solution 𝒮 of Set Cover on instance (U,𝒮), we can compute in polynomial time a solution of Temporal Edge Cover on instance 𝒢 that consists of at most m+|𝒮|m2 edges.

Lemma 10.

Consider an instance (U,𝒮) of Set Cover and a corresponding instance 𝒢 of Temporal Edge Cover. Given a solution E of Temporal Edge Cover on instance 𝒢, then there exists a positive integer k such that |E|=m+km2. Then we can compute in polynomial time a solution of Set Cover on instance (U,𝒮) that consists of at most k sets.

Theorem 11.

Temporal Edge Cover cannot be approximated within factor blogτ, for any b with 0<b<1, unless P=NP.

4.2 A 𝑶(𝐥𝐨𝐠𝝉)-Approximation Algorithm

In this section we present an approximation algorithm for Temporal Edge Cover of factor O(logτ). Given a temporal graph 𝒢=(G,λ), with lifetime τ and G=(V,E), the algorithm assumes that the vertices are ordered – the specific order is not relevant – so we denote them as v1,,vn. The approximation algorithm, described in Algorithm 1, computes an edge cover E by greedily covering the uncovered temporal vertices of each vertex vi, i[n], following the order (first it covers the uncovered temporal vertices of v1, then of v2 and so on, until all the temporal vertices are covered). In order to cover the temporal vertices of each vi, it applies the greedy algorithm of Set Cover on an instance that contains an element for each uncovered temporal vertex (vi,t) and a set, for each edge vivjE, that covers (vi,t) for each tλ(vivj).

More precisely, consider the i-th iteration, i[n], of Algorithm 1. Given the set E of edges computed by the first i1-iterations of the algorithm, we define an instance (Ui,𝒮i) of Set Cover, where Ui is the universe set and 𝒮i is a collection of sets over Ui. For each i[n], the universe set Ui is defined as

Ui={t[τ](vi,t) is not covered by E and there exists a vivjE such that tλ(vivj)}.

The collection of sets 𝒮i is defined as 𝒮i={Se1i,,Sezi}, where e1,…, ez are the edges incident in vi and each Shi[τ] is defined as Shi={t[τ]tλ(eh)}.

Algorithm 1 marks each temporal vertex as covered when it adds to solution E an edge that covers it.

Algorithm 1 Approximation algorithm for Temporal Edge Cover
Input: a temporal graph 𝒢=(G,λ) with lifetime τ.
Output: an edge cover E of 𝒢 of approximation factor O(logτ)

Now, we show the correctness of Algorithm 1.

Lemma 12.

Let E be a solution computed by Algorithm 1. Then, denoted by E an optimal solution of Temporal Edge Cover on instance 𝒢, it holds that

  1. 1.

    E is an edge cover of 𝒢

  2. 2.

    |E|logτ|E|.

5 Temporal Matching: Hardness and Tractability

In this section we consider the Temporal Matching problem and provide hardness results and tractability. The outline is the same as Temporal Edge Cover; we show that Temporal Matching is NP-complete when the lifetime τ of graph is 2, and then we show that it is NP-complete even when the underlying graph is a tree. Finally, we describe an 𝖥𝖯𝖳 algorithm in τ and w (treewidth) which solves Temporal Matching.

5.1 Hardness for 𝝉=𝟐

We show the NP-hardness of Temporal Matching restricted to lifetime 2 with reduction from 3-SAT(2,2) similar to the one given in Section 3.1. This reduction follows the same idea as that of Theorem 6. Indeed, we still use the graph Li defined in Definition 5 and showed in Figure 4. For this reduction we do not encode clauses with graphs isomorphic to Tj,k,l, but graphs isomorphic to Cj,k,l, shown in Figure 8. Cj,k,l has three edges marked with integers j, k, l.

Let F be an instance of 3-SAT(2,2), with n variables x1,,xn and m clauses C1,,Cm. We construct an associated temporal graph with lifetime τ=2 defined in the following way. At time 1, 𝒢 contains a graph G1 consisting of the disjoint union of cycles Li, i[n], one for each variable xi. At time 2, 𝒢 contains a graph G2 that for each clause Cp over variables xj, xk and xl, j,k,l[n], contains graph Cj,k,lp isomorphic to Cj,k,l. As in Section 3.1, the marked edges of Cj,k,lp are shared with cycles Li, i{j,k,l} that encode the variables xj, xk and xl. The shared marked edge between Cj,k,lp and Li has mark i if xi is negated in the clause, i if the variable is positive in the clause. Note that Cj,k,lp’s are build so that the marked edges of Li are in one-to-one correspondence with marked edges of Cj,k,l’s.

The correctness of the reduction follows from the fact that a maximum temporal matching of each Li, i[n], contains five edges, one including positively marked edges and one including negatively marked edges. This encodes an assignment to the variables. The temporal matching of each Cj,k,lp contains at most one unmarked edge. However, a temporal matching M of 𝒢 contains one unmarked edge of Cj,k,lp only if there is a marked edge shared by Cj,k,lp and some Li that does not belong to M. This encodes the fact that at least one literal of each clause must be satisfied. This reduction allows us to prove the following result.

Theorem 13.

Temporal Matching for graphs with lifetime 2 is NP-complete.

Figure 7: Graph Cj,k,l.
Figure 8: Temporal graph associated to an instance of Set Packing.

5.2 Hardness when the Underlying Graph is a Tree

We show a reduction from Set Packing to Temporal Matching. Given an instance (U,𝒮,k) of Set Packing with 𝒮={S1,,Sn} a collection of sets over a universe set U, we construct a temporal graph 𝒢=(G,λ) such that there exists k disjoint sets in 𝒮 if and only if there exists a temporal matching M of 𝒢 of size at least k. Without loss of generality, we assume that U=[n] and that each Si[n], for each i[m].

𝒢=(G,λ) is defined as follows (the resulting temporal is presented in Figure 8):

  • G is a tree rooted at a vertex r, which has n children x1, …, xn

  • For each i[n], λ(rxi)=Si

The idea of the reduction is that since any pair of edges rxi and rxj of 𝒢, where i,j[n] and ij, share vertex r, then they can be in a temporal matching only if they are defined in different times, thus they are related to two disjoint subsets Si and Sj in an instance of Set Packing. Then, since Set Packing is NP-complete [9], we can prove the following result.

Theorem 14.

Temporal Matching is NP-complete even when the underlying graph G is a tree.

5.3 FPT algorithm in 𝝉 and treewidth for Temporal Matching

In this subsection we show an algorithm that finds the maximum cardinality of a temporal matching of 𝒢 in 𝖥𝖯𝖳 time when parameterized by τ plus the treewidth. The approach follows the same idea as the Temporal Edge Cover one (see Section 3.3).

Again, let 𝒢=(G,λ) be a temporal graph and consider a nice tree decomposition (T,{Xt}tV(T)) of G, with T rooted at r. We use the same notation as the one used in Section 3.3. Given a matching ME(G) and a temporal vertex (u,i)VT(G), observe that (u,i) can be covered by M at most once, i.e., there is at most one edge eM such that ue and iλ. If such an edge exists, we say that M saturates (u,i).

We define the dynamic programming table Tt related to each tV(T) as follows. For each NE(Xt) and CVT(Xt) with VT(N)C:

Tt(N,C)=max{k a temporal matching ME(Gt) s.t. |M|=k,ME(Xt)=N, and VT(M)VT(Xt)=C}.

If there exists no such set M (e.g., it could happen that no temporal matching saturates exactly C), then Tt(N,C)=0. Essentially, the function gives the maximum cardinality of a temporal matching M for the temporal graph (Gt,λE(Gt)) such that:

  • N is exactly the set of selected edges in E(Xt);

  • C is exactly the set of temporal vertices in VT(Xt) saturated by M.

Because Gr=G, the value of Tr(,) tells us the maximum cardinality of a temporal matching for 𝒢. We show how to recursively compute Tt(N,C) for each tV(T), NE(Xt), and CVT(Xt), depending on the type of node t.

  • leaf: if t is a leaf, then Tt(,)=0;

  • introduce node: let vV(G) be introduced by t and let t be its only child. Also, let F=NδG(v) be the set of edges in N incident to v. Then:

    Tt(N,C)={Tt(NF,CVT(F))+|F|, if VT(F)({v}×[τ])=C({v}×[τ])0, otherwise.
  • forget node: let vV(G) be forgotten by t and let t be its only child. To define the recursive function, let 𝒩 contain every N^δG(v)E(Xt) such that VT(N^)({v}×[τ])C and such that N^ is a matching. In words, it contains every subset of edges of E(Xt) incident to v whose other endpoints are temporal vertices within C, while also not having any edges sharing the same temporal vertices. Also, for any N^𝒩, let 𝒞N^ contain every C^{v}×[τ] such that VT(N^)({v}×[τ])C^. Then

    Tt(N,C)=max{Tt(NN^,CC^)N^𝒩 and C^𝒞N^}.
  • join node: let t1 and t2 be the children of t. Recall that Xt1=Xt2. Then:

    Tt(N,C)=|N|+max{Tt1(N,C1)+Tt2(N,C2)C1C2=VT(N) and C1C2=C}.
Theorem 15.

Temporal Matching can be computed in time O(2w28wτ).

6 Approximation of Temporal Matching

In this section we consider the approximability of Temporal Matching. We start by discussing a bound on the approximability of the problem. Since the reduction described in Section 5.2 is also approximation preserving (note that it defines τ=n) and since Set Packing is hard to approximated within factor O(n1ε) [9, 17], for any ε>0, unless P = NP, then we have the following result.

Corollary 16.

Temporal Matching cannot be approximated within factor O(τ1ε), for any ε>0, unless P = NP.

On the positive side, we can prove that Temporal Matching can be easily approximated within factor τ, by computing a maximum matching in each snapshot and returning as approximated solution the one having maximum cardinality.

Theorem 17.

Temporal Matching can be approximated in polynomial time within factor τ.

Proof.

Consider the following approximation algorithm. For each t[τ], the approximation algorithm computes a maximum matching Mt of the static graph Gt, defined as 𝒢 restricted to time t (i.e. Gt is the snapshot of 𝒢 in t). Then the approximation algorithm returns as an approximated solution, denoted by M, a matching of maximum cardinality among Mt, t[τ].

First, note that M is a feasible solution of Temporal Matching. Indeed, since M is a matching in a static graph, each pair of edges in M is vertex disjoint, hence M is also a temporal matching. Now, we prove that the approximation factor is indeed τ. Consider a maximum temporal matching M in 𝒢. Consider the set of edges MtM defined at time t, t[τ]. By definition of temporal matching, the edges in Mt must be vertex disjoint, thus they must be a matching in Gt. Since for each t[τ] Mt is a maximum matching of Gt, it follows that |Mt||Mt|. By construction of M, we have

t[τ]|Mt|t[τ]|Mt|τ|M|,

thus concluding the proof.

7 Relation between Max Temporal Matching and Min Temporal Edge Cover

In this section, we show that having a minimal temporal edge cover does not facilitate the computation of a maximum temporal matching, and vice versa.

For a static graph, the problem of finding the maximum size of a matching and the problem of finding the minimum size of an edge cover are complementary. More specifically, given a graph G on n vertices and denoting the size of a minimum edge cover by β(G) and the size of maximum matching by α(G), it is known that α(G)+β(G)=n. Indeed, we can even construct a matching from an edge cover, and vice-versa. To see this, let M be a matching of size k. Picking M plus one edge incident to each non-saturated vertex gives us an edge cover of size k+n2k, thus implying that β(G)nα(G). On the other hand, if N is a minimal edge cover of cardinality k, observe that G=(V(G),N) is a forest of stars. Indeed, G contains no cycles as removing an edge of a cycle in G would cover the same vertices. Additionally, if G contains a path P=(v1,v2,v3,v4), then Nv2v3 still covers V(G). Let k be the number of components of G and observe that we can construct a matching of size k by picking one edge of each star of G. Finally, it is known that a forest on n vertices and k components has exactly nk edges, i.e., k=nk, from which we get α(G)nβ(G).

We now see that the temporal variants of matchings and edge covers are not related as in the static case. That is, given a temporal graph 𝒢 and a temporal matching of maximum cardinality, the problem of finding a minimum temporal edge cover for 𝒢 is still NP-complete. The opposite is also true, which means that if we are given a minimum temporal edge cover then the problem of finding a maximum temporal matching is still NP-complete. To see this, we use some of the reductions presented throughout the paper.

Let S1, …, Sm be an instance of Set Cover. Theorem 7 and Figure 5 detail a reduction to Temporal Edge Cover, where the resulting temporal graph 𝒢=(G,λ) has lifetime τ=max{kkSi,1im}. We now construct a temporal graph 𝒢^=(G,μ) with lifetime τ+1 where μ(e)=λ(e){τ+1}, for each eE(G). That is, we add τ+1 to each label. Then any temporal matching of maximum cardinality for 𝒢^ contains all the edges xiyi, 1im for each i except for at most one j, and in that case it contains rxj. This does not depend on the specific instance S1, …, Sm considered. Still, any temporal edge cover of minimum cardinality is a solution for our instance of Set Cover, since the addition of the same element τ+1 to all labels does not change which edges are a solution. Therefore having a temporal matching of maximum cardinality does not change the complexity of finding a temporal edge cover of minimum cardinality.

On the other hand, suppose that for a temporal graph we know all its temporal edge covers of minimum cardinality, and we want to find a temporal matching of maximum cardinality. Then we can use the reduction from packing set detailed in Theorem 14 and Figure 8. Indeed, the only edge cover takes all the edges of the graph, but the matching depends on the specific sets S1, …, Sn. Thus having a temporal edge cover of minimum cardinality does not change the complexity of finding a temporal matching of maximum cardinality.

8 Conclusion

In this paper, we have investigated the computational complexity of Edge Cover in temporal graphs. We quickly identified the most interesting case (see again Table 1), which we simply named Temporal Edge Cover. We presented two NP-completeness results for this problem, one which uses lifetime τ=2, and another where the underlying graph is a tree (i.e. treewidth equals 1). These results complement our following FPT result, as the parameters considered in our proposed algorithm are τ and treewidth. Then, we have explored approximation of Temporal Edge Cover and provided an approximation algorithm with an asymptotically tight approximation factor of O(logτ). Inspired by the intrinsic connection between Edge Cover and Matching in (non-temporal) graphs, we also have provided such results for Temporal Matching. Surprisingly, even though the problems are shown to be distinct and unrelated to each other in the temporal setting, we have proved very similar results for both (albeit through different reductions and observations).
Although we have presented a comprehensive overview, covering classical complexity, parameterized complexity in terms of lifetime and treewidth, and approximation, we identify the following directions for future research. It may be interesting to identify specific classes of temporal graphs for which tractability of the (non-parametrised) problems is possible, and even more so if these classes correspond to a natural setting for real-life applications of our problems (e.g. Temporal Edge Cover in planar graphs possibly representing surveillance of a building floor). In terms of parametrized complexity, other parameters can be considered, such as some recently introduced parameters specifically for temporal graphs (see, e.g., the parameters studied and mentioned in [6]).

References

  • [1] Julien Baste, Binh-Minh Bui-Xuan, and Antoine Roux. Temporal matching. Theoretical Computer Science, 806:184–196, 2020. doi:10.1016/j.tcs.2019.03.026.
  • [2] Kenneth A Berman. Vulnerability of scheduled networks and a generalization of Menger’s Theorem. Networks: An International Journal, 28(3):125–134, 1996. doi:10.1002/(SICI)1097-0037(199610)28:3\%3C125::AID-NET1\%3E3.0.CO;2-P.
  • [3] Arnaud Casteigts, Paola Flocchini, Walter Quattrociocchi, and Nicola Santoro. Time-varying graphs and dynamic networks. International Journal of Parallel, Emergent and Distributed Systems, 27(5):387–408, 2012. doi:10.1080/17445760.2012.668546.
  • [4] Lapo Cioni, Riccardo Dondi, Andrea Marino, Jason Schoeters, and Ana Silva. Matching and edge cover in temporal graphs. arXiv e-prints, 2025. doi:10.48550/arXiv.2504.06762.
  • [5] Marek Cygan, Fedor V Fomin, 𝖫ukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michał Pilipczuk, and Saket Saurabh. Parameterized algorithms, volume 5. Springer, 2015. doi:10.1007/978-3-319-21275-3.
  • [6] Jessica Enright, Samuel D. Hand, Laura Larios-Jones, and Kitty Meeks. Structural Parameters for Dense Temporal Graphs. In Rastislav Královič and Antonín Kučera, editors, 49th International Symposium on Mathematical Foundations of Computer Science (MFCS 2024), volume 306 of Leibniz International Proceedings in Informatics (LIPIcs), pages 52:1–52:15, Dagstuhl, Germany, 2024. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.MFCS.2024.52.
  • [7] Tibor Gallai. Uber extreme punkt-und kantenmengen, annales universitatis scientiarum budapestinensis de rolando eotvos nominatae. Sectio mathematica, 2:133–138, 1959.
  • [8] Petter Holme. Modern temporal network theory: a colloquium. The European Physical Journal B, 88(9):234, 2015.
  • [9] Richard M. Karp. Reducibility among combinatorial problems. In Raymond E. Miller and James W. Thatcher, editors, Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, The IBM Research Symposia Series, pages 85–103. Plenum Press, New York, 1972. doi:10.1007/978-1-4684-2001-2_9.
  • [10] Nina Klobas, George B. Mertzios, and Paul G. Spirakis. Sliding into the Future: Investigating Sliding Windows in Temporal Graphs. In Jérôme Leroux, Sylvain Lombardy, and David Peleg, editors, 48th International Symposium on Mathematical Foundations of Computer Science (MFCS 2023), volume 272 of Leibniz International Proceedings in Informatics (LIPIcs), pages 5:1–5:12, Dagstuhl, Germany, 2023. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.MFCS.2023.5.
  • [11] Matthieu Latapy, Tiphaine Viard, and Clémence Magnien. Stream graphs and link streams for the modeling of interactions over time. Social Network Analysis and Mining, 8(1):61, 2018.
  • [12] George B. Mertzios, Hendrik Molter, Rolf Niedermeier, Viktor Zamaraev, and Philipp Zschoche. Computing maximum matchings in temporal graphs. Journal of Computer and System Sciences, 137:1–19, 2023. doi:10.1016/j.jcss.2023.04.005.
  • [13] Othon Michail. An introduction to temporal graphs: An algorithmic perspective. Internet Mathematics, 12(4):239–280, 2016. doi:10.1080/15427951.2016.1177801.
  • [14] Othon Michail and Paul G. Spirakis. Traveling salesman problems in temporal graphs. Theoretical Computer Science, 634:1–23, 2016. doi:10.1016/j.tcs.2016.04.006.
  • [15] Douglas Brent West et al. Introduction to graph theory, volume 2. Prentice hall Upper Saddle River, 2001.
  • [16] B Bui Xuan, Afonso Ferreira, and Aubin Jarry. Computing shortest, fastest, and foremost journeys in dynamic networks. International Journal of Foundations of Computer Science, 14(02):267–285, 2003. doi:10.1142/S0129054103001728.
  • [17] David Zuckerman. Linear degree extractors and the inapproximability of max clique and chromatic number. Theory Comput., 3(1):103–128, 2007. doi:10.4086/TOC.2007.V003A006.