1 Introduction

The classical Vertex Cover problem is among the most well-studied NP-hard problems on static graphs especially in the context of parameterized algorithmics. In fact, it is often referred to as the Drosophila of parameterized complexity [11, 14, 17, 19, 32]. Real-world graphs, however, are often dynamic and change over time. In modern applications, this temporal information is readily available and allows for more realistic models. This leads algorithmic research to focus on temporal graphs [3, 5, 8, 12, 13, 21, 22, 30, 37, 38]. In a temporal graph, edges can appear and disappear over time, which is formalized by a sequence \(E_1,\ldots ,E_\tau \) of edge sets over a fixed set V of vertices, where \(\tau \ge 1\) denotes the lifetime of the temporal graph. Several classical graph problems have been studied on temporal graphs [1, 2, 6, 25, 28, 29, 39].

In this paper, we study the network untangling problem introduced by [35, 36], which is a temporal variant of Vertex Cover and motivated by data mining applications such as discovering event timelines and summarizing temporal networks. Here, edges in the temporal graph model certain interactions between entities (vertices). The goal is to explain the observed interactions by selecting few (and short) activity intervals for each entity such that at the time of an interaction at least one of the two entities is active. The formal definition is as follows: Let \(\mathcal {G}=(V,(E_i)_{i\in [\tau ]})\) be a temporal graph. A k-activity timeline is a set \(\mathcal {T}\) containing at most k time intervals for each vertex, that is, \(\mathcal {T}\subseteq \{(v,a,b)\in V\times [\tau ]\times [\tau ]\mid a\le b\}\) such that \(|\{(v,a,b)\in \mathcal {T}\}|\le k\) for each \(v\in V\). We say that \(\mathcal {T}\) covers \(\mathcal {G}\) if for each \(t\in [\tau ]\) and each \(\{u,v\}\in E_t\), \(\mathcal {T}\) contains (uab) with \(t\in [a,b]\) or  (vab) with \(t\in [a,b]\). That is, for each time step t, the set \(\{v\in V\mid (v,a,b)\in \mathcal {T}, t\in [a,b]\}\) must be a vertex cover for the graph \(G_t=(V,E_t)\). The task is to find a k-activity timeline that minimizes an objective regarding the interval lengths. Rozenshtein et al. [36] introduced the following two problems.

MinTimeline\(_\infty \)

Input:       A temporal graph \(\mathcal {G}=(V,E_1,\ldots ,E_\tau )\) and \(k,\ell \in \mathbb {N}_0.\)

Question:  Is there a k-activity timeline \(\mathcal {T}\) covering \(\mathcal {G}\) with

$$\begin{aligned} \max _{(v,a,b)\in \mathcal {T}}(b-a)\le \ell \text { ?} \end{aligned}$$

MinTimeline\(_+\)

Input:       A temporal graph \(\mathcal {G}=(V,E_1,\ldots ,E_\tau )\) and \(k,\ell \in \mathbb {N}_0.\)

Question:  Is there a k-activity timeline \(\mathcal {T}\) covering \(\mathcal {G}\) with

$$\begin{aligned} \sum _{(v,a,b)\in \mathcal {T}}(b-a)\le \ell \text { ?} \end{aligned}$$
Fig. 1
figure 1

An example of a temporal graph: The areas between the dotted lines represent the individual layers. The intervals highlighted in gray form a solution for MinTimeline\(_+\) (with \(\ell =4\), \(k=2\)). The intervals indicated by dashed boxes form a solution for MinTimeline\(_\infty \) (with \(\ell =1\), \(k=2\))

An example instance and solutions for each of these two problems are pictured in Fig. 1. Note that both problems are equivalent if \(\ell =0\).

Rozenshtein et al. [36] showed that both problems are NP-hard and hard to approximate in polynomial time. They focus on developing heuristics and show in a case study that activity timelines can successfully be recovered for real-world data of Twitter users. In this work, we provide a deeper complexity-theoretic understanding of both problems through the lens of parameterized complexity theory. To this end, we study the influence of several natural problem parameters on the algorithmic complexity, namely, the number n of vertices, the lifetime \(\tau \), the maximum number k of intervals per vertex, and the interval length bound \(\ell \). In our multivariate analysis, we identify for both problems which parameter combinations yield fixed-parameter tractability and which combinations are intractable. In doing so, we reveal interesting connections to seemingly unrelated problems like graph coloring and bin packing. Our results yield an (almost) tight characterization and pave the way for a comprehensive picture of the computational complexity landscape of network untangling.

Related Work

As the literature on edge covering is extremely rich, we only consider studies closely related to our setting. For a broader overview on the topic of temporal network mining, we refer to a recent tutorial [34]. Our main reference is the work by [36] who introduced both problems and showed that MinTimeline\(_\infty \) is polynomial-time solvable for \(k=1\), whereas MinTimeline\(_+\) is NP-hard for \(k=1\). Moreover, they showed that both problems are NP-hard for \(\ell =0\) with unbounded k and thus not approximable in polynomial time. They develop efficient heuristics to solve the problems and provide experiments to evaluate the performance of their approaches.

Dondi [10] analyzed the computational complexity of MinTimeline\(_+\) with the restriction that \(k=1\), showing that the problem is NP-hard in both of the following cases: (i) if each layer contains only one edge and (ii) if the maximum degree in each layer is at most two and \(\tau =3\). He further gave a fixed-parameter algorithm for this problem parameterized by the number of non-isolated vertices in any layer plus the maximum length of time between the first edge and the last edge incident to any vertex.

Akrida et al. [2] studied a different variant of Vertex Cover on temporal graphs. Their model expects an edge to be covered at least once over every time window of some given size \(\Delta \). That is, they define a temporal vertex cover as a set \(S\subseteq V\times [\tau ]\) such that, for every time window of size \(\Delta \) and for each edge \(e=\{v,w\}\) appearing in a time step contained in the time window, it holds that \((v,t)\in S\) or \((w,t)\in S\) for some t in the time window with time-edge (et). Among other results, they provide NP-hardness results in very restricted settings.

Fluschnik et al. [16] and Heeger et al. [20] studied the parameterized complexity of a “multistage” variant of Vertex Cover. Here, one is given a temporal graph and seeks a sequence of vertex covers of size at most k (one for each layer of the temporal graph) such that consecutive vertex covers are in some sense similar, e.g., the symmetric difference of two consecutive vertex covers is upper-bounded by some value [16] or the sum of symmetric differences of all consecutive vertex covers is upper-bounded by some value [20].

Table 1 Overview of results

Our Contributions

We almost completely settle the parameterized complexity of the two variants MinTimeline\(_\infty \) and MinTimeline\(_+\) for all combinations of the parameters n, \(\tau \), k, and \(\ell \). Table 1 gives an overview of the central results. It turns out that both problems are already NP-hard if the temporal graph contains three identical layers and \(k=2\) and \(\ell =0\) (Corollary 3). This strengthens the hardness result by [36] for \(\ell =0\) and implies that fixed-parameter tractability can only be achieved in combination with the parameter n. Interestingly, the two problems behave somewhat differently here. Our two main results state that MinTimeline\(_\infty \) parameterized by n is W[1]-hard even for \(\ell =1\) (Theorem 12), while MinTimeline\(_+\) parameterized by \(n+\ell \) is in FPT (Theorem 9). We further show that both problems are in XP when parameterized by n (Theorems 6 and 7) and in FPT if \(\ell =0\) (Lemma 10). Theorem 7 shows that MinTimeline\(_+\) is also in FPT for \(n+k\) and Theorem 8 shows the same for MinTimeline\(_\infty \). For the restriction with \(k=1\), we strengthen the NP-hardness of MinTimeline\(_+\) showing that it already holds for two layers (Theorem 5). Note that \(n+\tau \) trivially yields fixed-parameter tractability since the instance size is bounded in this number. Thus, for MinTimeline\(_\infty \), we obtain a full complexity dichotomy. For MinTimeline\(_+\), the parameterized complexity regarding n remains open. Our hardness results also imply running time lower bounds based on the Exponential Time HypothesisFootnote 1 (ETH) (Corollaries 4 and 15).

2 Preliminaries

We denote the positive integers by \(\mathbb {N}\) and let \(\mathbb {N}_0\mathrel {\mathop :}= \mathbb {N} \cup \{0\}\). For \(n\in \mathbb {N}\), let \([n]\mathrel {\mathop :}= \{1,\ldots ,n\}\). ]

Graphs

If not specified otherwise, a graph is static and undirected. We refer to [9] for details on notation in graph theory. If \(G=(V,E)\) is a graph and \(S\subseteq V\), \(\text {let inc}(S)\mathrel {\mathop :}= \{ e \in E \mid e \cap S \ne \emptyset \}\) denote the set of edges incident to at least one vertex in S. A temporal graph \(\mathcal {G} := (V,(E_i)_{i=1}^\tau )\) consists of a finite vertex set V and a sequence of edge sets \(E_1,\ldots ,E_\tau \subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) \). The pair (ei) is a time-edge of \(\mathcal {G}\) if \(e \in E_i\). The graph \((V,E_i)\) is called the i-th layer of \(\mathcal {G}\). The size of \(\mathcal {G}\) is \(\vert \mathcal {G} |\mathrel {\mathop :}= |V |+ \sum _{t=1}^\tau \max \{1,\vert E_t |\}\).

Parameterized Complexity

Let \(\Sigma \) denote a finite alphabet. A parameterized problem \(L\subseteq \{(x,k)\in \Sigma ^*\times \mathbb N_0\}\) is a subset of all instances (xk) in \(\Sigma ^*\times \mathbb N_0\), where k is the parameter. A parameterized problem L is (i) fixed-parameter tractable (or contained in the class FPT) if there is an algorithm that decides every instance (xk) for L in \(f(k)\cdot |x|^{O(1)}\) time, (ii) contained in the class XP if there is an algorithm that decides every instance (xk) for L in \(|x |^{f(k)}\) time, and (iii) para-NP-hard if L is NP-hard for some constant value of the parameter, where f is any computable function that only depends on the parameter. Note that \(\text {FPT}\subseteq \text {XP}\). If a parameterized problem is W[1]-hard, then it is presumably not in FPT, and if it is para-NP-hard, then it is not in XP (unless P\(\;=\;\)NP). Further details can be found in the standard literature on parameterized algorithms and complexity [7, 11, 15, 32].

3 First Results

This section sets the basis of our parameterized complexity analysis containing results for most of the parameter combinations (except for \(n+\ell \)).

We start with the general observation (which we will use later) that, for \(\ell =0\), the temporal order of the layers is irrelevant since every element in a k-activity timeline covers only edges of one layer.

Observation 1

Let \(\pi :[\tau ] \rightarrow [\tau ]\) be a permutation. Then, the instance \(((V,(E_i)_{i\in [\tau ]}),\) \(k,0)\) is a yes-instance of MinTimeline\(_\infty \) (MinTimeline\(_+\)) if and only if \(((V,(E_{\pi (i)}\) \()_{i\in [\tau ]}),k,0)\) is a yes-instance.

Moreover, if all layers of the temporal graph are equal, then, for \(\ell =0\), both problems are equivalent to an extension of k-coloring. For a graph \(G=(V,E)\) and \(a,b \in \mathbb {N}\) with \(a \ge b\), an (a : b)-coloring of G is a function \(c :V \rightarrow \left( {\begin{array}{c}[a]\\ b\end{array}}\right) \) such that \(c(u) \cap c(v) = \emptyset \) for all \(\{u,v\} \in E\). Note that a (k : 1)-coloring of a graph is simply a k-coloring. Given a graph G, the problem (a:b)-Coloring asks whether there is an (a : b)-coloring for G.We get the following.

Theorem 2

If \(E_1=E_2=\dots =E_\tau \),  \(\ell =0\), and \(\tau \ge k\), then MinTimeline\(_\infty \) (MinTimeline\(_+\)) is equivalent to \((\tau {:}\tau -k)\) -Coloring.

Proof

Suppose that \(\mathcal {T}\) is a k-activity timeline that covers \(\mathcal {G}=(V,E_1,\ldots ,E_\tau )\) with \(E_1=\dots =E_\tau =\mathrel {\mathop :} E\) and \(\ell =0\). We can assume that \(\mathcal {T}\) contains exactly k intervals for each \(v\in V\). Let \(G=(V,E)\). Then, \(c :V \rightarrow \left( {\begin{array}{c}[\tau ]\\ \tau -k\end{array}}\right) \) with \(c(v) \mathrel {\mathop :}= \{t \in [\tau ] \mid (v,t,t) \notin \mathcal {T} \}\) is a \((\tau {:}\tau -k)\)-coloring of G.

Conversely, if \(c :V \rightarrow \left( {\begin{array}{c}[\tau ]\\ \tau -k\end{array}}\right) \) is a \((\tau {:}\tau -k)\)-coloring of \(G=(V,E)\), then \(\mathcal {T} \mathrel {\mathop :}= \{ (v,t,t)\in V\times [\tau ]\times [\tau ] \mid v\in V, t \notin c(v) \}\) is a k-activity timeline that covers \(\mathcal {G}\). \(\square \)

The NP-hardness of 3-Coloring, or (3 : 1)-Coloring, implies the following.

Corollary 3

MinTimeline\(_\infty \) and MinTimeline\(_+\) are NP-hard, even if \(k=2\), \(\ell =0\), \(\tau =3\), and all layers are identical.

Bonamy et al. [4] mention a result by [31] showing that (a  :  b)-Coloring can be solved in \((b+1)^n\cdot n^{O(1)}\) time. They show that the ETH implies that there is no \(2^{o(\log b)n}\)-time algorithm for (a:b)-Coloring ([4], Theorem 1.1). Thus, we have the following.

Corollary 4

MinTimeline\(_\infty \) (MinTimeline\(_+\)) with \(E_1=E_2=\dots =E_\tau \) and \(\ell =0\) cannot be solved in \(f(\tau -k)\cdot 2^{o(\log (\tau -k))n}\) time for any function f unless the ETH fails.

Note that, if \(\tau = 2\), then MinTimeline\(_\infty \) and MinTimeline\(_+\) are both trivial unless \(k=1\). Rozenshtein et al. [36] already showed that MinTimeline\(_\infty \) is polynomial-time solvable for \(k=1\). By contrast, we show that MinTimeline\(_+\) is NP-hard in the case of \(k=1\) and \(\tau =2\) (strengthening the NP-hardness for \(k=1\) with unbounded \(\tau \) by [36]). Moreover, MinTimeline\(_+\) is FPT when parameterized by \(\ell \) with this restriction. This gives us the following.

Theorem 5

MinTimeline\(_+\) with two layers is NP-hard and FPT for parameter \(\ell \).

Proof

We show NP-hardness with a reduction from Odd Cycle Transversal. In this problem, the input consists of a graph \(G=(V,E)\) and an integer s and the task is to decide whether there is a vertex set \(X\subseteq V\) with \(\vert X |\le s\) such that \(G-X\) is bipartite. This problem is NP-hard [27].

Given an instance \((G=(V,E),s)\), the reduction outputs the instance \((\mathcal {G}\mathrel {\mathop :}=(V,E_1 \mathrel {\mathop :}= E,E_2 \mathrel {\mathop :}= E),k \mathrel {\mathop :}= 1,\ell \mathrel {\mathop :}= s)\). If \(X\subseteq V\) with \(|X |\le s\) is an odd cycle transversal in G such that \(V_1\) and \(V_2\) are the two color classes in the bipartite graph \(G-X\), then \(\mathcal {T}\mathrel {\mathop :}= \{(v,1,2) \mid v \in X\} \cup \{ (v,i,i) \mid i \in \{1,2\}, v\in V_i\}\) is a 1-activity timeline that covers \(\mathcal {G}\) with \(\sum _{(v,a,b)\in \mathcal {T}}(b-a)\le s\). Conversely, if \(\mathcal {T}\) is a 1-activity timeline that covers \(\mathcal {G}\) with \(\sum _{(v,a,b)\in \mathcal {T}}(b-a)\le s\), then \(X \mathrel {\mathop :}= \{v \in V \mid (v,1,2) \in \mathcal {T}\}\) is an odd cycle transversal of size at most s in G.

For fixed-parameter tractability, we show that MinTimeline\(_+\) with \(\tau = 2\) can be reduced to Almost 2-SAT. In this problem, the input consists of a Boolean formula \(\varphi \) in 2-CNF (with duplicate clauses allowed) and an integer s and the task is to decide whether \(\varphi \) can be made satisfiable by deleting at most s clauses. The problem is known to be in FPT when parameterized by s [33].

Let \((\mathcal {G}=(V,E_1,E_2),k,\ell )\) be an instance for MinTimeline\(_+\). If \(k \ne 1\), the instance is trivial. Otherwise, we introduce two Boolean variables \(x^v_1\) and \(x^v_2\) for each \(v \in V\). Intuitively, \(x^v_i\) is true if v is used to cover edges in \(E_i\). The reduction outputs the instance \((\varphi , s\mathrel {\mathop :}= \ell )\), where \(\varphi \) is constructed as follows: For every edge \(\{u,v\} \in E_i\), \(i\in \{1,2\}\), \(\varphi \) contains \(s + 1\) copies of the clause \((x^u_i \vee x^v_i)\) expressing that the edge must be covered. For every vertex \(v \in V\), the formula contains the clause \((\lnot x^v_1 \vee \lnot x^v_2)\), stating that v can only be used once unless this clause is deleted.

Now, suppose that X is a set of at most \(\ell \) clauses of \(\varphi \) and that \(\alpha \) is a satisfying assignment for all other clauses. Then, \(\mathcal {T} \mathrel {\mathop :}= \{(v,1,2) \mid (\lnot x^v_1\vee \lnot x^v_2) \in X\} \cup \{(v,i,i) \mid \alpha (x^v_i) = \texttt {true}, (\lnot x^v_1\vee \lnot x^v_2) \notin X\}\) is a 1-activity timeline that covers \(\mathcal {G}\) with \(\sum _{(v,a,b)\in \mathcal {T}}(b-a)\le \ell \). Conversely, if \(\mathcal {T}\) is a 1-activity timeline that covers \(\mathcal {G}\) with \(\sum _{(v,a,b)\in \mathcal {T}}(b-a)\le \ell \), then removing the at most \(\ell \) clauses in \(\{(\lnot x^v_1 \vee \lnot x^v_2)\mid (v,1,2)\in \mathcal {T}\}\) from \(\varphi \) makes the formula satisfiable by the following assignment: \(\alpha (x^v_i) = \texttt {true}\) if and only if \((v,i,i)\in \mathcal {T}\) or \((v,1,2)\in \mathcal {T}\). \(\square \)

Since MinTimeline\(_\infty \) and MinTimeline\(_+\) are NP-hard, even if \(\tau +k+\ell \) is constant, the interesting parameterizations remaining involve the number n of vertices. Clearly, combining n and \(\tau \) trivially yields fixed-parameter tractability for both problems, as the overall instance size is bounded in these two parameters. If we use only the number n of vertices as a parameter, then we can use dynamic programming to show that both problems are in XP.

Theorem 6

MinTimeline\(_\infty \) is solvable in \((k+1)^n(\ell +2)^n2^n \tau n^{O(1)}\) time.

Proof

We solve an instance \((\mathcal {G}=(V=\{v_1,\ldots ,v_n\},(E_i)_{i\in [\tau ]}),k,\ell )\) of MinTimeline\(_\infty \) via dynamic programming. We define a Boolean table T of size \(\tau (k+1)^n(\ell +2)^n\) as follows: For each \(i\in [\tau ]\), \(k_1,\ldots ,k_n\in \{0,\ldots ,k\}\), \(\ell _1,\ldots ,\ell _n\in \{-1,0,\ldots ,\ell \}\), \(T[i,k_1,\ldots ,k_n,\ell _1,\ldots ,\ell _n]= \texttt {true}\) if and only if there exists a \(\mathcal {T} \subseteq V\times [i]\times [i]\) with \(\max _{(v,a,b)\in \mathcal {T}}(b-a)\le \ell \) that covers \((V,E_1,\ldots ,E_i)\) and, for each \(j\in [n]\), satisfies

  • \(|\{(v_j,a,b)\in \mathcal {T}\}|\le k_j\),

  • \(|\{(v_j,a,i)\in \mathcal {T}\}|=0\) if \(\ell _j=-1\), and

  • \((v_j,i-\ell _j,i)\in \mathcal {T}\) if \(\ell _j \ge 0\).

Note that we have a yes-instance if and only if \(T[\tau ,k,\ldots ,k,\ell _1,\ldots ,\ell _n]=\texttt {true}\) for some \(\ell _1,\ldots ,\ell _n\).

For initialization, we set \(T[1,k_1,\ldots ,k_n,\ell _1,\ldots ,\ell _n] \mathrel {\mathop :}= \texttt {true}\) if and only if

  • \(\ell _j\le 0\) for all \(j\in [n]\),

  • \(\ell _j = -1\) for all \(j\in [n]\) with \(k_j=0\),

  • \(k_j > 0\) for all \(\ell _j=0\), and

  • \(\{v_j\mid \ell _j=0\}\) is a vertex cover for \((V,E_1)\).

This is clear from the definition of T. The table T can then be filled recursively as follows:

\(T[i,k_1,\ldots ,k_n,\ell _1,\ldots ,\ell _n] \mathrel {\mathop :}= \texttt {true}\) if and only if

  1. (i)

    \(\ell _j\le i-1\) for all \(j\in [n]\),

  2. (ii)

    \(\ell _j = -1\) for all \(j\in [n]\) with \(k_j=0\),

  3. (iii)

    \(k_j > 0\) for all \(\ell _j\ge 0\),

  4. (iv)

    \(\{v_j\mid \ell _j\ge 0\}\) is a vertex cover for \((V,E_i)\), and

  5. (v)

    \(T[i-1,k_1',\ldots ,k_n',\ell _1',\ldots ,\ell _n']=\texttt {true}\) for some \(k_1',\ldots ,k_n',\ell _1',\ldots ,\ell _n'\), where \(\circ \) \(k_j'=k_j\) and \(\ell _j'=\ell _j-1\) if \(\ell _j>0\), \(\circ \) \(k_j'=k_j-1\) and \(\ell _j'\in \{-1,\min (\ell ,i-2)\}\) if \(\ell _j=0\), and \(\circ \) \(k_j'=k_j\) and \(\ell _j'\in \{-1,\min (\ell ,i-2)\}\) if \(\ell _j=-1\).

Conditions (i)–(iv) ensure that the values \(k_j\) and \(\ell _j\) are consistent and yield a local vertex cover for layer i. Condition (v) checks whether the local solution extends to a valid solution for all previous layers.

Filling an entry of the table can be done with at most \(2^n\) table look-ups. Thus, the overall running time is \(\tau (k+1)^n(\ell +2)^n2^nn^{O(1)}\). \(\square \)

For MinTimeline\(_+\), one can achieve a better running time with a similar dynamic programming approach–this even yields fixed-parameter tractability for \(n+k\) and XP for n.

Theorem 7

MinTimeline\(_+\) is solvable in \((k+1)^n2^{O(n)}\tau (\ell +1)\) time.

Proof

Given an instance \((\mathcal {G}=(V=\{v_1,\ldots ,v_n\},(E_i)_{i\in [\tau ]}),k,\ell )\), we define a Boolean table T of size \(\tau (\ell +1) (k+1)^n2^n\) as follows: For each \(i\in [\tau ]\), \(k_1,\ldots ,k_n\in \{0,\ldots ,k\}\), \(S \subseteq V\), and \(l\in \{0,\ldots ,\ell \}\), \(T[i,k_1,\ldots ,k_n,S,l]= \texttt {true}\) if and only if there exists a \(\mathcal {T} \subseteq V\times [i]\times [i]\) with \(\sum _{(v,a,b)\in \mathcal {T}}(b-a)\le l\) that covers \((V,E_1,\ldots ,E_i)\) and, for each \(j\in [n]\), satisfies

  • \(|\{(v_j,a,b)\in \mathcal {T}\} |\le k_j\),

  • \(|\{(v_j,a,i)\in \mathcal {T}\}|=0\) if \(v_j\not \in S\), and

  • \(|\{(v_j,a,i)\in \mathcal {T}\}|>0\) if \(v_j \in S\).

That is, we have a yes-instance if and only if \(T[\tau ,k,\ldots ,k,S,\ell ]=\texttt {true}\) for some \(S\subseteq V\). By definition, we set \(T[1,k_1,\ldots ,k_n,S,l]=\texttt {true}\) if and only if

  • \(v_j\not \in S\) for all \(j\in [n]\) with \(k_j=0\) and

  • S is a vertex cover for \((V,E_1)\).

The remaining table entries can then be computed recursively:

\(T[i,k_1,\ldots ,k_n,S,l]=\texttt {true}\) if and only if

  1. (i)

    \(v_j\not \in S\) for all \(j\in [n]\) with \(k_j=0\),

  2. (ii)

    S is a vertex cover for \((V,E_i)\), and

  3. (iii)

    \(T[i-1,k_1',\ldots ,k_n',S',l']=\texttt {true}\) for some \(S'\subseteq V\), where

    1. (a)

      \(k_j'=k_j\) if \(v_j\not \in S\),

    2. (b)

      \(k_j'=k_j-1\) if \(v_j\in S\setminus S'\),

    3. (c)

      \(k_j'\in \{k_j-1,k_j\}\) if \(v_j\in S\cap S'\), and

    4. (d)

      \(l' = l - |\{j\in [n]\mid v_j\in S\cap S', k_j'=k_j\}|\).

Conditions (i)–(iii) ensure that the values \(k_j\) are consistent with S and yield a local vertex cover for layer i. Condition (iv) checks whether the local solution extends to a valid solution for all previous layers. Note that (c) captures the case that a solution \(\mathcal {T}\) contains some \((v_j,a,i-1)\) and \((v_j,i,i)\) (in which case \(k_j' = k_j-1\)).

Thus, a table entry can be computed with at most \(4^n\) table look-ups leading to an overall running time of \(\tau (\ell +1) (k+1)^n2^{O(n)}\). \(\square \)

Note that Theorem 6 also implies that MinTimeline\(_\infty \) parameterized by \(n+k+\ell \) is in FPT. To show that MinTimeline\(_\infty \) is also in FPT when parameterized by \(n+k\), we observe that it is sufficient to consider only two possibilities to cover a time-edge. This leads to a search tree algorithm similar to the one for the classical Vertex Cover problem.

Theorem 8

MinTimeline\(_\infty \) is solvable in \(O(2^{nk}n^2\tau )\) time.

Proof

Let \((\mathcal {G}=(V,(E_i)_{i\in [\tau ]}),k,\ell )\) be a MinTimeline\(_\infty \) instance. We solve the instance with a search tree algorithm. To this end, we store counters \(k_v\), \(v\in V\), for the number of intervals chosen for each vertex. We initially set all counters to zero and start with an empty solution \(\mathcal {T}=\emptyset \).

Let \(i=\min \{t\in [\tau ]\mid E_t\ne \emptyset \}\) and let \(\{u,v\}\in E_i\) be an arbitrary edge (if all layers are empty, then we return “yes”). If \(k_u=k\) and \(k_v=k\), then we return “no” since we cannot cover this edge. Otherwise, we simply branch into the (at most two) options of either taking \((u,i,i')\) (if \(k_u<k\)) or \((v,i,i')\) (if \(k_v<k\)) into \(\mathcal {T}\), where \(i'=\min (i+\ell ,\tau )\). In each branch, we increase the corresponding counter (\(k_u\) or \(k_v\)) by one, delete all edges incident to the corresponding vertex (u or v) from the layers \(E_i,\ldots ,E_{i'}\), and recursively proceed on the remaining instance. Clearly, the recursion terminates after at most nk calls. Thus, the running time is in \(O(2^{nk}n^2\tau )\).

\(\square \)

We continue with disentangling the parameterized complexity of MinTimeline\(_+\) and MinTimeline\(_\infty \) regarding n and \(\ell \) in Sections 4 and 5.

4 Parameterizing MinTimeline \(_+\) by \(n+\ell \)

The main goal of this section is to show the following.

Theorem 9

MinTimeline\(_+\) parameterized by \(n+\ell \) is in FPT.

The formal proof is deferred to the end of this section. The general idea behind the algorithm is to split the k-activity timeline \(\mathcal {T}\) into two parts \(\mathcal {T}_0 \uplus \mathcal {T}_{>0} = \mathcal {T}\). Here, \(\mathcal {T}_0\) contains all elements \((v,a,b)\in \mathcal {T}\) with \(a=b\) and \(\mathcal {T}_{>0}\) contains all elements \((v,a,b)\in \mathcal {T}\) with \(a<b\). Note that \(\sum _{(v,a,b)\in \mathcal {T}_{0}}(b-a)= 0\) and that \(\sum _{(v,a,b)\in \mathcal {T}_{>0}}(b-a)\le \ell \). We observe that \(\mathcal {T}_{>0}\) induces an interval graph and that the number of possible induced interval graphs is upper-bounded by a function only depending on \(n+\ell \). The algorithm iterates over all of these interval graphs and identifies the part of our temporal graph which can be covered by a corresponding \(\mathcal {T}_{>0}\). It remains to find a \(\mathcal {T}_0\) that covers the rest of our temporal graph. To this end, we will show that MinTimeline\(_+\) parameterized by n is in FPT if \(\ell =0\). In fact, as both problems are equivalent if \(\ell =0\), we show that MinTimeline\(_\infty \) and MinTimeline\(_+\) are both in FPT when parameterized by n in this case. In the proof of Theorem 9, we will need a slightly more general version of these problems, in which there is not a single value k, but a value \(k_v\) for each \(v \in V\). We call this generalization Nonuniform MinTimeline\(_\infty \) (MinTimeline\(_+\)).

Lemma 10

Nonuniform MinTimeline\(_\infty \)  (MinTimeline\(_+\,\) ) parameterized by n is in FPT if \(\ell =0\).

Proof

Given an instance \(\mathcal {I}=(\mathcal {G}=(V,(E_i)_{i\in [\tau ]}),(k_v)_{v\in V},0)\), we will create an integer linear program (ILP) with a number of variables bounded by a function of n. This ILP is feasible if and only if \(\mathcal {I}\) is a yes-instance. Using Lenstra’s algorithm [26], this implies that Nonuniform MinTimeline\(_\infty \) (MinTimeline\(_+\)) parameterized by n is in FPT, if \(\ell =0\).

We use a variable \(X_E^S\) for every \(E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) \) and \(S\subseteq V\) where S is a vertex cover for (VE). There are at most \(2^{\left( {\begin{array}{c}n\\ 2\end{array}}\right) +n}\) variables of this kind. Intuitively, the value of the variable \(X_E^S\) gives us the number of times the vertex cover S is used to cover a layer with edge set E.

For \(E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) \), let \(a(E)\mathrel {\mathop :}= |\{ t \in [\tau ]\mid E_t = E\}|\) denote the number of times the edge set E appears as a layer in \(\mathcal {G}\). Let \(\mathcal {T}s(E)\mathrel {\mathop :}= \{S \subseteq V \mid S \text { is a vertex cover of } (V,E)\}\). Then, the ILP constraints are as follows:

$$\begin{aligned} \sum _{S \in \mathcal {C}(E)} X_E^S = a(E),&\text { for all } E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) , \end{aligned}$$
(1)
$$\begin{aligned} \sum _{E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) }\sum _{\begin{array}{c} S \in \mathcal {C}(E) \\ \text {s.t. } v \in S \end{array}} X_E^S \le k_v,\quad \, \, \,&\text { for all } v \in V, \\ X_E^S \in \mathbb {N},\quad \, \, \, \, \,&\text { for all } E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) , S \in \mathcal {C}(E). \nonumber \end{aligned}$$
(2)

As we mentioned before, we are only interested in the feasibility of this ILP, so there is no objective function to optimize.

This ILP is feasible if and only if \(\mathcal {I}\) is a yes-instance: Suppose that \((X_E^S)_{E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) ,S \in \mathcal {C}(E)}\) is a solution. We define a solution \(\mathcal {T}\) of \(\mathcal {I}\) as follows: For any \(E\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) \), let \(\mathcal {C}(E) = \{S^E_1,\ldots ,S^E_{r_E}\}\). We use \(S^E_1\) to cover the first \(X_E^{S_1}\) appearances of (VE) in the layers of \(\mathcal {G}\), that is, we add (vtt) to \(\mathcal {T}\) for every \(v\in S^E_1\) and appearance \((V,E_t)\). Then we continue with \(S^E_2\) to cover the next \(X_E^{S_2}\) appearances, and so on. Condition (1) guarantees that \(\mathcal {T}\) covers \(\mathcal {G}\) and Condition (2) ensures that at most \(k_v\) intervals are chosen for each vertex \(v\in V\).

Conversely, suppose that \(\mathcal {I}\) admits a solution \(\mathcal {T}\). For \(t \in [\tau ]\), let \(X_t \mathrel {\mathop :}= \{ v \in V \mid (v,t,t) \in \mathcal {T}\}\). Since \(\ell =0\), \(X_t\) must be a vertex cover for \((V,E_t)\). Then, set \(X_E^S \mathrel {\mathop :}= |\{ t \in [\tau ] \mid E_t = E \text { and } X_t = S \}|\). It is easy to check that this yields a solution of the ILP. \(\square \)

As a side result, Theorem 2 and Lemma 10 together imply the following.

Corollary 11

(a  :  b)-Coloring parameterized by the number of vertices is in FPT.

We are now set to show Theorem 9: MinTimeline\(_+\) parameterized by \(n+\ell \) is in FPT. The algorithm in the following proof is illustrated in Fig. 2.

Fig. 2
figure 2

Illustration of the algorithm for \(\ell = 7\) and \(k=2\) in the proof of Theorem 9: There are two solution patterns with the \(\ell '\)-patterns highlighted in light gray and the intervals are highlighted in dark gray. The solution is completed with intervals of length zero, which are represented by diamonds

Proof of Theorem 9

For an instance \((\mathcal {G}=(V,(E_i)_{i\in [\tau ]}),k,\ell )\), we say that an \(\ell '\)-pattern is a sequence \((F_0,\ldots ,F_{\ell '})\) of edge sets where \(F_i\subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) \) for all \(i \in [\ell ']\). A solution pattern is a pair \((P,\mathcal {I})\) where P is an \(\ell '\)-pattern with \(1 \le \ell ' \le \ell \) and \(\mathcal {I} \subseteq V \times \{0,\ldots ,\ell '\} \times \{0,\ldots ,\ell '\}\) with \(\mathcal {I} \ne \emptyset \) and \(a < b\) for all \((v,a,b) \in \mathcal {I}\). Let \(\mathcal {P}\) denote the set of all solution patterns. Note that there are at most \(2^{\left( {\begin{array}{c}n\\ 2\end{array}}\right) (\ell +1)}\cdot \ell \) different \(\ell '\)-patterns with \(1\le \ell ' \le \ell \). This yields \(|\mathcal {P}|\le 2^{\left( {\begin{array}{c}n\\ 2\end{array}}\right) (\ell +1)+n(\ell +1)^2}\cdot \ell \in 2^{O(n^2\ell ^2)}\). The weight of a solution pattern \((P,\mathcal {I})\) is defined as \(w((P,\mathcal {I})) \mathrel {\mathop :}= \sum _{(v,a,b) \in \mathcal {I}} (b -a)\).

Our algorithm first checks all possibilities of how often a solution “matches” each solution pattern \((P,\mathcal {I})\), that is, it uses intervals as specified by \(\mathcal {I}\) to cover a subsequence of layers of \(\mathcal G\) that is equal to P (a formal explanation follows below). Since \(\mathcal I\) contains an interval with positive length, we can choose at most \(\ell \) such solution patterns. Hence, we iterate over all functions \(f:\mathcal {P} \rightarrow \{0,\ldots ,\ell \}\) with \(\sum _{x \in \mathcal {P}} f(x) w(x) \le \ell \) and which have the property that \(\sum _{(P,\mathcal I)\in \mathcal P}f((P,\mathcal I))|\{ (v,a,b) \mid (v,a,b) \in \mathcal I\}|\le k\) for all \(v\in V\). There are at most \((\ell +1)^{|\mathcal {P}|}\) such functions. Next, we try out every order in which the solution patterns are matched by a solution. The result is a sequence \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\) of \(r\le \ell \) solution patterns. The arguments above imply that we check at most \((\ell +1)^{2^{O(n^2\ell ^2)}} \cdot \ell !\) such sequences.

Next, we check whether \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\) can be matched by a solution and, if it can, compute the temporal graph that remains to be covered once we implement the solution patterns. The sequence above can be matched by a solution if there are \(i_1< j_1< i_2< j_2< \dots< i_r < j_r \in [\tau ]\) such that \(P_s = (E_{i_s},\ldots ,E_{j_s})\) for all \(s \in [r]\). Algorithmically, we simply determine \(i_s\) and \(j_s\) by finding the earliest occurrence of \(P_s\) in \(E_1,\ldots ,E_\tau \) with \(i_s \ge j_{s-1} +1\).

Next, we compute the remaining temporal graph obtained by implementing the solution patterns \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\) on \(i_1,\ldots ,i_r,j_1,\ldots ,j_r \in [\tau ]\). To this end, for each \(s\in [r]\) and each \(t\in [i_s,j_s]\), let \(E'_t \mathrel {\mathop :}= E_t \setminus \text {inc}\{ v\in V \mid (v,a,b) \in \mathcal {I}_s,\; i_s+a\le t \le i_s + b\}\). We call \(\mathcal {G}' \mathrel {\mathop :}= (V, E'_1,\ldots ,E'_\tau )\) the residual temporal graph. For each \(v\in V\), let \(k_v \mathrel {\mathop :}= k - \sum _{s=1}^r |\{ (v,a,b) \mid (v,a,b) \in \mathcal {I}_s\}|\).

We now build the instance \((\mathcal {G}',(k_v)_{v\in V},0)\) of Nonuniform MinTimeline\(_+\). By Lemma 10, solving this instance is FPT when parameterized by n. Our algorithm returns \(\texttt {true}\) if \((\mathcal {G}',(k_v)_{v\in V},0)\) is a yes-instance for at least one sequence \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\).

It remains to show that the algorithm we described is correct. If the algorithm returns true, then this result is clearly correct. Assume that, for \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\), the instance \((\mathcal {G}',(k_v)_{v\in V},0)\) has a solution \(\mathcal {T}_0\). Let \(\mathcal {T}_{>0} \mathrel {\mathop :}= \bigcup _{s=1}^r\{ (v,i_s+a,i_s+b) \mid (v,a,b) \in \mathcal {I}_{s}\}\). Then, by construction, it is easy to verify that \(\mathcal {T} \mathrel {\mathop :}= \mathcal {T}_0 \cup \mathcal {T}_{>0}\) is a solution for \((\mathcal {G},k,\ell )\).

Conversely, suppose that \(\mathcal {T}\) is a solution for \((\mathcal {G},k,\ell )\). Let \(\mathcal {T}_{>0} \mathrel {\mathop :}= \{(v,a,b) \in \mathcal {T} \mid a<b\}\). Consider the interval multiset \(\mathcal {I} \mathrel {\mathop :}= \{[a,b] \subseteq [\tau ] \mid \exists v \in V:(v,a,b) \in \mathcal {T}_{>0}\}\) and the corresponding interval graph \(G_{\mathcal {I}}\mathrel {\mathop :}= (\mathcal {I},E_{\mathcal {I}})\), where \(E_{\mathcal {I}} \mathrel {\mathop :}= \{\{[a,b],[a',b']\} \in \left( {\begin{array}{c}\mathcal {I}\\ 2\end{array}}\right) \mid [a,b] \cap [a',b'] \ne \emptyset \}\). Since \(\sum _{[a,b]\in \mathcal {I}} (b-a) \le \ell \), it follows that \(G_{\mathcal {I}}\) contains at most \(\ell \) connected components and each of these components covers at most \(\ell \) time steps. We will describe a solution pattern corresponding to each connected component of \(G_{\mathcal {I}}\). For a connected component C of \(G_{\mathcal {I}}\), let \(i \mathrel {\mathop :}= \min _{[a,b] \in C} a\) and \(j \mathrel {\mathop :}= \max _{[a,b] \in C} b\). Note that \(j-i + 1 \le \ell \). Consider the \((j-i + 1)\)-pattern \(P = (E_i,\ldots ,E_j)\). Let \(\mathcal {J} \mathrel {\mathop :}= \{(v,a-i,b-i) \mid (v,a,b) \in \mathcal {T}_{>0},\; [a,b]\in C\}\). Then, the solution pattern corresponding to C is \((P,\mathcal {J})\). By listing the solution pattern for each connected component of \(G_{\mathcal {I}}\) in the order in which the components appear in the interval graph, we get the solution patterns \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\) where r is the number of components of \(G_{\mathcal {I}}\).

We claim that our algorithm returns true for this particular sequence of solution patterns. Note that our algorithm may choose different indices \(i_1,\ldots ,i_r,j_1,\ldots ,j_r\) for implementing \((P_1,\mathcal {I}_1),\ldots ,(P_r,\mathcal {I}_r)\). However, the resulting residual temporal graph \(\mathcal {G}'\) is the same as the residual temporal graph derived from the connected components of \(G_\mathcal {I}\) up to a permutation of the layers. Hence, by Observation 1\(\mathcal {G}'\) is also a yes-instance for Nonuniform MinTimeline\(_+\) with \(\ell = 0\). \(\square \)

5 Parameterizing MinTimeline \(_\infty \) by \(n+\ell \)

In this section, we prove that fixed-parameter tractability of MinTimeline\(_\infty \) parameterized by \(n+\ell \) is (in contrast to MinTimeline\(_+\)) unlikely.

Theorem 12

MinTimeline\(_\infty \) parameterized by n is W[1]-hard for \(\ell = 1\).

The key difference to the case \(\ell = 0\) (which is in FPT (Lemma 10)) is that, for \(\ell =1\), intervals can overlap and hence, the temporal ordering of the layers is relevant. We prove Theorem 12 in three steps by first showing that two generalizations of MinTimeline\(_\infty \) with \(\ell = 1\) are W[1]-hard when parameterized by n. The key step is to show W[1]-hardness for the following “multicolored” version of MinTimeline\(_\infty \).

Multicolored MinTimeline\(_\infty \)

Input:       A temporal graph \(\mathcal {G}=(V,E_1,\ldots ,E_\tau )\) where \(V=V_1\uplus \dots \uplus V_r\),

                                  \(\ell \in \mathbb {N}_0\), and \(k_1,\ldots ,k_r \in \mathbb {N}\).

Question:  Is there an activity timeline \(\mathcal {T}\) covering \(\mathcal {G}\) such that

                                   \(\max _{(v,a,b)\in \mathcal {T}}(b-a)\le \ell \) and \(|\{(v,a,b) \in \mathcal {T} \mid v \in V_i\}|\le k_i\) for all

                                   \(i \in [r]\)?

The proof is by reduction from Unary Bin Packing, where we are given m items with sizes \(s_1,\ldots ,s_m\in \mathbb {N}\), a number \(\beta \in \mathbb {N}\) of bins, and a bin size \(B \in \mathbb {N}\) with all integers encoded in unary. We are asked to decide if there is an assignment \(f:[m] \rightarrow [\beta ]\) of items to bins such that \(\sum _{i \in f^{-1}(b)} s_i \le B\) for all \(b \in [\beta ]\). This problem is W[1]-hard when parameterized by \(\beta \) [24]. The general idea behind the reduction is that bins can be represented by vertices and the bin size by the color budgets \(k_i\).

Lemma 13

Multicolored MinTimeline\(_\infty \) parameterized by n is W[1]-hard for \(\ell = 1\).

Fig. 3
figure 3

Output instance of the reduction for a Unary Bin Packing instance consisting of four items of sizes 2, 3, 1, and 3 with \(\beta =3\) and \(B=3\). The activity timeline indicated in the figure corresponds to an assignment that adds items 1 and 3 to the first bin, item 2 to the second bin, and item 4 to the third bin

Proof

We reduce from Unary Bin Packing and assume that in the input instance \((s_1,\ldots ,s_m,\beta ,B)\), we have \(S \mathrel {\mathop :}= \sum _{i=1}^{m} s_i = \beta B\). If \(S > \beta B\), then this is clearly a no-instance. If \(S < \beta B\), then we can add \(\beta B - S\) items of size 1.

We construct an instance \((\mathcal {G}=(V=V_1\uplus \dots \uplus V_r,(E_t)_{t\in [\tau ]}),\ell =1,(k_i)_{i\in [r]})\) for Multicolored MinTimeline\(_\infty \) (see Fig. 3.). Let \(V \mathrel {\mathop :}= \{u_1,\ldots ,u_\beta ,v_1,\ldots ,v_\beta \}\), \(r \mathrel {\mathop :}= \beta +1\), \(V_i\mathrel {\mathop :}= \{u_i\}\) for all \(i\in [\beta ]\), and \(V_{\beta +1} \mathrel {\mathop :}= \{v_1,\ldots ,v_\beta \}\). We set \(k_i \mathrel {\mathop :}= S - B\) for \(i\in [\beta ]\) and \(k_{\beta +1} \mathrel {\mathop :}= S - m\). The number of layers is \(\tau \mathrel {\mathop :}= 2 S\). The first \(2s_1\) layers represent item 1, followed by \(2s_2\) layers representing item 2, and so on. Specifically, if \(t,\ldots , t+2s_i - 1\) are the layers representing item i, then

$$\begin{aligned} E_t&\mathrel {\mathop :}= E_{t+2s_i - 1} \mathrel {\mathop :}= \{ \{u_j,u_{j'}\} \mid j,j' \in [\beta ], j\ne j'\} \text { and}\\ E_{t+a}&\mathrel {\mathop :}= \{ \{u_j,u_{j'}\} \mid j,j' \in [\beta ], j\ne j'\} \cup \{\{u_j,v_j\} \mid j \in [\beta ]\} \end{aligned}$$

for \(a \in [2s_i -2]\). Clearly, this instance can be computed in polynomial time and \(\vert V |=2\beta \). It remains to show that the instance for Unary Bin Packing is a yes-instance if and only if this output instance is a yes-instance for Multicolored MinTimeline\(_\infty \).

Let f be an assignment of items to bins such that \(\sum _{i \in f^{-1}(b)} s_i = B\) for all \(b \in [\beta ]\). We will give an activity timeline \(\mathcal {T}\) that covers \(\mathcal {G}\). For any item i, let \(t,\ldots ,t+2s_i -1\) be the \(2s_i\) layers representing this item and let \(b_i \mathrel {\mathop :}= f(i)\) be its bin. Then, we add the following intervals to \(\mathcal {T}\):

$$\begin{aligned}&\{(u_j,t+2a,t+2a+1) \mid j \in [\beta ], j \ne b_i, a \in \{0,\ldots ,s_i-1\}\} \cup \\&\{(v_{b_i},t+2a+1,t+2a+2) \mid a \in \{0,\ldots ,s_i-2\}\}. \end{aligned}$$

Then, any edge \(\{u_j,u_{j'}\}\) is covered because either \(j\ne b_i\) or \(j'\ne b_i\). Also, the edge \(\{u_j,v_j\}\) is covered by \(u_j\) for \(j\ne b_i\) and by \(v_{b_i}\) for \(j=b_i\). Then, for \(j \in [\beta ]\), \(j\ne b_i\), there are \(s_i\) intervals that contain \(u_j\) and no interval contains \(u_{b_i}\). Hence, for every \(j \in [\beta ]\), the vertex \(u_j\) is contained in

$$\begin{aligned} \sum _{\begin{array}{c} i \in [m] \\ b_i \ne j \end{array}} s_i = S - \sum _{\begin{array}{c} i \in [m] \\ b_i = j \end{array}} s_i = S - B = k_j \end{aligned}$$

intervals. The vertex \(v_j\) is contained in

$$\begin{aligned} \sum _{\begin{array}{c} i \in [m] \\ b_i = j \end{array}} (s_i -1) = B - |f^{-1}(j)|\end{aligned}$$

intervals. Thus, the total number of intervals containing a vertex in \(V_{\beta + 1}\) is

$$\begin{aligned} \sum _{j \in [\beta ]} B - |f^{-1}(j)|= \beta B - m = S -m = k_{\beta +1}. \end{aligned}$$

Now assume that \(\mathcal {T}\) is an activity timeline that covers \(\mathcal {G}\). Since \(\{u_1,\ldots ,u_\beta \}\) induce a clique in every layer that represents an item, \(\mathcal {T}\) must contain all but one of these vertices in every such layer. There are a total of 2S such layers. Since each interval can cover a vertex in at most \(\ell +1=2\) layers, this requires \(S(\beta - 1)\) intervals. Since only \(k_j= S - B\) intervals containing a vertex \(u_j\) may be chosen, the total number of intervals containing any of the vertices \(u_1,\ldots ,u_\beta \) is at most \(\beta (S-B) = \beta S - S = S(\beta -1)\) intervals. Hence, in each layer that represents an item, exactly \(\beta - 1\) of the vertices \(u_1,\ldots ,u_\beta \) are in \(\mathcal {T}\). Therefore, \(\mathcal {T}\) contains only intervals of the form \((u_b,t+a,t+a+1)\) where t is the first layer corresponding to a particular item and a is even.

Now consider the vertices \(v_1,\ldots ,v_\beta \). Since one vertex \(u_j\) is not contained in \(\mathcal {T}\) for every layer representing an item, the vertex \(v_j\) must be in \(\mathcal {T}\), unless it is the first or the final layer representing that item. There are \(\sum _{i \in [m]} (2s_i -2) = 2(S - m)\) such layers. Since each interval can cover at most two layers, this requires \(S-m = k_{\beta + 1}\) intervals. Hence, none of the intervals that use any \(v_j\) can overlap. Therefore, \(\mathcal {T}\) contains intervals of the form \((v_j,t+a,t+a+1)\) where t is the first layer corresponding to a particular item and a is odd.

Now, consider an item \(i\in [m]\) and the representing layers \(t,\ldots ,t+2s_i-1\). If \(s_i=1\), then there clearly exists one \(j\in [\beta ]\) such that \((u_j,t,t+1)\) is not contained in \(\mathcal {T}\). If \(s_i > 1\) and \(\mathcal {T}\) does not contain \((u_j,t+2a,t+2a+1)\) and \((u_{j'},t+2a+2,t+2a+3)\) with \(j \ne j'\) and \(0\le a\le s_i-2\), then \(\mathcal {T}\) must contain \((v_j,t+2a+1,t+2a+2)\) and \((v_{j'},t+2a+1,t+2a+2)\), contradicting our previous observation. Hence, for every item \(i \in [m]\), there exists exactly one \(j \in [\beta ]\) such that \((u_j,t+2a,t+2a+1)\) is not in \(\mathcal {T}\) for all \(0 \le a \le s_i-1\). We will call this bin \(b_i\). This yields the assignment \(f(i) \mathrel {\mathop :}= b_i\) for all \(i\in [m]\).

Suppose that \(\sum _{i \in f^{-1}(j)} s_i > B\) for any \(j \in [\beta ]\). Since \(\sum _{j\in [\beta ]}\sum _{i \in f^{-1}(j)} s_i = \sum _{i\in [m]} s_i = \beta B\), this implies that \(\sum _{i \in f^{-1}(j')} s_i < B\) for some \(j' \in [\beta ]\). Then, \(u_{j'}\) is contained in

$$\begin{aligned} \sum _{\begin{array}{c} i\in [m]\\ f(i)\ne j \end{array}}s_i > S - B \end{aligned}$$

intervals in \(\mathcal {T}\), which is not possible. Hence, f is an assignment of items to bins that satisfies \(\sum _{i \in f^{-1}(j)} s_i = B\) for all \(j\in [\beta ]\). \(\square \)

Recall the definition of Nonuniform MinTimeline\(_\infty \) given in Section 4. Using Lemma 13, we can now show that it is W[1]-hard when parameterized by n for \(\ell =1\).

Lemma 14

Nonuniform MinTimeline\(_\infty \) parameterized by n is W[1]-hard for \(\ell = 1\).

Proof

The proof is by reduction from Multicolored MinTimeline\(_\infty \). Let \((\mathcal {G}=(V=V_1\uplus \dots \uplus V_r,(E_t)_{t\in [\tau ]}),\ell =1,(k_i)_{i\in [r]})\) be an instance of Multicolored MinTimeline\(_\infty \).

We construct an instance \((\mathcal {G}'=(V,(E'_t)_{t\in [\tau ']}),\ell =1,(k'_v)_{v\in V})\) of Nonuniform MinTimeline\(_\infty \) as follows. For every \(i\in [r]\) and every \(v \in V_i\), we set \(k'_v \mathrel {\mathop :}= k_i\). Let \(\tau ' \mathrel {\mathop :}= \tau + 2\sum _{i = 1}^r k_i\). For \(t \in [\tau ]\), we set \(E'_t \mathrel {\mathop :}= E_t\). It remains to define the additional layers \(\tau +1,\ldots ,\tau '\). For every \(i \in [r]\), we add \(2k_i\) layers \(t_i \mathrel {\mathop :}= \tau + 1 +2\sum _{j=1}^{i-1}k_j,\ldots ,t_i + 2k_i-1\), in which the vertices in \(V_i\) form a clique while all other vertices are isolated.

Suppose that \(\mathcal {T}\) is an activity timeline for \(\mathcal {G}\) with \(|\{(v,a,b) \in \mathcal {T} \mid v \in V_i\}|\le k_i\) for all \(i \in [r]\). For each \(v\in V\), let \(\overline{k}_v \mathrel {\mathop :}= |\{(v,a,b)\in \mathcal {T} \mid a\in [\tau ]\}|\) be the number of times v is used in \(\mathcal {T}\), that is, \(\sum _{v\in V_i} \overline{k}_v \le k_i\) for each \(i\in [r]\). Hence, there exists a function \(f_i :[k_i] \rightarrow V_i\) such that \(\vert f_i^{-1}(v) |\ge \overline{k}_v\) for all \(v\in V_i\). Using \(f_i\), we can cover the clique on \(V_i\) in the layers \(t_i,\ldots ,t_i +2k_i-1\) that represent the color i with the intervals

$$\begin{aligned} \mathcal {T}'_i \mathrel {\mathop :}= \{(v,t_i+2a-2,t_i + 2a-1) \mid v \in V_i, a \in [k_i], f_i(a) \ne v\}. \end{aligned}$$

Then, \(\mathcal {T}' \mathrel {\mathop :}= \mathcal {T} \cup (\bigcup _{i\in [r]} \mathcal {T}'_i)\) is an activity timeline for \(\mathcal {G}'\). Moreover, for every \(v\in V_i\), the following holds:

$$\begin{aligned}&|\{(v,a,b) \in \mathcal {T}' \mid a \in [\tau ']\}|=\\&|\{(v,a,b) \in \mathcal {T} \mid a \in [\tau ]\}|+ |\{(v,a,a+1) \in \mathcal {T}_i' \mid \tau +1 \le a \le \tau ' -1\}|\\&= \overline{k}_v + k_i - |f_i^{-1}(v)|\le k_i=k'_v. \end{aligned}$$

Conversely, suppose that \(\mathcal {T}'\) is an activity timeline for \(\mathcal {G}'\). In every layer \(t_i,\ldots ,t_i+2k_i-1\) at least \(|V_i |-1\) vertices in \(V_i\) must be active since \(V_i\) forms a clique in these layers. Since every interval can cover only two layers, this requires at least \((|V_i |-1)k_i\) intervals that use vertices in \(V_i\). Hence, for every \(i \in [r]\), \(\mathcal {T}'\) can contain at most \(k_i\) intervals (vab) with \(a\in [\tau ]\) and \(v\in V_i\). Therefore, \(\mathcal {T} \mathrel {\mathop :}= \{(v,a,b) \in \mathcal {T}' \mid 1 \le a \le \tau \}\) is an activity timeline that covers \(\mathcal {G}\) with the required property. \(\square \)

To prove Theorem 12, we now show how to reduce Nonuniform MinTimeline\(_\infty \) to MinTimeline\(_\infty \).

Proof of Theorem 12

We reduce from Nonuniform MinTimeline\(_\infty \). Given an input instance \((\mathcal {G}=(V=\{v_1,\ldots ,v_n\},(E_t)_{t \in [\tau ]}),\ell = 1, (k_v)_{v\in V})\), we construct an instance \((\mathcal {G}'=(V',(E'_t)_{t \in [\tau ']}),\ell =1,k)\) of MinTimeline\(_\infty \). We let \(V'\mathrel {\mathop :}= V \cup \{u_1,u_2\}\), \(\tau ' \mathrel {\mathop :}= \tau + 2k(|V |+2)\), and \(k \mathrel {\mathop :}= \max _{v\in V} k_v\). The layers of \(\mathcal {G}'\) are as follows: For \(t \in [\tau ]\), we let \(E'_t \mathrel {\mathop :}= E_t\). The layers \(E'_{\tau +1},\ldots ,E'_{\tau +4k}\) only contain the edge \(\{u_1,u_2\}\). Then, for \(i\in [n]\), the layers \(E'_{\tau +2k(i+1) + 1},\ldots ,E'_{\tau +2k(i+1) + 2(k - k_{v_i})}\) contain only the edge \(\{v_i,u_1\}\), while the layers \(E'_{\tau +2k(i+1) + 2(k - k_{v_i}) +1},\ldots ,E'_{\tau +2k(i+2)}\) are empty.

Suppose that \(\mathcal {T}\) is an activity timeline that covers \(\mathcal {G}\) and contains only \(k_v\) intervals that use v for each \(v\in V\). Then, we construct a k-activity timeline \(\mathcal {T}'\) that covers \(\mathcal {G}'\) as follows. We include all intervals in \(\mathcal {T}\). We add \((u_1,\tau +2a-1,\tau +2a)\) and \((u_2,\tau +2k+2a-1,\tau +2k+2a)\) for all \(a\in [k]\) and \((v_i,\tau +2k(i+1)+a-1,\tau +2k(i+1)+a)\) for all \(a \in [k-k_v]\).

Now suppose that \(\mathcal {T}'\) is a k-activity timeline that covers \(\mathcal {G}'\). First, \(\mathcal {T}'\) must contain k intervals that use \(u_1\) and k intervals that use \(u_2\) in order to cover the appearances of the edge \(\{u_1,u_2\}\) in \(E'_{\tau +1},\ldots ,E'_{\tau +4k}\). Hence, the edges \(\{u_1,v_i\}\) can only be covered by intervals that use \(v_i\). This requires \(k - k_{v_i}\) intervals that use \(v_i\). Hence, \(\mathcal {T} \mathrel {\mathop :}= \{(v,a,b) \in \mathcal {T}' \mid a\in [\tau ], v\in V\}\) is an activity timeline that covers \(\mathcal {G}\) and only contains \(k_v\) vertices that use each \(v\in V\). \(\square \)

Unless the ETH fails, Unary Bin Packing cannot be solved in time \(f(\beta )\vert I |^{o(\beta /\log \beta )}\) for any function f, where \(|I \vert \) is the input size ([24] Theorem 3). The fact that our reduction yields a temporal graph with \(O(\beta )\) vertices implies the following:

Corollary 15

MinTimeline\(_\infty \) cannot be solved in time \(f(n)|\mathcal {G} |^{o(n/\log n)}\), for any function f, even if \(\ell = 1\), unless the ETH fails.

6 Conclusion

We completely settled the computational complexity of MinTimeline\(_\infty \) regarding the considered parameters. For MinTimeline\(_+\), the open question remaining is whether it is in FPT when parameterized by the number of vertices. Besides this question, there are many others which could be studied in future work:

  • Are there (polynomial) kernelizations for the FPT cases? Developing data reduction rules might be especially interesting from a practical perspective.

  • Does MinTimeline\(_+\) parameterized by \(n+\ell \) admit an FPT algorithm with a more practical running time than the algorithm in the proof of Theorem 9? Or at least a purely combinatorial algorithm, that is, one that does not invoke Lenstra’s algorithm?

  • Which other parameters yield tractable special cases? For example, can the number of vertices be replaced by a smaller parameter (e.g. the vertex cover number or the treewidth of the underlying graph)?

  • What changes if one only bounds the overall number of activity intervals instead of bounding for each vertex? It should be possible to modify all our algorithms to solve this problem. Maybe some of our hard cases become tractable?

  • Dondi [10] poses the following interesting question: Is MinTimeline\(_+\) with the restriction that \(k=1\) fixed-parameter tractable with respect to \(\ell \)? We showed that it is, in fact, fixed-parameter tractable if we additionally restrict that \(\tau =2\) (Theorem 5), so it would be interesting to know whether this can be generalized to arbitrary \(\tau \) or even to \(\tau =3\).

  • What about “temporalizing” other vertex selection problems (like Dominating Set) in an analogous way (that is, at each time step the set of active vertices must be a valid selection for the current graph)? In fact, our dynamic programs and the ILP should easily work here as well, since they do not specifically depend on vertex covers.