DeepAI

# Contracting to a Longest Path in H-Free Graphs

We prove two dichotomy results for detecting long paths as patterns in a given graph. The NP-hard problem Longest Induced Path is to determine the longest induced path in a graph. The NP-hard problem Longest Path Contractibility is to determine the longest path to which a graph can be contracted to. By combining known results with new results we completely classify the computational complexity of both problems for H-free graphs. Our main focus is on the second problem, for which we design a general contractibility technique that enables us to reduce the problem to a matching problem.

• 6 publications
• 54 publications
05/28/2020

### Computing Subset Transversals in H-Free Graphs

We study the computational complexity of two well-known graph transversa...
02/25/2021

### Generalized Parametric Path Problems

Parametric path problems arise independently in diverse domains, ranging...
04/12/2001

### Extremal Optimization for Graph Partitioning

Extremal optimization is a new general-purpose method for approximating ...
08/03/2022

### A Multi-Threading Algorithm for Constrained Path Optimization Problem on Road Networks

The constrained path optimization (CPO) problem takes the following inpu...
12/22/2022

### Parameterizing Path Partitions

We study the algorithmic complexity of partitioning the vertex set of a ...
10/24/2022

### Path association rule mining

Graph association rule mining is a data mining technique used for discov...
09/12/2019

### Optimal Routing Schedules for Robots Operating in Aisle-Structures

In this paper, we consider the Constant-cost Orienteering Problem (COP) ...

## 1 Introduction

The Hamiltonian Path problem, which is to decide if a graph has a hamiltonian path, is one of the best-known problems in Computer Science and Mathematics. A more general variant of this problem is that of determining the length of a longest path in a graph. Its decision version Longest Path is equivalent to deciding if a graph can be modified into the -vertex path for some given integer  by using vertex and edge deletions. Note that an alternative formulation of Hamilton Path is that of deciding if a graph can be modified into a path (which must be ) by using only edge deletions. As such, these problems belong to a wide range of graph modification problems where we seek to modify a given graph  into some graph  from some specified family of graphs by using some prescribed set of graph operations. As Hamiltonian Path is NP-complete (see [18]), Longest Path is NP-complete as well. The same holds for the problem Longest Induced Path [18], which is to decide if a graph  contains an induced path of length at least , that is, if can be modified into a path  for some given integer  by using only vertex deletions.

Here we mainly focus on the variant of the above two problems corresponding to another central graph operation, namely edge contraction. This variant plays a role in many graph-theoretic problems, in particular Hamilton Path [31, 32]. The contraction of an edge  of a graph  deletes the vertices and and replaces them by a new vertex made adjacent to precisely those vertices that were adjacent to  or  in  (without introducing self-loops or multiple edges). A graph  contains a graph  as a contraction if  can be modified into  by a sequence of edge contractions.

.99 Longest Path Contractibility

[1pt]     Instance: a connected graph and a positive integer . Question: does contain as a contraction?

The Longest Path Contractibility problem is NP-complete as well [9]. Due to the computational hardness of Longest Path, Longest Induced Path and Longest Path Contractibility it is natural to restrict the input to special graph classes. We briefly discuss some known complexity results for the three problems under input restrictions.

A common property of most of the studied graph classes is that they are hereditary, that is, they are closed under vertex deletion. As such, they can be characterized by a family of forbidden induced subgraphs. In particular, a graph is -free if it does not contain a graph  as an induced subgraph, and a graph class is monogenic if it consists of all -free graphs for some graph . Hereditary graph classes defined by a small number of forbidden induced subgraphs, such as monogenic graph classes, are well studied, as evidenced by studies on (algorithmic and structural) decomposition theorems (e.g. for bull-free graphs [11] or claw-free graphs [12, 30]) and surveys for specific graph problems (e.g. for Colouring [21, 47]).

All the known NP-hardness results for Hamiltonian Path carry over to Longest Path. For instance, it is known that Hamiltonian Path is NP-complete for chordal bipartite graphs and strongly chordal split graphs [46], line graphs [5] and planar graphs [19]. Unlike for Hamiltonian Path, there are only a few hereditary graph classes for which the Longest Path problem is known to be polynomial-time solvable; see, for example [49]. In particular, Longest Path is polynomial-time solvable for circular-arc graphs [44], distance-hereditary graphs [24], and cocomparability graphs [35, 45]. The latter result generalized the corresponding results for bipartite permutation graphs [50] and interval graphs [34]. The few graph classes for which the Longest Induced Path problem is known to be polynomial-time solvable include the classes of -chordal graphs [20, 36], AT-free graphs [39], graphs of bounded clique-width [13] (see also [39]) and graphs of bounded mim-width [37]. Finding a longest induced path in an -dimensional hypercube is known as the Snake-in-the-Box problem [38], which has been well studied.111The complexity status of Snake-in-the Box is still open. A table of world records for small values of can be found at http://ai1.ai.uga.edu/sib/sibwiki/doku.php/records.

Unlike the Longest Path and Longest Induced Path problems, Longest Path Contractibility is NP-complete even for fixed  (that is,  is not part of the input). In order to explain this, let -Contractibility be the problem of deciding if a graph  contains some fixed graph  as a contraction. The complexity classification of -Contractibility is still open (see [9, 40, 41, 51]), but Brouwer and Veldman [9] showed that already -Contractibility and -Contractibility are NP-complete (where denotes the -vertex cycle). In fact, -Contractibility problem is NP-complete even for -free graphs [52], whereas Heggernes et al. [28] showed that -Contractibility is NP-complete for bipartite graphs.222In [28], the problem is equivalently formulated as a graph modification problem: can a graph be modified into a graph  from some specified family  by using at most edge contractions for some given integer ? We refer to for instance [1, 2, 3, 4, 10, 15, 22, 23, 27, 29, 42, 43, 53, 54], for both classical and fixed-parameter tractibility results for various families  including the family of paths, which form the focus in this paper. The latter result was improved to in [14]. Moreover, -Contractibility is NP-complete for line graphs [16]. Hence, Longest Path Contractibility is NP-complete for all these graph classes as well. On the positive side, Longest Path Contractibility is polynomial-time solvable for -free graphs [52].

Our interest in the Longest Induced Path problem also stems from a close relationship to a vertex partition problem, which played a central role in the graph minor project of Robertson and Seymour [48], as we will explain.

### Our Results

We first give a dichotomy for Longest Induced Path using known results for Hamiltonian Path and some straightforward observations (see Section 2 for a proof). Our main result is a dichotomy for Longest Path Contractibility. We use ‘+’ to denote the disjoint union of two graphs, and a linear forest is the disjoint union of one or more paths.

###### Theorem 1.1

Let be a graph. If is a linear forest, then Longest Induced Path restricted to -free graphs is polynomial-time solvable; otherwise it is NP-complete.

###### Theorem 1.2

Let be a graph. If is an induced subgraph of , , or for some , then Longest Path Contractibility restricted to -free graphs is polynomial-time solvable; otherwise it is NP-complete.

Theorem 1.2 shows that Longest Path Contractibility is polynomial-time solvable for -free graphs only for some specific linear forests . This is in contrast to the situation for Longest Induced Path, as shown by Theorem 1.1. To extend the aforementioned results from [14, 16, 28, 52] for Longest Path Contractibility to the full classification given in Theorem 1.2 we do as follows.

First, in Section 3, we prove the four new polynomial-time solvable cases of Theorem 1.2. In each of these cases is a linear forest, and proving these cases requires the most of our analysis.333This is in line with research for other graph problems restricted to -free graphs. In fact, classes of -free graphs, where is a linear forest are still poorly understood. There is a whole range of graph problems, e.g. Independent Set, -Colouring, Feedback Vertex Set, Odd Cycle Transversal, and Dominating Induced Matching, for which it is not known if they are NP-complete on -free graphs for some integer , such that they are NP-complete on -free graphs (see [7]). Every linear forest  is -free for some suitable value of and -free graphs do not contain as a contraction. Hence, it suffices to prove that for each , the -Contractibility problem is polynomial-time solvable for -free graphs for each of the four linear forests listed in Theorem 1.2. In fact, as -Contractibility is trivial, we only have to consider the cases where . Our general technique for doing this is based on transforming an instance of -Contractibility for into a polynomial number of instances of -Contractibility until .

For we cannot apply this transformation, as this case - as we outline below - is closely related to the -Disjoint Connected Subgraphs problem. This problem takes as input a triple , where is a graph with two disjoint subsets  and  of . It asks if  has a partition into sets  and , such that and induce connected subgraphs of . Robertson and Seymour [48] proved that the more general problem -Disjoint Connected Subgraphs (for subsets ) is polynomial-time solvable as long as the union of the sets has constant size.444If every has size 2, then we obtain the well-known -Disjoint Paths problem. However, in our context, and may have arbitrarily large size. In that case, -Disjoint Connected Subgraphs is NP-complete even if (and only is large) [52].

To work around this obstacle, we use the fact [52] that the two outer vertices of the , to which the input graph  must be contracted, may correspond to single vertices  and  of . We then “guess” and to obtain an instance of -Disjoint Subgraphs. That is, we seek for a partition of into sets and , such that and are connected. The latter implies that we can contract these two sets to single vertices corresponding to the two middle vertices of the .

After guessing and we exploit their presence, together with the -freeness of , for an extensive analysis of the structure of and of a potential solution . To this end we introduce in Section 3.1 some general terminology and first show how to check in general for solutions in which the part of or that ensures connectivity of or , respectively, has bounded size. We call such solutions constant. If we do not find a constant solution, then we exploit their absence. For the more involved cases we show that in this way we can branch to a polynomial number of instances of a standard matching problem.

In Section 4 we prove the new NP-completeness results. In particular, we prove that -Contractibility, for some suitable value of , is NP-complete for bipartite graphs of large girth, strengthening the known result for bipartite graphs of [28].

In Section 5 we show how to combine our new polynomial-time and NP-hardness results with the known NP-completeness results for -free graphs [16] and -free graphs [52] in order to obtain Theorem 1.2.

In Section 6, we briefly discuss the cycle variant of our problem, called the Longest Cycle Contractibility problem [6, 25, 26]. Its complexity classification for -free graphs is still incomplete, but we show that it differs from the classification of Longest Path Contractibility for -free graphs.

In Section 7 we pose some open problems. In particular, the complexity classification of Longest Path is still open for -free graphs, and we describe the state-of-art for this problem.

## 2 Preliminaries

In Section 2.1 we give some general graph-theoretic terminology and a helpful lemma for -free graphs. In Section 2.2 we give a short proof of Theorem 1.1. In Section 2.3 we give some terminology related to edge contractions.

### 2.1 General Terminology and a Lemma for P4-Free Graphs

We consider finite undirected graphs with no self-loops. Let be a graph. Let . Then denotes the subgraph of induced by . We say that is connected if is connected. We may write . The neighbourhood of is the set and the closed neighbourhood is . The length of a path  is its number of edges. The distance between vertices and is the length of a shortest path between them. Two disjoint sets are adjacent if there is at least one edge between them; and  are (anti)complete to each other if every vertex of is (non)adjacent to every vertex of . The set  covers if every vertex of has a neighbour in . The subdivision of an edge  in replaces by a new vertex and two new edges and .

A graph is -free for some other graph  if does not contain as an induced subgraph. For a set of graphs, is -free if is -free for . A graph is complete bipartite if it consists of a single vertex or its vertex set can be partitioned into two independent sets and that are complete to each other. The claw is the complete bipartite graph with and . The graph  is the complete graph on vertices.

The disjoint union of two vertex-disjoint graphs  and  is the graph ; the disjoint union of  copies of a graph  is denoted . A forest is a graph with no cycles. A linear forest is a forest of maximum degree at most 2, that is, a disjoint union of one or more paths. The join operation  adds an edge between every vertex of and every vertex of . A graph is a cograph if can be generated from by a sequence of join and disjoint union operations. A graph is a cograph if and only if it is -free (see, e.g., [8]). The following well-known lemma follows from this fact and the definition of a cograph. In particular, to prove that a connected -free graph  has a spanning complete bipartite graph with partition classes and , we can do as follows: take the complement of and put the vertex set of one connected component of  in  and all the other vertices of in .

###### Lemma 1

Every connected -free graph on at least two vertices has a spanning complete bipartite subgraph, which can be found in polynomial time.

We remind the reader of the following notions.The girth of a graph that is not a forest is the number of vertices in a shortest induced cycle of . The line graph of a graph has as vertex set and there is an edge between two vertices and of if and only if and have a common end-vertex in . Every line graph is readily seen to be -free.

### 2.2 The Proof of Theorem 1.1

We now present a short proof for Theorem 1.1. We start with the following lemma.

###### Lemma 2

Let be some constant. Then Longest Induced Path is NP-complete for graphs of girth at least .

###### Proof

We reduce from Hamiltonian Path. Let be a graph on vertices. We subdivide each edge  of exactly once and denote the set of new vertices by . We denote the resulting graph by and note that is bipartite with partition classes and . We claim that has a Hamiltonian path if and only if has an induced path of length .

First suppose that has a Hamiltonian path . Then the path on vertices is an induced path of length  in . Now suppose that has an induced path of length . Then either starts and finished with a vertex of , or starts and finishes with a vertex of . In the first case contains vertices of , so contains all vertices of , say in this order. Then is a Hamiltonian path of . In the second case contains vertices of , say vertices in that order. As is an induced path and vertices of are only adjacent to vertices of , this means that the end-vertices of are both adjacent to . Hence, we find that is a Hamiltonian path of (and the same holds for ).

We note that the girth of is twice the girth of . Hence, we obtain the result by applying this trick sufficiently many times. ∎

We also need the following lemma.

###### Lemma 3

The Longest Induced Path problem is NP-complete for line graphs.

###### Proof

We reduce from Hamiltonian Path. Let be a graph on vertices. We construct the line graph of . We claim that has a Hamiltonian path if and only if has an induced path on vertices. First suppose that is a Hamiltonian path in . Then the edges of form an induced path of length in . Now suppose that has an induced path  on vertices. Let be the edges of in that order. As is induced in , no two edges and with have a vertex in common unless . Hence, must be a Hamiltonian path in . ∎

We are now ready to prove Theorem 1.1.

Theorem 1.1. (restated) Let be a graph. If is a linear forest, then Longest Induced Path restricted to -free graphs is polynomial-time solvable; otherwise it is NP-complete.

###### Proof

Let be an -free graph. First suppose that is a linear forest. Then there exists a constant  such that is an induced subgraph of . This means that the length of a longest induced path of is at most . Hence, we can determine a longest path in in time by brute force.

Now suppose that is not a linear forest. First assume that contains a cycle. Let be the girth of . We set . Then the class of -free graphs contains the class of graphs of girth at least . Hence, we can use Lemma 2 to find that Longest Induced Path is NP-complete for -free graphs. Now assume that contains no cycle. As is not a linear forest, must be a forest with at least one vertex of degree at least 3. Then the class of -free graphs contains the class of -free graphs. Recall that every line graph is -free. Hence, the class of line graphs is contained in the class of -free graphs. Then we can use Lemma 3 to find that Longest Induced Path is NP-complete for -free graphs. ∎

### 2.3 Terminology Related to Edge Contractions

Recall that the contraction of an edge  of a graph  is the operation that deletes and from and replaces them by a new vertex made adjacent to precisely those vertices that were adjacent to  or  in  (without introducing self-loops or multiple edges). We denote the graph obtained from a graph by contracting by . We may denote the resulting vertex by (or ) again and say that we contracted on  (or  on ).

Recall also that a graph contains a graph as a contraction if can be modified into via a sequence of edge contractions. Alternatively, a graph  contains a graph  as a contraction if and only if for every vertex  there exists a nonempty subset of vertices in  such that:

• is connected;

• the set is a partition of ; and

• for every , and  are adjacent in if and only if  and  are adjacent in .

By contracting the vertices in each  to a single vertex we obtain the graph . The set  is called an -witness bag of  for . The set  is called an -witness structure of  (which does not have to be unique). A pair of (non-adjacent) vertices of a graph  is -suitable for some integer if and only if  has a -witness structure  with and , where ; see Figure 1 for an example.

The following known lemma shows why -suitable pairs are of importance.

###### Lemma 4 ([52])

For , a graph  contains as a contraction if and only if  has a -suitable pair.

Lemma 4 leads to the following auxiliary problem, where is a fixed integer, that is, is not part of the input.

.99 -Suitability

[1pt]     Instance: a connected graph and two non-adjacent vertices . Question: is a -suitable pair?

The next, known observation follows from the fact that -Contractibility is trivial for , whereas for we can use Lemma 4 combined with the observation that -Suitability is polynomial-time solvable (two non-adjacent vertices , form a -suitable pair in a connected graph if and only if is connected).

###### Lemma 5

For , -Contractibility can be solved in polynomial time.

We now show the following lemma, which will be helpful for proving our results.

###### Lemma 6

Let and let be an instance of -Suitability with and at distance . Let be a shortest path from to . Then can be reduced in polynomial time to instances , one for each edge  that is not incident to and , with , such that is a yes-instance if and only if at least one of the new instances is a yes-instance of -Suitability.

###### Proof

First suppose that is a yes-instance of -Suitability. Then has a -witness structure with and . As , at least one bag of will contain both end-vertices of an edge  of . Then contracting yields a -witness structure  for with and . As and only contain and , respectively, the end-vertices of belong to some bag with . Hence, is not incident to and .

Now suppose that contains an edge not incident to and such that is a yes-instance of -Suitability. Then has a -witness structure with and . Let and say that we contracted on . As is not incident to and , we find that . Hence, belongs to some bag with . Then in we uncontract (so the new bag will contain both and ). This yields a -witness structure of with and . ∎

In our polynomial-time algorithms for constructing -witness structures (to prove Theorem 1.2) we put vertices in certain sets that we then try to extend to -witness bags (possibly via branching) and we will often apply the following rule:

Contraction Rule. If two adjacent vertices and end up in the same bag of some potential -witness structure, then contract the edge .

For a graph , we say that we apply the Contraction Rule on some set if we contract every edge in . The advantage of applying this rule is that we obtain a smaller instance and that we can exploit the fact that the resulting set has become independent.

It is easy to construct examples that show that a class of -free graphs is not closed under contraction if contains a vertex of degree at least 3 or a cycle. However, all polynomial-time solvable cases of Theorem 1.2 involve forbidding a linear forest . The following known lemma, which is readily seen, shows that the Contraction Rule does preserve -freeness as long as is a linear forest. Hence, we can safely apply the rule in our proofs of the polynomial-time solvable cases of Theorem 1.2.

###### Lemma 7

Let be a linear forest and let be an -free graph. Then the graph obtained from after contracting an edge is also -free.

## 3 The Polynomial-Time Solvable Cases of Theorem 1.2

In this section we prove that Longest Path Contractibility is polynomial-time solvable for -free graphs if (Section 3.2), (Section 3.3), (Section 3.4) and for every integer  (Section 3.5). To solve Longest Path Contractibility in each of these cases we will eventually check if the input graph can be contracted to . This turns out to be the hardest situation to deal with in our proofs. Due to Lemma 4, we can solve it by checking for each pair of distinct vertices , with if is a yes-instance of -Suitability (note that for any other pair , , we have that is a no-instance of -Suitability). In Section 3.1 we first provide a general framework by introducing some additional terminology and one general result for solving -Suitability.

### 3.1 On Contracting a Graph to P4

Let be an instance of -Suitability. For every -witness structure of  with and (if it exists), every neighbour of belongs to and every neighbour of belongs to . Throughout our proofs we let denote the set of remaining vertices of , which still need to be placed in either or . We write if no confusion is possible. We say that a partition of is a solution for if and are both connected. Hence, a solution for corresponds to a -witness structure of , where , , and . A solution for is -constant for some constant  if the following holds: either contains a set of size such that is connected, or contains a set of size such that is connected. We prove the following lemma.

###### Lemma 8

Let be an instance of -Suitability. For every constant , it is possible to check in time if has an -constant solution.

###### Proof

We first do the following check for vertex . For each set  of size we check if is connected and if every vertex of is in the same connected component of the subgraph of induced by . If so, then we put all vertices of in and all vertices of in . As is connected, this yields a solution for . This takes time for each set . As the number of sets  is , the total running time is . We can do the same check in time for vertex . This proves the lemma. ∎

Let be a solution for an instance of -Suitability that is not -constant (the value comes from our proofs). If and each contain at least one edge, then is double-sided. If exactly one of , contains an edge, then is single-sided. If both and are independent sets, then is independent.

### 3.2 The Case H=P2+P4

We now show that Longest Path Contractibility is polynomial-time solvable for -free graphs. As mentioned, we will do so via the auxiliary problem -Suitability. We first give, in Lemma 9, a polynomial-time algorithm for -Suitability for -free graphs. This is the most involved part of our algorithm. As such, we start with an outline of this algorithm.

Outline of the -Suitability Algorithm for -free graphs.
We first observe that for an instance , we may assume that  and  are of distance at least 3, and consequently, , and moreover we may assume that and are independent. Recall that . To get a handle on the adjacencies between and we will apply a (constant) number of branching procedures. For example, we will prove in this way that may be assumed to be -free. Each time we branch we obtain, in polynomial time, a polynomial number of new, smaller instances of -Suitability satisfying additional helpful constraints, such that the original instance is a yes-instance if and only if at least one of the new instances is a yes-instance. We then consider each new instance separately. That is, we either solve, in polynomial time, the problem for each new instance or create a polynomial number of new and even smaller instances via some further branching.

Our first goal is to check if has an -constant solution. If so then we are done. Otherwise we prove that the absence of -constant solutions implies that has no double-sided solution either. Hence, it remains to test if has a single-sided solution or an independent solution. We check single-sidedness with respect to and independently. We show that in both cases this leads either to a solution or to a polynomial number of smaller instances, for which we only need to check if they have an independent solution. This will enable us to branch in such a way that afterwards we may assume that is an independent set and that the solution we are looking for is equivalent to finding a star cover of and with centers in . The latter problem reduces to a matching problem, which we can solve in polynomial time.

###### Lemma 9

-Suitability can be solved in polynomial time for -free graphs.

###### Proof

Let be an instance of -Suitability, where is a connected -free graph. We may assume without loss of generality that and are of distance at least 3, that is, and are non-adjacent and ; otherwise is a no-instance.

Recall that . Recall also that we are looking for a partition of that is a solution for , that is, and must both be connected. In order to do so we will construct partial solutions , which we try to extend to a solution for . We use the Contraction Rule from Section 2 on and , so that these two sets will become independent. By Lemma 7, the resulting graph will always be -free. For simplicity, we will denote the resulting instance by again. After applying the Contraction Rule the size of the set will be reduced if a vertex was involved in an edge contraction with a vertex from or . In that case we say that we contracted away.

At the beginning of our algorithm, , and we start by applying the Contraction Rule on and . This leads to the following claim.

Claim 1. and are independent sets.

Phase 1: Exploiting the structure of

In the first phase of our algorithm, we will look into the structure of . Suppose contains an induced on vertices , , , . If there exists a vertex not adjacent to any vertex of , then induces a in , a contradiction. Hence, must cover . Similarly, must cover . Suppose has another induced on vertices such that . By the same arguments, also covers and . This means that and are both connected. We put each remaining vertex of into either or (which is possible, as is connected). This yields a (-constant) solution for .

From now on, assume that contains no induced copy of that is vertex-disjoint from (so, every other induced in contains at least one vertex of ). Below we will branch into smaller instances in which is -free, such that has a solution if and only if at least one of these new instances has a solution.

Branching I ( branches)
We branch by considering every possibility for each ) to go into either or for some solution of (if it exists). We do this vertex by vertex leading to a total of branches. Suppose we decide to put in . If is adjacent to a vertex of , then we apply the Contraction Rule on to contract away. If is not adjacent to any vertex of , then we do as follows. For each solution with , there must exist a shortest path in from to a vertex of (as is connected). As is -free, is -free. Hence, must have at most six vertices and thus at most four inner vertices. We consider all possibilities of choosing at most four vertices of to belong to as inner vertices of . As we may need to do this for , the above leads to a total of additional branches.

For each branch we do as follows. For we apply the Contraction Rule on to contract and the vertices of away. We denote the resulting instance by again. Note that the property (Claim 3.2) that and are independent sets is maintained. Moreover, as every induced in contained at least one vertex of , the following claim holds now as well.

Claim 2. is -free.

We now prove the following claim.

Claim 3. Let be a solution for that is not -constant. Let be three vertices of with , and . If are in , then every neighbour of in is adjacent to at least one of . If are in , then every neighbour of in is adjacent to at least one of .

Proof of Claim 3.2. We assume without loss of generality that belong to . Suppose has a neighbour that is not adjacent to and . Suppose there exists a vertex not adjacent to any of . Then, as is independent by Claim 3.2, is an induced , a contradiction. Hence, covers . As is connected, contains a shortest path from to . As is -free, is -free. Hence, has at most four inner vertices (possibly including ). As is connected and , we find that is a -constant solution, a contradiction. This proves the claim.

We will use the above claim at several places in our proof, including in the next stage.

Phase 2: Excluding 7-constant solutions and double-sided solutions

We first show that we may exclude double-sided solutions if we have no -constant solutions.

Claim 4. If has a double-sided solution, then also has a -constant solution.

Proof of Claim 3.2. For contradiction, assume that has a double-sided solution but no -constant solution. By definition, and contain some edges and , respectively. Then must contain a vertex  that is not adjacent to and ; otherwise the two vertices , which belong to , cover and this would imply that is a -constant solution, and thus also a -constant solution. As is connected and is an independent set by Claim 3.2, set  must contain a vertex  that is adjacent to . Then, by Claim 3.2, vertex  must be adjacent to at least one of , say . For the same reason, contains a vertex that is adjacent to at least one of , say , and to some vertex that is not adjacent to and .

Let . If no vertex of is adjacent to , then is an induced in , unless . However, in that case is an induced , a contradiction. Hence, covers . For the same reason we find that covers . Then has a -constant solution (which is -constant by definition) with and , a contradiction. This proves the claim.

Recall that a solution for is single-sided if exactly one of , contains an edge and independent if are both independent sets. We now do as follows. First we check in polynomial time if has a -constant solution by using Lemma 8. If so, then we are done. From now on assume that has no -constant solution. Then, by Claim 3.2 it follows that has no double-sided solution.

From the above, it remains to check if has a single-sided solution or an independent solution. If has a single-sided solution that is not independent, then either or is independent. Our algorithm will first look for a solution where is independent. We say that it is doing a -feasibility check. If afterwards we have not found a solution where is independent, then our algorithm will repeat the same steps but now under the assumption that the set  is independent. That is, in that case our algorithm will perform a -feasibility check.

Phase 3: Doing a -feasibility check

We start by exploring the structure of a solution that is either single-sided or independent, and where is an independent set. As and are both independent sets, is a connected bipartite graph. Hence, contains a set , such that covers . We assume that has minimum size. Then each has a nonempty set of neighbours in that are not adjacent to any vertex in ; otherwise we can remove from , contradicting our assumption that has minimum size. We call the vertices of the private neighbours of with respect to .

We note that does not have to be connected. However, as has no -constant solution, and thus no -constant solution, we find that has size at least 2. We may assume that there is no vertex , such that strictly contains for some (otherwise we put in instead of ). Let be the union of all private neighbour sets  (). As , we observe that is the disjoint union of a set of at least two stars whose centers belong to .

First suppose that . As is connected and is the disjoint union of at least two stars, there exists a vertex  that is adjacent to vertices and for two distinct vertices . As , we find that . By our choice of , this means that contains at least one vertex  that is not adjacent to . Similarly, contains a vertex  that is not adjacent to . By the definition of and , we find that and are not adjacent to , and is not adjacent to . Then is an induced of , a contradiction.

From the above we find that . Let . As covers and , we find that must be adjacent to at least two vertices . Suppose is not adjacent to some vertex . Let and . By the definition of the sets  and , we find that is not adjacent to and and that is not adjacent to and . In particular it holds that . Then is an induced in , a contradiction. Hence, must be adjacent to all of , that is, must be complete to . Note that this implies that is connected.

To summarize, if has a solution in which is an independent set, then the following holds for such a solution :

• The set  contains a subset  of size at least 2 that covers