1 Introduction

It is widely believed that NP-hard problems can not be solved by polynomial-time algorithms. Nevertheless, such problems tend to appear in numerous applications. Among various approaches for dealing with NP-hard problems parameterized complexity has recently received a lot of attention. This notion was first studied systematically by Downey and Fellows [2]. The main idea of parameterized complexity is to equip the instance of a problem with a positive integer parameter and confine the superpolynomial behaviour of an algorithm to this parameter—which means that we want to efficiently solve large instances of the problem as long as the value of the parameter is small.

Parameterized complexity. More formally, an instance of a parameterized problem is a pair (Ik) where \(k\in {\mathbb {N}}\). We say that parameterized problem is in class XP if for every k there is an algorithm that solves that problem in time \({\mathcal {O}}\left( |I|^{f(k)}\right) \), for some function f (which does not depend on I). One example of a problem which naturally can be considered as a parameterized problem in the XP class is the Clique problem parameterized by the size of the clique. The problem is defined as follows: given (Gk) where G is a graph and k is a natural number, can we decide if there is a clique of size k in G? One can simply enumerate all k-subsets of vertices to solve the problem in time \({\mathcal {O}}(n^{k+2})\). That is, for every fixed k, the time complexity of this algorithm grows polynomially with the input size.

Much more desirable parameterized complexity class is FPT. A parameterized problem is called fixed parameter tractable (FPT) if there is an algorithm which solves every parameterized instance (Ik) of the problem in time \({\mathcal {O}}(f(k) |I|^c)\) for some function f (that does not depend on |I|) and some constant c. That is, for a fixed value of the parameter k, the problem is solvable in polynomial time and the degree of this polynomial does not depend on the value of the parameter k. Simple example of a problem which naturally fits in the class FPT is the Satisfability problem of boolean formulae, if we consider it as a problem parameterized by number of variables. Brute force algorithm solves this problem in time \({\mathcal {O}}(2^k m)\) where m is the size of the instance.

In their monograph Downey and Fellows [2], included a list of open problems, asking whether they admit an FPT solution (“FPT suspects”) or are hard by means of parameterized complexity (“tough customers”). Recently, Fomin and Marx have revised this list of problems [3]. Many of the problems from the original list have been solved since the publication of [2], yet Chain minor remains open. It was listed as a “tough customer”—category of problems suspected to not admit a fixed parameter tractable solution. In this paper we prove that such a solution is possible.

Chain minors. Chain minors were introduced by Möring and Müller [6] in the context of scheduling stochastic project networks and first studied systematically by Gustedt [4] and in his Ph.D. thesis [5]. Gustedt proved that finite posets are well quasi ordered by chain minors, that is, in any infinite sequence of posets there is a pair of posets such that one is a chain minor of the other. A consequence of this fact is that any class of posets closed under taking chain minors can be characterized by a finite family of minimal forbidden posets.

The Chain minor problem is to decide, given two posets P and Q, whether P is a chain minor of Q. The parameterized approach to Chain Minor is justified as Gustedt showed in [4] that Chain Minor is NP-hard (giving a reduction from Precendence Constrained Scheduling). Note that it is not known whether Chain Minor is NP-complete. There is no obvious nondeterministic polynomial-time algorithm for that problem, except for a very simple case—Gustedt in his Ph.D. thesis has proved that Chain Minor is NP-complete when restricted to posets of height at most 3.

Our results. Gustedt also gave an XP algorithm for the Chain Minor problem [5]. More specifically, he gave an algorithm that checks whether P is a chain minor of Q in time \({\mathcal {O}}(|P|^2 |Q|^{|P|} + f(|P|))\). We improve his result, giving two fixed parameter tractable algorithms (parameterized by |P|)—randomized and deterministic—where the former runs in \({\mathcal {O}}\left( f(|P|) |Q|\right) \) time and the latter in \({\mathcal {O}}\left( f(|P|) |Q| \log |Q|\right) \) time.

The technique that we use to design the FPT algorithm is called color coding and was originally developed by Alon et al. [1] to give the first FPT algorithm for the k-Path problem (finding a simple path of size k in a given graph). Since then, this technique has been successfully applied many to many problems, yet in most of those examples colors were introduced artificially (as in k-Path). In our case, they are naturally derived from the problem definition.

The deterministic algorithm is obtained from a randomized algorithm using black-box derandomization method for color-coding algorithms called splitters. In particular we will invoke a result by Naor et al. [7].

2 Definitions and Basic Facts

Definition 1

We say that binary relation R is transitive, if and only if

$$\begin{aligned} \forall _{a,b,c \in S} (a R b) \wedge (b R c) \implies (a R c) \end{aligned}$$

We say that binary relation R is irreflexive if and only if

$$\begin{aligned} \forall _{a \in S} \lnot (a R a). \end{aligned}$$

Finally binary relation R is called antisymmetric if and only if

$$\begin{aligned} \forall _{a\not = b\in S} (a R b) \implies \lnot (b R a) \end{aligned}$$

Definition 2

A finite partially ordered set (poset) is a pair \((V, <)\) where V is a finite set and < is a binary relation on V that is transitive, irreflexive, and antisymmetric. A chain in a poset is a sequence of elements \((v_1, v_2, \ldots v_n)\), \(v_i \in V\) such that \(v_i < v_j\), for all \(1 \le i < j \le n\).

A partial function from X to Y is a function defined on a subset of X with values in Y. For a (partial) function \(f: X \rightarrow Y\) and a set \(X^{\prime } \subset X\), we will write \(f|_{X^{\prime }}\) to denote restriction of f to \(X^{\prime }\).

Definition 3

(Lifting). Given two posets \(P = (V_P, <_P)\), \(Q = (V_Q, <_Q)\) and a partial function \(f{:} V_Q \longrightarrow V_P\), we say that a chain \(C = (c_1, c_2, \ldots c_n)\) in P can be lifted to Q with respect to f, if there is a chain \((c_1^{\prime }, c_2^{\prime }, \ldots c_n^{\prime })\) in Q, such that f restricted to \(C^{\prime }\) induces an isomorphism between C and \(C^{\prime }\).

Definition 4

(Chain minor). Given two finite posets \(P=(V_P, <_P)\) and \(Q=(V_Q, <_Q)\), we say that P is a chain minor of Q (\(P \preceq Q\)) if and only if there exists a partial function \(f: V_Q \longrightarrow V_P\) such that every chain in P can be lifted to a chain Q. In this case, we call f a witness for \(P \preceq Q\) and we write \(P \preceq ^f Q\).

Remark 1

It is easy to check that \(\preceq \) is a quasi-order (transitive and antisymmetric).

Remark 2

Observe that if \(V_P \subseteq V_Q\) and \(<_P\) is induced by \(<_Q\) (that is, P is subposet of Q), then P is also a chain minor of Q, as witnessed by a partial function \(f{:} V_Q \longrightarrow V_P\) defined only on \(V_P \subset V_Q\), and maps each element \(v \in V_P\) to itself.

3 Algorithm

Our goal is to present a deterministic FPT algorithm deciding whether P is a witness of Q. We will start with a randomized algorithm and use a standard technique (of so called splitters) to derandomize it at the price of slightly worse time complexity. Before we proceed with the algorithm, let us prove few auxiliary lemmas.

Lemma 1

There is a deterministic algorithm which, given two posets P and Q and a partial function \(f: V_Q \longrightarrow V_P\), determines whether \(P \preceq ^f Q\). The algorithm runs in time \({\mathcal {O}}(2^{|P|} |Q|)\).

Proof

According to the definition of \(P \preceq ^f Q\), it is enough to check for each chain C in P, whether it lifts to Q. Note that the number of chains in P is upper bounded by \(2^{|V_P|}\)—a chain is uniquely determined by its set of elements. In order to deduce the conclusion of the lemma, it is enough for us to provide a linear (in the size of poset Q) algorithm deciding whether a given chain \(C=(c_1, c_2, \ldots c_n)\) can be lifted to Q with respect to given function f.

We propose a dynamic programming algorithm to solve that problem. For \(q \in V_Q\), let \({\mathrm {pred}}{(q)}\) be a set of all elements in \(V_Q\) smaller or equal than q. Now, for every element q, let \(\mathrm {maxc}(q)\) be the largest value k such that chain \((c_1, \ldots c_k)\) can be lifted to \({\mathrm {pred}}{(q)}\) (or zero if it does not exist). Observe that if we know value of \(\mathrm {maxc}\) for each predecessor of q, we can compute value of \(\mathrm {maxc}(q)\) by

$$\begin{aligned} \mathrm {maxc}(q) = \left\{ \begin{array}{ll} j &{} \quad \mathrm {if} \max _{v<q} \mathrm {maxc}(v) = j-1 \wedge f(q)=c_j \\ \max _{v<q} \mathrm {maxc}(v) &{} \quad \mathrm {otherwise} \end{array}\right. \end{aligned}$$

Therefore, to calculate value of \(\mathrm {maxc}\) for all elements \(q \in Q\), we can start by finding a topological ordering of elements of Q, and then visit elements of the poset Q in this order, populating a table \(\mathrm {maxc}\) according to the formula above.

Finally, chain C can be lifted to Q with respect to f if and only if there exist an element of q with \(\mathrm {maxc}(q) = n\). \(\square \)

Lemma 2

Let P and Q be finite posets such that \(P \preceq ^f Q\) and let k be a number of elements in P. There exist a subposet \(Q^0\) of Q of with at most \(2^k k\) elements, such that for every \(f^{\prime }\) which is equal to f when restricted to \(Q^0\), we have \(P \preceq ^{f\prime } Q\).

Proof

Take \({\mathcal {C}}\) to be a family of all chains in P. Observe that the size of the family \({\mathcal {C}}\) is at most \(2^k\), because any chain in P is determined by its set of elements. For every chain \(C = (c_1, \ldots , c_{n_C})\in {{\mathcal {C}}}\), take an arbitrary lifting \(C^{\prime } = \left( c^{\prime }_1, \ldots , c^{\prime }_{n_c}\right) \) of this chain to Q. Now let \(V_{Q^0}\) be \(\bigcup _{C \in {{\mathcal {C}}}} \left\{ c^{\prime }_1, c^{\prime }_2, \ldots , c^{\prime }_{n_C}\right\} \). Notice that \(|V_{Q^0}| \le \sum _{C \in {{\mathcal {C}}}} n_c \le \sum _{c \in {{\mathcal {C}}}} k \le 2^k k\).

For a function \(f^{\prime }\) which is equal to f on \(Q^0\), in order to show that \(P \preceq ^{f\prime } Q\), we have to check that every chain in P lifts to Q with respect to \(f^{\prime }\). Indeed, given a chain \((c_1, c_2, \ldots c_{n_C})\) in P it suffices to take elements \(c^{\prime }_i\) described above; they belong to \(Q^0\) by definition, thus \(f^{\prime }(c^{\prime }_i) = f(c^{\prime }_i) = c_i\) for \(i=1, \ldots , n_c\), because \(f^{\prime }\) is assumed to be equal to f on \(Q_0\), hence \(c^{\prime }_1, \ldots , c^{\prime }_n\) is a lift of a chain C with respect to \(f^{\prime }\). \(\square \)

3.1 Randomized Algorithm

Now we will state and prove a key lemma for Theorem 1.

Lemma 3

If \(P \preceq Q\), then a function \(g: V_Q \longrightarrow V_P\) taken uniformly at random from the set of all such functions is a witness for \(P \preceq Q\) with probability at least \(k^{-2^k k}\), where \(k = |P|\).

Proof

Let f be a witness for \(P \preceq Q\), and take \(Q^0\) as in Lemma 2. It follows from Lemma 2 that it is sufficient to show that a function g taken uniformly at random is equal to f on \(Q^0\) with probability at least \(k^{-2^k k}\). Now the lemma follows from the following simple calculation.

$$\begin{aligned} {\mathbb {P}}(P \preceq ^g Q)\ge & {} {\mathbb {P}}\left( g|_{Q^0} = f|_{Q^0}\right) \\= & {} \prod _{v\in Q^0} {\mathbb {P}}(g(v) = f(v)) \\= & {} \prod _{v\in Q^0} \frac{1}{k} \\\ge & {} k^{-2^k k}. \end{aligned}$$

\(\square \)

Now we are ready to prove Theorem 1.

Theorem 1

There is a randomized algorithm for Chain Minor with time complexity \({\mathcal {O}}\left( {|P|}^{2^{|P|} {|P|}} 2^{|P|} |Q|\right) \) and linear space complexity.

Proof

Let \(k = |P|\). It is enough to repeat the following procedure \(k^{2^k k}\) times: take a random function g and check whether it is a witness for \(P \preceq Q\). If any of those function is a witness, return Yes; otherwise, return No. The desired time and space complexity follow from Lemma 1. Lemma 3 bounds the probability of an error by a constant. Indeed, if \(P\preceq Q\), then the probability that the algorithm answers No is not greater then \((1 - 1{/}p_k)^{p_k}\), where \(p_k = k^{2^k k}\), which is bounded by \((1 - 1{/}2)^2\), for \(k\ge 2\) (and tends to 1 / e as k tends to infinity). \(\square \)

3.2 Deterministic Algorithm

We will derandomize the algorithm from Theorem 1 using a well-known derandomization technique for color coding method, called splitters. A (nkl)-splitter is a family of functions \({\mathcal {F}}\), \({\mathcal {F}} \ni f{:} \{1, \ldots n \} \longrightarrow \{1, \ldots , l\}\), such that for every \(W\subseteq \{1\ldots n\}\) of size at most k there is some function \(f\in {\mathcal {F}}\) which is injective on W. We will need the following theorem by Naor, Schulman, and Srinivasan from [7].

Theorem 2

([7]) There exists a (nkk)-splitter that can be constructed in time \({\mathcal {O}}(e^k k^{{\mathcal {O}}(\log k)} \log n)\).

Theorem 3

There exist a deterministic algorithm for Chain Minor with time complexity \({\mathcal {O}}\left( |P|^{2^{|P|}|P|} 2^{|P| + {\mathcal {O}}(\log ^2{|P|})} |Q| \log |Q|\right) \).

Proof

Given P and Q, let us take \(k=|P|\), \(n=|Q|\). Fix a bijection between \(\{1\ldots n\}\) and \(V_Q\). Let us fix a \(\left( n, 2^k k, 2^k k\right) \)-splitter, and iterate through every function from that splitter and every function from the set \(\{1, \ldots , 2^k k\}\) to P. Then check whether the composition of these two functions is a witness for \(P \preceq Q\).

To prove correctness of the algorithm, let us consider \(P \preceq ^f Q\) and take \(Q^0\) as in Lemma 2. It follows from the definition of splitters that there exists a function f, such that f is injective on \(Q^0\). Then, just because we iterate over all functions from the set \(\{ 1, \ldots k 2^k\}\) to P at some point we take one, such that the composition equals f when restricted to \(Q^0\). This pair yields a witness for \(P \preceq Q\). \(\square \)

4 NP-Hardness of Chain Minor

The NP-hardness of Chain minor problem is long known due to Gustedt, and the problem remains NP-hard even if the height of P and Q is restricted to 3, and in fact any constant \(c \ge 3\). His original proof was based on a nontrivial theorem of independent interest that if Q is an interval order (i.e. finite poset of intervals on real line, partially ordered by the relation \([a,b]< [c,d] \iff b < c\)), then any P is a chain minor of Q if and only if P is subposet of Q. Note that this result rules out even an XP solution for Chain minor when parameterized by height of P (unless \(P=NP\)).

Fig. 1
figure 1

The left poset P is a chain minor of the right poset Q as certified by the witness function from the elements of the Q to the elements of P. The labels on the nodes are used to describe a witness function from Q to P—for example nodes with labels 0 and 3 in the right poset are being mapped by a witness function to a node with label (0, 3) in the left poset. The arrows are used to present comparisons between elements within each poset. For clarity, on the diagram we omit comparisons which could be deduced by transitivity of a partial order

This leaves open the case when height of P is restricted to be 2—and one could expect polynomial algorithm for this special case. Note that for P of height 1 the problem is trivial. Simplifying the original proof, we give a direct reduction from the Clique problem (Fig. 1).

Theorem 4

Chain minor problem is NP-hard, even if the height of target poset P is restricted to two, and host poset Q is restricted to three.

Proof

Given an instance (Gk) of the Clique problem, we will generate an equivalent instance (PQ) of the Chain minor problem, such that P is of height 2 and Q is of height 3.

Given a graph \(G=(V, E)\) and \(k\in {\mathbb {N}}\) we want to produce two posets P and Q such that \(P \preceq Q\) if and only if G contains clique of size k. Let \(V = \{v_1, \ldots , v_n\}\) and \(E = \{ e_1, \ldots , e_m\}\). Now P will be a poset with two layers: \(V_P = \{ p^1_i{:} i \in \{1, \ldots , n \}\} \cup \{p^2_i : i \in \{ 1, \ldots , m\}\}\), such that \(p^1_i <_P p^2_j \iff v_i \text{ is } \text{ incident } \text{ with } e_j\) and there are no other relations. Poset Q will have three layers: \(V_Q = \left\{ q^1_i : i \in \left\{ 1, \ldots , k \right\} \right\} \cup \left\{ q^2_i : i \in \left\{ 1, \ldots , {k\atopwithdelims ()2} + (n - k)\right\} \right\} \cup \left\{ q^3_i : i \in \left\{ 1, \ldots , m - {k \atopwithdelims ()2}\right\} \right\} \). That is, the first layer is of size k, the second of size \({ k \atopwithdelims ()2 } + n - k\), and the third of size \(m - { k \atopwithdelims ()2 }\). The order in Q is given by \(p^{i_1}_{j_1}<_Q p^{i_2}_{j_2} \iff i_1 < i_2\). For \(s \in \{1,2,3\}\) let \(L_s\) be the subset of \(V_Q\) corresponding to layer s. The produced gadget is schematically presented on Fig. 2.

We need to prove that P is a chain minor of Q if and only if G has a clique of size k. Let us first assume that G indeed has a clique of size k. We want to show a witness f for \(P \preceq ^f Q\). We take f mapping elements \(q^1_i\) to elements in P corresponding to the vertices of the clique. In the second layer we have \({ k \atopwithdelims ()2 } + (n - k)\) elements—we map \({ k \atopwithdelims ()2 }\) of them to those elements of P corresponding to edges of clique and \((n-k)\) of them to the rest of vertices of G. Elements from the third layer are mapped to those which correspond to the edges not inside the clique, i.e. the edges with at least one endpoint outside of the clique.

Fig. 2
figure 2

Reduction from clique to chain minor. Graph on the top of a figure, as an instance of 3-clique problem is transformed to a pair of posets P and Q with 2 and 3 layers, accordingly. Top layer of poset P corresponds to vertices of G, and bottom layer corresponds to edges of G

We will prove that function specified in the previous paragraph is indeed a witness for \(P \preceq Q\). By the definition of chain minor relation, we need to show that each chain in P lifts Q. Every chain in P is of form \(p^1_i < p^2_j\), where \(i\in [n]\) is index of some vertex in G, and j is index of an edge incident to that vertex. There are two cases: either j is an edge inside clique, then \(f^{-1}\left( p^2_j\right) \in L_2\) and \(f^{-1}\left( p^1_i\right) \in L_1\), or j is incident to at least one vertex outside of the clique, in which case \(f^{-1}\left( p^2_j\right) \in L_3\), and \(f^{-1}\left( p^1_i\right) \in L_1 \cup L_2\). In both cases chain \(p^1_i < p^2_j\) is lifted to a chain in Q with respect to f.

For the other direction assume that we have \(P \preceq ^f Q\)—we want to show that G contains a clique of size k. Note that as \(|V_P| = |V_Q|\), a witness f must in fact be a bijection (it always is a surjection). There are only \(m - {k \atopwithdelims ()2 }\) elements in the third layer of Q, so at least \({ k \atopwithdelims ()2 }\) of elements \(p^2_j\) corresponding to edges of G must have their preimage in first or second layer. We will show that those elements correspond to edges of a clique in G. Indeed, let \(F = \left\{ e_j : f^{-1}\left( p^2_j\right) \in L_1 \cup L_2\right\} \), and let K be a set of vertices incident to edges in F. We know that \(|F| \ge {k \atopwithdelims ()2}\). On the other hand, consider any vertex \(v_i \in K\) incident to an edge in F, say \(v_i \in e_j\) for some j. We know that a chain \(p^1_i < p^2_j\) is lifted to Q via \(f^{-1}\), and we know that \(f^{-1}\left( p^2_j\right) \in L_1 \cup L_2\)—we deduce that \(f^{-1}\left( p^2_j\right) \in L_2\) and \(f^{-1}\left( p^1_i\right) \in L_1\). It means that function \(f^{-1}\) yields an injection from K to \(L_1\). According to our construction \(|L_1|=k\), hence \(|K| \le k\). We have a set K of at most k vertices in G, and such that there is at least \({k \atopwithdelims ()2}\) edges in a graph induced by K—this set must form a clique of size exactly k in G. \(\square \)

5 Conclusions

  1. 1.

    It is easy to prove that every class \({\mathcal {S}}\) of posets closed under taking chain minors can be characterized by a set \({\mathcal {F}}_{{\mathcal {S}}}\) of minimal forbidden chain minors, in a sense that a poset \(P \in {\mathcal {S}}\) if and only if it does not contain any poset from \({\mathcal {F}}_{{\mathcal {S}}}\) as a chain minor. Gustedt proved in [5] that posets are well quasi ordered by a chain minor relation, consequently, every such set \({\mathcal {F}}_{{\mathcal {S}}}\) of forbidden chain minors is finite. Gustedt also gave an XP algorithm to decide whether a poset H is a chain minor of a poset Q when parameterized by the number of elements of H. These two results show that for every class of posets \({{\mathcal {P}}}\) closed under taking chain minors there exists a polynomial-time algorithm deciding whether the input poset Q is in \({{\mathcal {P}}}\) (the exponent of the polynomial depends on the class).

    We give an FPT algorithm to test whether a poset H is a chain minor of a poset Q when parameterized by the number of elements of H. A consequence of our result is that for every class of posets \({{\mathcal {P}}}\) closed under taking chain minors there exists a \({\mathcal {O}}(|Q| \log |Q|)\) algorithm deciding whether the input poset Q is in \({{\mathcal {P}}}\).

  2. 2.

    The project of graph minors of Robertson and Seymour is arguably one of the most significant achievements in modern graph theory. Robertson and Seymour proved that graphs are well quasi ordered under graph minors and gave an FPT algorithm to decide whether a graph H is a minor of a graph G when parameterized by H. They were also able to describe the structure of graphs that do not contain a fixed graph as a minor.

    Is there a parallel theory possible for chain minors in posets? Gustedt proved in [5] that chain minors are well quasi ordered and this work gives an FPT algorithm for the Chain Minor problem. However, neither of the two elucidates the structure of posets with a forbidden chain minor. Is a structural characterization possible?

    In particular, it looks like the characterization of posets without \(p C_q\) as a chain minor is already a challenge (\(p C_q\) is a poset consisting of p disjoint chains each on q vertices). Note that any poset of size p and height q is a chain minor of \(2^p C_q\). It is also quite straightforward that posets without \(C_q\) chain minor are just posets of height less then q but even a characterization of posets without \(2C_q\) as a chain minor seems elusive.

  3. 3.

    What can we say about complexity of the Chain minor problem? It would be particularly interesting to see that it is \(\varSigma ^P_2\)-complete, as the number of known complete problems for this class is relatively small—especially when compared to a huge number of NP-complete problems. Nevertheless even the proof that this problem is co-NP-hard would be valuable as well—such a proof, together with a known NP-hardness, would give a strong argument that this problem in fact is neither in NP nor in co-NP.

  4. 4.

    Finally, both our algorithms are double exponential in the parameter. Could this be improved to get a single exponential dependence?