 # Colouring (P_r+P_s)-Free Graphs

The k-Colouring problem is to decide if the vertices of a graph can be coloured with at most k colours for a fixed integer k such that no two adjacent vertices are coloured alike. If each vertex u must be assigned a colour from a prescribed list L(u) ⊆1, ..., k, then we obtain the List k-Colouring problem. A graph G is H-free if G does not contain H as an induced subgraph. We continue an extensive study into the complexity of these two problems for H-free graphs. The graph (P_r+P_s) is the disjoint union of the r-vertex path P_r and the s-vertex path P_s. We prove that List 3-Colouring is polynomial-time solvable for (P_2+P_5)-free graphs and for (P_3+P_4)-free graphs. Combining our results with known results yields complete complexity classifications of 3-Colouring and List 3-Colouring on H-free graphs for all graphs H up to seven vertices. We also prove that 5-Colouring is NP-complete for (P_3+P_5)-free graphs.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Graph colouring is a popular concept in Computer Science and Mathematics due to a wide range of practical and theoretical applications, as evidenced by numerous surveys and books on graph colouring and many of its variants (see, for example, [1, 6, 15, 23, 25, 29, 31, 34]). Formally, a colouring of a graph is a mapping that assigns each vertex  a colour in such a way that whenever . If , then is also called a -colouring of and is said to be -colourable. The Colouring problem is to decide if a given graph has a -colouring for some given integer .

It is well known that Colouring is -complete even if  . To pinpoint the reason behind the computational hardness of Colouring one may impose restrictions on the input. This led to an extensive study of Colouring for special graph classes, particularly hereditary graph classes. A graph class is hereditary if it is closed under vertex deletion. As this is a natural property, hereditary graph classes capture a very large collection of well-studied graph classes. A classical result in this area is due to Grötschel, Lovász, and Schrijver , who proved that Colouring is polynomial-time solvable for perfect graphs.

It is readily seen that a graph class is hereditary if and only if can be characterized by a unique set of minimal forbidden induced subgraphs. A graph is -free if only contains one graph , that is, has no induced subgraph isomorphic to . Král’, Kratochvíl, Tuza, and Woeginger  started a systematic study into the complexity of Colouring on -free graphs for sets of size at most 2. They showed polynomial-time solvability if is an induced subgraph of or and -completeness for all other graphs . The classification for the case where has size 2 is far from finished; see the summary in  or an updated partial overview in  for further details. Instead of considering sets of size 2, we consider -free graphs and follow another well-studied direction, in which the number of colours is fixed, that is, no longer belongs to the input. This leads to the following decision problem:

.99 -Colouring

[2pt]     Instance: a graph . Question: does there exist a -colouring of ?

To obtain more general results, we also consider a generalization of the -Colouring problem. A -list assignment of is a function with domain  such that the list of admissible colours of each is a subset of . A colouring respects if for every If is fixed, then we obtain the following decision problem:

.99 List -Colouring

[2pt]     Instance: a graph and a -list assignment . Question: does there exist a colouring of that respects ?

Note that -Colouring is polynomial-time solvable if List -Colouring is so, and that List -Colouring is -complete if -Colouring is so. For every , -Colouring on -free graphs is -complete if contains a cycle  or an induced claw [21, 27]. Hence, it remains to consider the case where is a linear forest (a disjoint union of paths). The situation is far from settled yet, although many partial results are known [3, 4, 5, 7, 8, 9, 10, 11, 16, 20, 22, 26, 30, 32, 35]. Particularly, the case where  is the -vertex path has been well studied. The cases , and , are -complete . For ,   and ,  , even List -Colouring on -free graphs is polynomial-time solvable (see also ). For a fixed integer , the -Precolouring Extension problem is to test whether a given -colouring defined on an induced subgraph of a graph  can be extended to a -colouring of . Recently it was shown in [8, 9] that 4-Precolouring Extension, and therefore 4-Colouring, is polynomial-time solvable for -free graphs. In contrast, the more general problem List -Colouring is -complete for -free graphs . See Table 1 for a summary of all these results.

From Table 1 we see that only the cases , are still open, although some partial results are known for -Colouring for the case ,  . The situation when is a disconnected linear forest is less clear. It is known that for every , List 3-Colouring is polynomial-time solvable for -free graphs [5, 15]. For every graph , List -Colouring is polynomial-time solvable for -free graphs if it is polynomially solvable for -free graphs [5, 15]. If a stronger result is known.

###### Theorem 1 ().

For all , List -Colouring is polynomial-time solvable on -free graphs.

Theorem 1 cannot be extended to larger linear forests , as List -Colouring is -complete for -free graphs  and List -Colouring is -complete for -free graphs . It is not clear if such an extension still exists for -Colouring. It is known that -Colouring is -complete for -free graphs , but the following problem is still open:

Do there exist integers and such that -Colouring is -complete for -free graphs?

Another way of making progress is to complete a classification by bounding the size of . It follows from the above results and the ones in Table 1 that for a graph  with , -Colouring and List -Colouring (and consequently, -Precolouring Extension) are polynomial-time solvable on -free graphs if is a linear forest, and -complete otherwise (see also ). There are two open cases  that must be solved in order to obtain the same statement for graphs  with . These cases are

• .

### Our Results

We consider the above research questions for disconnected forests . In Section 2 we address the two missing cases listed above by proving the following theorem.

###### Theorem 2.

List -Colouring is polynomial-time solvable for -free graphs and for -free graphs.

We prove Theorem 2 as follows. If the graph of an instance of List -Colouring is -free, then we can use the aforementioned result of Bonomo et al. . Hence we may assume that contains an induced . We consider every possibility of colouring the vertices of this and try to reduce each resulting instance to a polynomial number of smaller instances of -Satisfiability. As the latter problem can be solved in polynomial time, the total running time of the algorithm will be polynomial. The crucial proof ingredient is that we partition the set of vertices of that do not belong to the into subsets of vertices that are of the same distance to the . This leads to several “layers” of . We analyse how the vertices of each layer are connected to each other and to vertices of adjacent layers so as to use this information in the design of our algorithm.

Combining Theorem 2 with the known results yields the following complexity classifications for graphs  up to seven vertices; see Section 3 for its proof.

###### Corollary 1.

Let be a graph with . If is a linear forest, then List -Colouring is polynomial-time solvable for -free graphs; otherwise already -Colouring is -complete for -free graphs.

In Section 4 we complement Theorem 2 by proving the following result.

###### Theorem 3.

-Colouring is -complete for -free graphs.

Theorems 2 and 3 reduce the first research question to the question whether there exists an integer such that -Colouring is -complete for -free graphs.

### Preliminaries

Let be a graph. For a vertex , we denote its neighbourhood by , its closed neighbourhood by and its degree by . For a set , we write and , and we let be the subgraph of induced by . The contraction of an edge removes and from and introduces a new vertex which is made adjacent to every vertex in . The identification of a set by a vertex  removes all vertices of from , introduces as a new vertex and makes adjacent to every vertex in . The length of a path is its number of edges. The distance between two vertices and  is the length of a shortest path between them in . The distance between a vertex and a set is defined as .

For two graphs and , we use to denote the disjoint union of and , and we write to denote the disjoint union of copies of . Let be an instance of List 3-Colouring. For , we write . We let and denote the path and complete graph on vertices, respectively. The diamond is the graph obtained from after removing an edge.

We say that an instance is smaller than some other instance of List 3-Colouring if either is an induced subgraph of with ; or and for each , such that there exists at least one vertex  with .

## 2 The Two Polynomial-Time Results

In this section we show that List -Colouring problem is polynomial-time solvable for -free graphs and for -free graphs. As arguments for these two graph classes are overlapping, we prove both cases simultaneously. Our proof uses the following two results.

###### Theorem 4 ().

List -Colouring is polynomial-time solvable for -free graphs.

If we cannot apply Theorem 4, our strategy is to reduce, in polynomial time, an instance of List 3-Colouring to a polynomial number of smaller instances of 2-List Colouring. We use the following well-known result due to Edwards.

###### Theorem 5 ().

The -List Colouring problem is linear-time solvable.

We are now ready to prove our main result , namely that List -Colouring is polynomial-time solvable for -free graphs and for -free graphs. As arguments for these two graph classes are overlapping, we prove both cases simultaneously. We start with an outline followed by a formal proof.

Outline of the proof of Theorem 2. Our goal is to reduce, in polynomial time, a given instance of List 3-Colouring, where is -free or -free, to a polynomial number of smaller instances of 2-List-Colouring in such a way that is a yes-instance if and only if at least one of the new instances is a yes-instance. As for each of the smaller instances we can apply Theorem 5, the total running time of our algorithm will be polynomial.

If is -free, then we do not have to do the above and may apply Theorem 4 instead. Hence, we assume that contains an induced . We put the vertices of the in a set  and define sets ) of vertices of the same distance  from ; we say that the sets  are the layers of . We then analyse the structure of these layers using the fact that is -free or -free. The first phase of our algorithm is about preprocessing after colouring the seven vertices of  and applying a number of propagation rules. We consider every possible colouring of the vertices of . In each branch we may have to deal with vertices that still have a list of size 3. We call such vertices active and prove that they all belong to . We then enter the second phase of our algorithm. In this phase we show, via some further branching, that -neighbours of active vertices either all have a list from , where , or they all have the same list . In the third phase we reduce, again via some branching, to the situation where only the latter option applies: -neighbours of active vertices all have the same list. Then in the fourth and final phase of our algorithm we know so much structure of the instance that we can reduce to a polynomial number of smaller instances of 2-List-Colouring via a new propagation rule identifying common neighbourhoods of two vertices by a single vertex.

Theorem 2 (restated). List -Colouring is polynomial-time solvable for -free graphs and for -free graphs.

###### Proof.

Let be an instance of List 3-Colouring, where is an -free graph for . Note that is -free. Since the problem can be solved component-wise, we may assume that  is connected. If contains a , then is not 3-colourable, and thus is a no-instance. As we can decide if contains a in time by brute force, we assume that from now on is -free. By brute force we either deduce in time that is -free or we find an induced on vertices in that order. In the first case we use Theorem 4. It remains to deal with the second case.

Definition (Layers). Let For , we define . We call the sets the layers of .

In the remainder, we consider to be a fixed set of vertices. That is, we will update by applying a number of propagation rules and doing some (polynomial) branching, but we will never delete the vertices of . This will enable us to exploit the -freeness of .

We show the following two claims about layers.

###### Claim 1.

.

Proof of Claim 1. Suppose for some . As is connected, we may assume that . Let . By definition, there exists two vertices and such that is adjacent to and is adjacent to . Then has an induced on vertices , a contradiction.

###### Claim 2.

is the disjoint union of complete graphs of size at most , each containing at least one vertex of  (and thus at most two vertices of ).

Proof of Claim 2. First assume that has a connected component  that is not a clique. Then contains an induced , which together with the subgraph ] forms an induced , a contradiction. Then the claim follows after recalling that is -free and connected.

We will now introduce a number of propagation rules, which run in polynomial time. We are going to apply these rules on exhaustively, that is, until none of the rules can be applied anymore. Note that during this process some vertices may be deleted (due to Rules 4 and 10), but as mentioned we will ensure that we keep the vertices of , while we may update the other sets . We say that a propagation rule is safe if the new instance is a yes-instance of List 3-Colouring if and only if the original instance is so.

1. (no empty lists) If for some , then return no.

2. (no lists of size 3) If for every , then apply Theorem 5.

3. (connected graph) If is disconnected, then solve List 3-Colouring on each instance , where is a connected component of that does not contain and is the restriction of to . If has no colouring respecting , then return no; otherwise remove the vertices of from .

4. (no coloured vertices) If , and for all , then remove from .

5. (single colour propagation) If and are adjacent, , and , then set .

6. (diamond colour propagation) If and are adjacent and share two common neighbours and with , then set and .

7. (twin colour propagation) If and are non-adjacent, , and , then set .

8. (triangle colour propagation) If form a triangle, and , then set , so .

9. (no free colours) If and for some , then set for some .

10. (no small degrees) If for some , then remove from .

As mentioned, our algorithm will branch at several stages to create a number of new but smaller instances, such that the original instance is a yes-instance if and only if at least one of the new instances is a yes-instance. Unless we explicitly state otherwise, we implicitly assume that Rules 110 are applied exhaustively immediately after we branch (the reason why we may do this is shown in Claim 3). If we apply Rule 1 or 2 on a new instance, then a no-answer means that we will discard the branch. So our algorithm will only return a no-answer for the original instance if we discarded all branches. On the other hand, if we can apply Rule 2 on some new instance and obtain a yes-answer, then we can extend the obtained colouring to a colouring of that respects , simply by restoring all the already coloured vertices that were removed from the graph due to the rules. We will now state Claim 3.

###### Claim 3.

Rules 110 are safe and their exhaustive application takes polynomial time. Moreover, if we have not obtained a yes- or no-answer, then afterwards is a connected -free graph, such that and for every .

Proof of Claim 3. It is readily seen that Rules 15 are safe. For Rule 6, this follows from the fact that any 3-colouring assigns and the same colour. For Rule 7, this follows from the fact that can always be recoloured with the same colour as . For Rule 8, this follows from the fact that the colours from must be used on and . For Rule 9, this follows from the fact that no colour from will be assigned to a vertex in . For Rule 10, this follows from the fact that we always have a colour available for .

It is readily seen that applying Rules 12 and 410 take polynomial time. Applying Rule 3 takes polynomial time, as each connected component of that does not contain is a complete graph on at most three vertices due to the -freeness of (recall that or ). Each application of a rule either results in a no-answer, a yes-answer, reduces the list size of at least one vertex, or reduces by at least one vertex. Thus exhaustive application of the rules takes polynomial time.

Suppose exhaustive application does not yield a no-answer or a yes-answer. By Rule 3, is connected. As no vertex of was removed, contains . Hence, we can define by Claim 1. By Rules 4 and 5, we find that for every . It is readily seen that Rules 110 preserve -freeness of .

### Phase 1. Preprocessing (G,L)

In Phase 1 we will preprocess using the above propagation rules. To start off the preprocessing we will branch via colouring the vertices of in every possible way. To start off the preprocessing we will branch via colouring the vertices of in every possible way. By colouring a vertex , we mean reducing the list of permissible colours to size exactly one. (When , we consider vertex coloured by colour .) Thus, when we colour some vertex , we always give a colour from its list , moreover, when we colour more than one vertex we will always assign distinct colours to adjacent vertices.

Branching I ( branches)
We now consider all possible combinations of colours that can be assigned to the vertices in . That is, we branch into at most cases, in which each received a colour from their list. We note that each branch leads to a smaller instance and that is a yes-instance if and only if at least one of the new instances is a yes-instance. Hence, if we applied Rule 1 in some branch, then we discard the branch. If we applied Rule 2 and obtained a no-answer, then we discard the branch as well. If we obtained a yes-answer, then we are done. Otherwise we continue by considering each remaining branch separately. For each remaining branch, we denote the resulting smaller instance by again.

We will now introduce a new rule, namely Rule 11. We apply Rule 11 together with the other rules. That is, we now apply Rules 111 exhaustively. However, each time we apply Rule 11 we first ensure that Rules 110 have been applied exhaustively.

1. (-reduction) If and are in and are adjacent, then remove and from .

###### Claim 4.

Rule 11, applied after exhaustive application of Rules 110, is safe and takes polynomial time. Moreover, afterwards is a connected -free graph, such that and for every .

Proof of Claim 4. Assume that we applied Rules 110 exhaustively and that contains two adjacent vertices and . By Claim 2, we find that and have a common neighbour  and no other neighbours. By Rules 45 and 10, we then find that . First suppose that , say . Then, by Rule 8, we find that , contradicting Rule 4. Hence , say and . By Rule 8, we find that or . If gets colour 1, we can give colour 2 and colour 3. If gets colour 2, we can give colour 1 and colour 3. Finally, if gets colour 3, then we can give colour 2 and colour 1. Hence we may set . This does not destroy the connectivity or -freeness of .

We now show the following claim.

###### Claim 5.

The set is independent, and moreover, each vertex has and exactly two neighbours in .

Proof of Claim 5. By Rule 11, we find that is independent. As every vertex of has at most two neighbours in due to Claim 2, the claim follows from Rules 4510 and the fact that is independent.

The following claim follows immediately from Claims 2 and 5 and gives a complete description of the second and third layer, see also Figure 1.

###### Claim 6.

Every connected component of is a complete graph with either and , or and .

The following claim describes the location of the vertices with list of size 3 in .

###### Claim 7.

For every , if , then .

Proof of Claim 7. As the vertices in have lists of size 1, the vertices in have lists of size 2. By Claim 5, the same holds for vertices in .

In the remainder of the proof we will show how to branch in order to reduce the lists of the vertices with by at least one colour. We formalize this approach in the following definition.

Definition (Active vertices). A vertex and its neighbours in are called active if . Let be the set of all active vertices. Let and . We deactivate a vertex if we reduce the list by at least one colour. We deactivate a vertex by deactivating all its neighbours in .

Note that every vertex has by Rule 5 applied on the vertices of . Hence, if we reduce by one colour, all neighbours of in become deactivated by Rule 5, and is removed by Rule 4.

For , we let be the set of active neighbours of that are not adjacent to and similarly, we let be the set of active neighbours of that are not adjacent to .

### Phase 2. Reduce the number of distinct sets A(i,j)

We will now branch into smaller instances such that is a yes-instance of List 3-Colouring if and only if at least one of these new instances is a yes-instance. Each new instance will have the following property:

(P)

for with , either or .

Branching II ( branches)
Consider two vertices and with and . Assume without loss of generality that is coloured 3 and that is coloured either 1 or 3. Hence, every has , whereas every has for . We branch as follows. We consider all possibilities where at most one vertex of receives colour 2 (and all other vertices of receive colour 1) and all possibilities where we choose two vertices from to receive colour 2. This leads to branches. In the branches where at most one vertex of receives colour 2, every vertex of will be deactivated. So Property (P) is satisfied for and .

Now consider the branches where two vertices of both received colour 2. We update accordingly. In particular, afterwards no vertex in is adjacent to or , as is a colour in the list of each vertex of . We now do some further branching for those branches where . We consider the possibility where each vertex of is given the colour of and all possibilities where we choose one vertex in to receive a colour different from the colour of (we consider both options to colour such a vertex). This leads to branches. In the first branch, every vertex of will be deactivated. So Property (P) is satisfied for and .

Finally by recursive application of the above described procedure for all pairs such that and we get a graph satisfying Property (P), which together leads to branches.

We now consider each resulting instance from Branching II. We denote such an instance by again. Note that vertices from may now belong to , as their neighbours in may have been removed due to the branching. The exhaustive application of Rules 1– 11 preserves (P) (where we apply Rule 11 only after applying Rules 110 exhaustively). Hence satisfies (P).

We observe that if two vertices in have a different list, then they must be adjacent to different vertices of . Hence, by Property (P), at most two lists of can occur as lists of vertices of . Without loss of generality this leads to two cases: either every vertex of has list or and both lists occur on ; or every vertex of has list only. In the next phase of our algorithm we reduce, via some further branching, every instance of the first case to a polynomial number of smaller instances of the second case.

### Phase 3. Reduce to the case where vertices of A1 have the same list

Recall that we assume that every vertex of has list or . In this phase we deal with the case when both types of lists occur in . We first prove the following claim.

###### Claim 8.

Let . Then every vertex from is adjacent to some vertex with .

Proof of Claim 8. We may assume without loss of generality that or . For contradiction suppose there exists a vertex that is non-adjacent to all with . As two consecutive vertices in have different colours, no vertex in has two consecutive neighbours in due to Rules 4 and 5. Hence . By definition, has a neighbour . If , then induces a in . If , then induces a in .

###### Claim 9.

It holds that for some . Moreover, we may assume without loss of generality that and have colour  and both are adjacent to all vertices of with list , whereas has colour  and is adjacent to all vertices of with list .

Proof of Claim 9. Recall that lists and both occur on . By Property (P), this means that either for some or for some . The case where for some is not possible due to Claim 8. It follows that for some . We may assume without loss of generality that has colour , meaning that and must have colour 3. It follows that every vertex of with list is adjacent to but not to or , whereas every vertex of with list is adjacent to at least one vertex of but not to . As a vertex of with list has as its only neighbour in , it follows from Claim 8 that is an even number. This means that

is odd. Hence, every vertex of

with list is in fact adjacent to both and due to Claim 8.

By Claim 9, we can partition the set into two (non-empty) sets and , where is the set of vertices in with list whose only neighbours in are and (which both have colour 3) and is the set of vertices in with list whose only neighbour in is (which has colour 2).

Our goal is to show that we can branch into at most smaller instances, in which either or , such that is a yes-instance of List 3-Colouring if and only if at least one of these smaller instances is a yes-instance. Then afterwards it suffices to show how to deal with the case where all vertices in have the same list in polynomial time; this will be done in Phase 4 of the algorithm. We start with the following branching procedure (in each of the branches we may do some further branching later on).

Branching III ( branches)
We branch by considering the possibility of giving each vertex in colour 2 and all possibilities of choosing a vertex in and giving it colour 1. This leads to branches. In the first branch we obtain . Hence we can start Phase 4 for this branch. We now consider every branch in which and are both nonempty. For each such branch we will create smaller instances of List 3-Colouring, where , such that is a yes-instance of List 3-Colouring if and only if at least one of the new instances is a yes-instance.

Let be the vertex that was given colour 1 in such a branch. Although by Rule 4 vertex  will need to be removed from , we make an exception by temporarily keeping after we coloured it. The reason is that the presence of will be helpful for analysing the structure of after Rules 111 have been applied exhaustively (where we apply Rule 11 only after applying Rules 110 exhaustively). In order to do this, we first show the following three claims.

###### Claim 10.

Vertex is not adjacent to any vertex in .

Proof of Claim 10. By giving colour 1, the list of every neighbour of in has been reduced by one due to Rule 5. Hence, all neighbours of in are deactivated. For the same reason all neighbours of in , which have list , are coloured 2, and all neighbours of in , which have list , are coloured 3. These vertices were removed from the graph by Rule 4. This proves the claim.

###### Claim 11.

The graph is the disjoint union of one or more complete graphs, each of which consists of either one vertex of and at most two vertices of , or one vertex of .

Proof of Claim 11. We write and first show that is the disjoint union of one or more complete graphs. For contradiction, assume that is not such a graph. Then contains an induced , say on vertices in that order. As , we find that is not adjacent to any vertex of . By Claim 10, we find that is not adjacent to any vertex of . Recall that and are the only neighbours of in , whereas is the only neighbour of the vertices of in . Hence, induces a . This contradicts the -freeness of . We conclude that is the disjoint union of one or more complete graphs.

As is -free, the above means that every connected component of is a complete graph on at most three vertices, No vertex of is adjacent to a vertex in . Moreover, by definition, every vertex of is adjacent to at least one vertex of . As every connected component of is a complete graph, this means that no vertex of is adjacent to a vertex of either. We conclude that the vertices of are isolated vertices of .

Let be a connected component of that does not contain a vertex of . From the above we find that is a complete graph on at most three vertices. By definition, every vertex in has a neighbour in and every vertex of has a neighbour in . This means that either consists of one vertex in and at most two vertices of , or consists of two vertices of and one vertex of . We claim that the latter case is not possible. For contradiction, assume that is a triangle that consists of three vertices , where and . However, as , we find that by Rule 8, contradicting the fact that belongs to . This completes the proof of the claim.

###### Claim 12.

For every pair of adjacent vertices with and , either is adjacent to , or .

Proof of Claim 12. For contradiction, assume that is not adjacent to and that there is a vertex that is adjacent to but not to . By Claim 10, we find that is not adjacent to or . Just as in the proof of Claim 11, we find that together with