1 Introduction
A colouring of a graph is an assignment of labels, called colours, to its vertices in such a way that no two adjacent vertices have the same label. The corresponding decision problem, Colouring, which is that of deciding whether a given graph can be coloured with at most colours for some given positive integer , is a central problem in discrete optimization. Its complementary problem Clique Cover is that of deciding whether the vertices of a graph can be covered with at most cliques. As Colouring and Clique Cover are NPcomplete even for [23], it is natural to restrict their input to some special graph class. A classic result in this area is due to Grötschel, Lovász, and Schrijver [15], who showed that Colouring is polynomialtime solvable for perfect graphs. However, for both problems, finding the exact borderline between tractable and computationally hard graph classes is still open.
A graph class is hereditary
if it can be characterized by some set of forbidden induced subgraphs, or equivalently, if it is closed under vertex deletion. The aforementioned class of perfect graphs is an example of such a class, as a graph is perfect if and only if it contains no induced odd holes and no induced odd antiholes
[7]. For the case where exactly one induced subgraph is forbidden, Král’, Kratochvíl, Tuza, and Woeginger [22] were able to prove a complete dichotomy; see also Figure 1 (we write to denote that the graph is an induced subgraph of the graph ).Theorem 1.1 ([22])
Let be a graph. The Colouring problem on free graphs is polynomialtime solvable if or and it is NPcomplete otherwise.
We study the complexity of Colouring and Clique Cover for free graphs, that is, when two induced subgraphs and are both forbidden. Both polynomialtime and NPcompleteness results are known for free graphs, as shown by many teams of researchers (see, for example, [5, 6, 9, 10, 16, 18, 22, 26, 29, 30, 31, 33]), but the complexity classification is far from complete: even if we forbid two graphs and of up to four vertices, there are still three open cases left, namely when ; see [26] (the graph is the claw and is the vertex cycle). We refer to [14, Theorem 21] for a summary and to the recent paper [31], in which the number of missing cases when and are both connected graphs on at most five vertices was reduced from ten to eight.
To narrow the complexity gap between hard and easy cases and to increase our understanding of it, we initiate a systematic study into free graph classes that are closed under complementation: if a graph belongs to the class, then so does its complement , which is the graph with vertex set and an edge between two distinct vertices if and only if these two vertices are not adjacent in . For such graph classes the complexities of Colouring and Clique Cover coincide, so we only need to consider the Colouring problem. A graph is selfcomplementary if . We observe that a class of free graphs is closed under complementation if either and are both selfcomplementary, or . For the first case we prove the following more general classification in Section 3.
Theorem 1.2
Let be selfcomplementary graphs. Then Colouring is polynomialtime solvable for free graphs if for some and it is NPcomplete otherwise.
Hence, we may now focus on the case when and is not selfcomplementary. In this case few results are known. First notice that for any integer , the class of free graphs consists of graphs with no large independent set and no large clique. The number of vertices in such graphs is bounded by a constant by Ramsey’s Theorem. Dabrowski et al. [10] researched the effect on the complexity of changing the forbidden subgraph by adding an extra edge, and proved that Colouring is polynomialtime solvable for free graphs. A result of Malyshev [29] implies that Colouring is polynomialtime solvable for free graphs. Hoàng and Lazzarato [18] proved the same for free graphs. By combining results of [21] and [32], Colouring is polynomialtime solvable on graph classes of bounded cliquewidth. It is known that free graphs [4] and free graphs [1] have bounded cliquewidth, so Colouring is polynomialtime solvable for these two graph classes. In light of these results, it is a natural research question to find out to what extent we may add edges to so that Colouring remains polynomialtime solvable on free graphs for the resulting graph .
To narrow down the large number of open cases , we will use the known results that Colouring is NPcomplete for graphs of girth at least for any [12, 22, 25] (the girth of a graph is the length of a shortest induced cycle in it) and for free graphs [22]. Even after using these results there are still many open cases left, and to get a handle on them we need another NPhardness result for a very restricted graph class. In Section 4.1 we will prove such a result, namely, we show that Colouring is NPcomplete even for free graphs (see Figure 2). We will show that, by combining this result with those above, only the following open cases are left: (see Figure 3), or for . In Section 4.2 we give a polynomialtime algorithm for Colouring restricted to the class of free graphs (note that this class has unbounded cliquewidth, as it contains the class of split graphs, which have unbounded cliquewidth [28]).
In Section 4.3 we show that our new hardness result and new polynomialtime algorithm combine together with the aforementioned known results to give us the main theorem of our paper.
Theorem 1.3
Let be a graph with . Then Colouring is polynomialtime solvable for free graphs if or is an induced subgraph of , , , , , or for some and it is NPcomplete otherwise.
Theorem 1.3 tells us is that we may only add a few edges to the graph if Colouring stays polynomialtime solvable on free graphs for the resulting graph (even in the two missing cases where or for , the graph is only allowed to contain at most three edges). From a more general perspective, our new hardness result has significantly narrowed the classification for free graphs.
Our immediate goal is to complete the complexity classification of Colouring for free graphs, thus to solve the cases when or for . We note that the class of free graphs, and thus the class of )free graphs, has unbounded cliquewidth [10]. We emphasize that our longterm goal is to increase our understanding of the computational complexity of Colouring for hereditary graph classes. Another natural question is whether Colouring (the variant of Colouring where the number of colours is fixed) is polynomialtime solvable for free graphs when or for . This is indeed the case, as Couturier et al. [8] extended the result of [17] on Colouring for free graphs by proving that for every pair of integers , Colouring is polynomialtime solvable even for free graphs. However, for other classes of free graphs, we show that Colouring turns out to be NPhard by using a construction of Huang [19], that is, we show the following results in Section 5.
Theorem 1.4
Colouring is NPcomplete for free graphs, and thus for free graphs.
Theorem 1.5
Colouring is NPcomplete for free graphs, and thus for free graphs.
As Colouring is polynomialtime solvable for free graphs [18], it would be interesting to solve the following two open problems (see also Table 1):

is there an integer such that Colouring for free graphs is NPcomplete?

is there an integer such that Colouring for free graphs is NPcomplete?
As Colouring is polynomialtime solvable for free graphs [2], must be at least . Similar to summaries for Colouring for free graphs (see, for example, [14]) and free graphs [16], we can survey the known results and the missing cases of Colouring for free graphs; see Table 1.
P  P  P  
P  P  ?  
P  P  ?  
P  ?  NPc 
2 Preliminaries
Throughout our paper we consider only finite, undirected graphs without multiple edges or selfloops. The disjoint union of two vertexdisjoint graphs and is denoted by and the disjoint union of copies of a graph is denoted by . For a subset , we let denote the subgraph of induced by , which has vertex set and edge set . If then we may write instead of . We may also write instead of .
For a set of graphs , a graph is free if it has no induced subgraph isomorphic to a graph in ; if , we may write free instead of free. For a graph , the set denotes the neighbourhood of .
The graphs , , and denote the cycle, complete graph, star and path on vertices, respectively. The graph is also known as the vertex wheel. The graphs and are also called the triangle and claw, respectively. A graph is a linear forest if every component of is a path (on at least one vertex). The graph , for , denotes the subdivided claw, that is, the tree that has only one vertex of degree and exactly three leaves, which are of distance , and from , respectively. Observe that .
The chromatic number of a graph is the smallest integer such that is colourable. The clique number is the size of a largest clique in . A graph is bipartite if its vertex set can be partitioned into two (possibly empty) independent sets.
3 The Proof of Theorem 1.2
As mentioned in Section 1, if we study the complexity of Colouring for free classes of graphs that are closed under complementation, it is sufficient to consider the case where and are not selfcomplementary and . We will give a short proof for this claim. To do so, we will need the following lemma.
Theorem 1.2 (restated). Let be selfcomplementary graphs. Then Colouring is polynomialtime solvable for free graphs if for some and it is NPcomplete otherwise.
Proof
Let be a selfcomplementary graph on vertices. Then must have edges. If then . Now cannot be or , since and are not integers. If then , by inspection. Suppose . Then , so must contain a cycle. Thus, if is a selfcomplementary graph then it is either an induced subgraph of or it contains a cycle.
4 The Proof of Theorem 1.3
In this section we prove Theorem 1.3. As part of the proof we first show that Colouring is NPcomplete for free graphs in Section 4.1 and polynomialtime solvable for free graphs in Section 4.2.
4.1 The Hardness Result
In this section we prove the following result.
Theorem 4.1
Colouring is NPcomplete for free graphs.
Proof
Let and be positive integers with . Let be a set of size . Let be a collection of subsets of each of size . An exact cover for is a set of size such that every member of belongs to one of the subsets in . The NPcomplete problem Exact Cover [13] is that of determining if such a set exists. To prove the theorem, we describe a reduction from Exact Cover to Colouring for free graphs.
Given an instance of Exact Cover, we construct the graph as follows (see Figure 4 for an example):

Introduce a set of vertices which forms a clique in .

Introduce a set of vertices which forms an independent set in .

Add an edge from to if and only if .

Introduce a set of vertices which forms an independent set in .

Add an edge from each vertex of to each vertex of .
Claim 1. The vertices of can be covered by at most pairwise vertexdisjoint cliques if and only if contains an exact cover .
First suppose that contains an exact cover .
Let .
For each , let be the clique on four vertices containing and its three neighbours in ; there are such cliques.
Form a perfect matching between the vertices of and the vertices of , that is, a collection of cliques on two vertices.
Together, these pairwise vertexdisjoint cliques cover .
Now suppose that the vertices of can be covered by at most pairwise vertexdisjoint cliques. As is independent and , we have exactly cliques, and each of them contains exactly one vertex of . Hence, as is an independent set and each vertex in is only adjacent to the vertices of , each of the vertices of must be contained in a clique of size that consists of a vertex of and a vertex of . There are other cliques, which, as we deduced, also contain exactly one vertex of . Each vertex of must be in one of these cliques. As each vertex in has exactly three neighbours in and there are vertices in , this means that each of these cliques must contain four vertices, consisting of one vertex of and three vertices of . Hence, if we let belong to whenever is in a clique of size , then forms an exact cover. This completes the proof of Claim 4.1.
We have shown a reduction from Exact Cover to the problem of finding pairwise vertexdisjoint cliques that cover . The latter problem is equivalent to finding a colouring of (note that is part of the input of Exact Cover). It remains to show that is free.
Since a graph is free if and only if is, it is sufficient to show that is free. We do this in Claims 4.14.1, but first we prove a useful observation.
Claim 2. Let be an induced subgraph of that is the complement of a linear forest on six vertices.
Then contains at least four vertices of .
As a linear forest contains no triangle, contains no independent set on three vertices.
So cannot contain more than two vertices from either of the independent sets or .
Thus it contains vertices of .
But then it cannot contain two vertices from as, combined with a vertex of this would again induce an independent set of size .
Hence there are at least three vertices of in .
But this implies that not even one vertex of belongs to (as it would have three nonneighbours and every vertex of is adjacent to all but at most two of the others).
This completes the proof of Claim 4.1.
Claim 3. is free.
Suppose for contradiction that there is an induced in .
Since and are independent sets, every in must either have two vertices in or one vertex in and the other in or .
Since that is a clique and every vertex in is adjacent to every vertex in , one of the ’s must have both its vertices in and the other must have one vertex in and the other in .
But every vertex in has a neighbour in such a , so no induced can exist.
This completes the proof of Claim 4.1.
Claim 4. is free.
Suppose for contradiction that there is an induced in .
Note this subgraph consists of a , which we denote , plus an additional vertex, which we denote , that is adjacent to every vertex in .
If , then the vertices of are all in , and if , the vertices of the are either all in or all in .
Neither is possible, so we must have .
Therefore none of the vertices of is in .
At most two of the vertices of are in each of and as contains neither an independent set nor a clique on three vertices.
So contains exactly two vertices from each of and , but the pair from must be nonadjacent in and the pair from must be adjacent in .
This contradiction completes the proof of Claim 4.1.
Claim 5. is free.
Suppose for contradiction that there is an induced in .
Denote this graph by .
As is a clique, contains at most two of its vertices.
If it contains exactly two, then must also contain a vertex such that the three vertices together induce a .
But then cannot be adjacent to any other vertex of so the remaining three vertices must all belong to , a contradiction as is independent.
So must contain at least five vertices of and .
They cannot all belong to one of these two sets as has no independent set of size , but if contains vertices of both sets then there must be a vertex of degree .
This contradiction proves that does not exist.
This completes the proof of Claim 4.1.
Claim 6. is free.
Suppose for contradiction that there is an induced in .
By Claim 4.1, it contains four vertices of .
We note that contains exactly one induced and that the other two vertices are adjacent to exactly two vertices in the clique (so must both be in ) and to each other (so cannot both be in ).
This contradiction completes the proof of Claim 4.1.
Claim 7. is free.
Suppose for contradiction that there is an induced in .
Denote this path by .
As is a clique, contains at most two of its vertices.
We see that cannot contain exactly four vertices of either or as they would form an independent set of size . cannot contain exactly three vertices of either or as then there would be a vertex in the other of the two sets of degree . Finally, cannot contain at least two vertices from each of and as then it would contain an induced .
These contradictions prove that does not exist.
This completes the proof of Claim 4.1.
4.2 A Tractable Case
We show that Colouring is polynomialtime solvable for free graphs. We first introduce some additional terminology. The cliquewidth of a graph is the minimum number of labels needed to construct by using the following four operations:

creating a new graph consisting of a single vertex with label ;

taking the disjoint union of two labelled graphs and ;

joining each vertex with label to each vertex with label ();

renaming label to .
A class of graphs has bounded cliquewidth if there is a constant such that the cliquewidth of every graph in is at most ; otherwise the cliquewidth is unbounded. For an induced subgraph of a graph , the subgraph complementation operation (acting on with respect to ) replaces every edge present in by a nonedge, and vice versa. Similarly, for two disjoint vertex subsets and in , the bipartite complementation operation with respect to and acts on by replacing every edge with one endvertex in and the other one in by a nonedge and vice versa. Let be a constant and let be some graph operation. We say that a graph class is obtained from a graph class if the following two conditions hold:

every graph in is obtained from a graph in by performing at most times, and

for every there exists at least one graph in that is obtained from by performing at most times.
We say that preserves boundedness of cliquewidth if for any finite constant and any graph class , any graph class that is obtained from has bounded cliquewidth if and only if has bounded cliquewidth.
Two (nonadjacent) vertices are false twins if they have the same neighbourhood. We will use the following two lemmas, which are readily seen.
Lemma 2
The cliquewidth of a graph of maximum degree at most is at most .
Lemma 3
If a vertex in a graph has a false twin then .
The following lemma for free bipartite graphs follows from a result of Lozin [24], who proved that the superclass of free bipartite graphs has bounded cliquewidth (see [11] for a full classification of the boundedness of cliquewidth of free bipartite graphs).
Lemma 4 ([24])
The class of free bipartite graphs has bounded cliquewidth.
A graph is perfect if for every induced subgraph of . Besides the above lemmas we will also apply the following three wellknown theorems.
Theorem 4.2 ([7])
A graph is perfect if and only if it is free and free for every odd .
Theorem 4.3 ([15])
Colouring is polynomialtime solvable on perfect graphs.
Theorem 4.4 ([21, 32])
For any constant , Colouring is polynomialtime solvable on graphs of cliquewidth at most .
If is a graph, then a (possibly empty) set is a clique separator if is a clique and is disconnected. A graph is an atom if it has no clique separator. Due to the following result of Tarjan, when considering the Colouring problem in a hereditary class, we only need to consider atoms in the class.
Lemma 5 ([34])
If Colouring is polynomialtime solvable on atoms in an hereditary class , then it is polynomialtime solvable on all graphs in .
Let be a set of vertices in a graph . A vertex is complete (resp. anticomplete) to if it is adjacent (resp. nonadjacent) to every vertex of . A set of vertices is complete (resp. anticomplete) to if every vertex in is complete (resp. anticomplete) to . If and are disjoint sets of vertices in a graph, we say that the edges between these two sets form a matching if each vertex in has at most one neighbour in and vice versa (if each vertex has exactly one such neighbour, we say that the matching is perfect). Similarly, the edges between these sets form a comatching if each vertex in has at most one nonneighbour in and vice versa.
In Theorem 4.5 we present an algorithm for Colouring restricted to free graphs. Our algorithm first tries to reduce to perfect graphs, in which case we can use Theorem 4.3. If a free graph is not perfect, then we show that it must contain an induced . The cliquewidth of such graphs is not bounded (we can construct a free graph of arbitrarily large cliquewidth by taking a split graph of arbitrarily large cliquewidth [28] with clique and independent set and adding five new vertices that form an induced and that are complete to but anticomplete to ). Therefore, we do some preprocessing to simplify the graph. This enables us to bound the cliquewidth so that we may then apply Theorem 4.4. Our general scheme for bounding the cliquewidth is to partition the remaining vertices into sets according to their neighbourhood in the and then investigate the possible edges both inside these sets and between them. This enables us to use graph operations (see also Facts 1–3) that do not change the cliquewidth by “too much” to partition the input graph into disjoint pieces known to have bounded cliquewidth.
Theorem 4.5
Colouring is polynomialtime solvable for free graphs.
Proof
Let be a free graph. By Lemma 5 we may assume that is an atom and so has no clique separator (we will use this assumption in the proof of Claim 4.2). We first test in time whether contains an induced . If not, then is free. Since , is also free. Since is free, is free for all . Since is free, is free for all . By Theorem 4.2, this means that is a perfect graph. Therefore, by Theorem 4.3, we can solve Colouring in polynomial time in this case.
Now assume our algorithm found an induced vertex cycle with vertices , in that order. For , let be the set of vertices such that . A set is large if it contains at least three vertices, otherwise it is small.
To ease notation, in the remainder of the proof, subscripts on vertex sets should be interpreted modulo and whenever possible we will write instead of and instead of and so on.
We start with three structural claims.
Claim 1. is an independent set.
If are adjacent then is a , a contradiction.
Therefore is an independent set.
This completes the proof of Claim 4.2.
Claim 2. and for .
Suppose for contradiction that .
If and are adjacent then is a and if and are nonadjacent then is a .
This contradiction implies that .
Claim 4.2 follows by symmetry.
Claim 3. is an independent set for .
Suppose for contradiction that are adjacent.
Then is a , a contradiction.
Therefore is an independent set.
Claim 4.2 follows by symmetry.
Since , it follows that also contains a , namely on the vertices , , , and in that order. Therefore is also a free graph containing an induced . As a result, we immediately obtain the following claims as corollaries of Claims 4.2–4.2.
Claim 4. is a clique.
Claim 5. and for .
Claim 6. is a clique for .
Let be the set of vertices in that have a nonneighbour in .
Claim 7. is colourable if and only if is colourable.
The “only if” direction is trivial.
Suppose is colourable. Fix a colouring of .
We will show how to extend to all vertices of .
We may assume and are nonempty, otherwise and the claim follows trivially. Note that is an independent set by Claim 4.2 and that is a clique by Claim 4.2. By assumption, is not a clique separator in . Since is an independent set, every vertex of must have a neighbour in that is adjacent to some vertex of the cycle . Let be the set of vertices outside that have a neighbour in . Note that contains no vertex of , as is an independent set. Hence, every vertex of is adjacent to least one vertex of (but not to all vertices of ).
We claim that is complete to . Indeed, suppose for contradiction that is nonadjacent to . Let be a vertex in that is a neighbour of . Without loss of generality, assume that is adjacent to . Then is adjacent to or , otherwise would be a , a contradiction. Without loss of generality, assume that is adjacent to . Then is adjacent to , otherwise would be a , a contradiction. Thus is adjacent to or , otherwise would be a , a contradiction. Without loss of generality, assume that is adjacent to . Now must be adjacent to , otherwise would be a , a contradiction. Therefore , a contradiction. It follows that must indeed be complete to .
Let . By definition of , there is a vertex that is nonadjacent to . We claim that can also be used to colour . Indeed, every neighbour of lies in . Since is a clique and is complete to , no vertex of is coloured with the colour . We may therefore colour with the colour . Repeating this process, we can extend the colouring of to a