 # Four-coloring P_6-free graphs. I. Extending an excellent precoloring

This is the first paper in a series whose goal is to give a polynomial time algorithm for the 4-coloring problem and the 4-precoloring extension problem restricted to the class of graphs with no induced six-vertex path, thus proving a conjecture of Huang. Combined with previously known results this completes the classification of the complexity of the 4-coloring problem for graphs with a connected forbidden induced subgraph. In this paper we give a polynomial time algorithm that determines if a special kind of precoloring of a P_6-free graph has a precoloring extension, and constructs such an extension if one exists. Combined with the main result of the second paper of the series, this gives a complete solution to the problem.

## 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

All graphs in this paper are finite and simple. We use to denote the set . Let be a graph. A -coloring of is a function . A -coloring is proper if for every edge , , and is -colorable if has a proper -coloring. The -coloring problem is the problem of deciding, given a graph , if is -colorable. This problem is well-known to be -hard for all .

A function that assigns a subset of to each vertex of a graph is a -list assignment for . For a -list assignment , a function is an -coloring if is a -coloring of and for all . A graph is -colorable if has a proper -coloring. We denote by the set of all vertices of with . The -list coloring problem is the problem of deciding, given a graph and a -list assignment , if is -colorable. Since this generalizes the -coloring problem, it is also -hard for all .

A -precoloring of a graph is a function for a set such that is a proper -coloring of . Equivalently, a -precoloring is a -list assignment in which for all . A -precoloring extension for is a proper -coloring of such that , and the -precoloring extension problem is the problem of deciding, given a graph and a -precoloring , if has a -precoloring extension.

We denote by the path with vertices. Given a path , its interior is the set of vertices that have degree two in . We denote the interior of by . A in a graph is a sequence of pairwise distinct vertices where for , is adjacent to if and only if . We denote by the set , and if , say and and , then is the path . A graph is -free if there is no in . Throughout the paper by “polynomial time” or “polynomial size” we mean running time, or size, that is polynomial in .

Since the -coloring problem and the -precoloring extension problem are -hard for , their restrictions to graphs with a forbidden induced subgraph have been extensively studied; see [2, 7] for a survey of known results. In particular, the following is known (given a graph , we say that a graph is -free if no induced subgraph of is isomorphic to ):

###### Theorem 1 ().

Let be a (fixed) graph, and let . If the -coloring problem can be solved in polynomial time when restricted to the class of -free graphs, then every connected component of is a path.

Thus if we assume that is connected, then the question of determining the complexity of -coloring -free graph is reduced to studying the complexity of coloring graphs with certain induced paths excluded, and a significant body of work has been produced on this topic. Below we list a few such results.

###### Theorem 2 ().

The 3-coloring problem can be solved in polynomial time for the class of -free graphs.

###### Theorem 3 ().

The -coloring problem can be solved in polynomial time for the class of -free graphs.

###### Theorem 4 ().

The 4-coloring problem is -complete for the class of -free graphs.

###### Theorem 5 ().

For all , the -coloring problem is -complete for the class of -free graphs.

The only cases for which the complexity of -coloring -free graphs is not known are , , and , . This is the first paper in a series of two. The main result of the series is the following:

###### Theorem 6.

The 4-precoloring extension problem can be solved in polynomial time for the class of -free graphs.

In contrast, the -list coloring problem restricted to -free graphs is -hard as proved by Golovach, Paulusma, and Song . As an immediate corollary of Theorem 6, we obtain that the -coloring problem for -free graphs is also solvable in polynomial time. This proves a conjecture of Huang , thus resolving the former open case above, and completes the classification of the complexity of the -coloring problem for graphs with a connected forbidden induced subgraph.

Let be a graph. For we denote by the subgraph induced by on , and by the graph . If , we write to mean . For disjoint subsets we say that is complete to if every vertex of is adjacent to every vertex of , and that is anticomplete to if every vertex of is non-adjacent to every vertex of . If we write is complete (or anticomplete) to to mean that is complete (or anticomplete) to . If is not complete and not anticomplete to , we say that is mixed on . Finally, if is an induced subgraph of and , we say that is complete to, anticomplete to, or mixed on if is complete to, anticomplete to, or mixed on , respectively. For we write (or when there is no danger of confusion) to mean the set of vertices of that are adjacent to . Observe that since is simple, . For , an attachment of is a vertex of complete to . For we denote by the set of attachments of in . If , we sometimes write to mean .

Given a list assignment for , we say that the pair is colorable if is -colorable. For , we write to mean the list coloring problem where we restrict the domain of the list assignment to . Let be such that for every , and let . We say that a list assignment is obtained from by updating from if for every , and for every . If , we say that is obtained from by updating from . If is obtained from by updating from , we say that is obtained from by updating. Let , and for let be obtained from by updating. If , we say that is obtained from by updating exhaustively. Since for all , it follows that and thus can be computed from in polynomial time.

An excellent starred precoloring of a graph is a six-tuple such that

1. is a proper coloring of ;

2. ;

3. is connected and no vertex in is complete to ;

4. every vertex in has neighbors of at least two different colors (with respect to ) in ;

5. no vertex in is mixed on a component of ; and

6. for every component of , there is a vertex in complete to it.

We call the seed of . We define two list assignments associated with . First, define for every , and let for . Second, is the list assignment obtained as follows. First, define to be the list assignment for obtained from by updating exhaustively; let . Now define if , and if . Let . Then . A precoloring extension of is a proper -coloring of such that for every ; it follows that for every . It will often be convenient to assume that , and this assumption can be made without loss of generality. Note that in this case, for all .

For an excellent starred precoloring and a collection excellent starred of precolorings, we say that is an equivalent collection for (or that is equivalent to ) if has a precoloring extension if and only if at least one of the precolorings in has a precoloring extension, and a precoloring extension of can be constructed from a precoloring extension of a member of in polynomial time.

We break the proof of Theorem 6 into two independent parts, each handled in a separate paper of the series. In one part, we reduce the 4-precoloring extension problem for -free graphs to determining if an excellent starred precolorings of a -free graph has a precoloring extension, and finding one if it exists. In fact, we restrict the problem further, by ensuring that there is a universal bound (that works for all -precolorings of all -free graphs) on the size of the seed of the excellent starred precolorings that we need to consider. More precisely, we prove:

###### Theorem 7.

There exists an integer and a polynomial-time algorithm with the following specifications.

Input: A 4-precoloring of a -free graph .

Output: A collection of excellent starred precolorings of such that

1. If for every we can in polynomial time either find a precoloring extension of , or determine that none exists, then we can construct a 4-precoloring extension of in polynomial time, or determine that none exists:

2. ; and

3. for every ,

• ;

• ;

• is an induced subgraph of ; and

• .

The proof of Theorem 7 is hard and technical, and we postpone it to the second paper of the series . The other part of the proof of Theorem 6 is an algorithm that tests in polynomial time if an excellent starred precoloring (where the size of the seed is fixed) has a precoloring extension. The goal of the present paper is to solve this problem. We prove:

###### Theorem 8.

For every positive integer there exists a polynomial-time algorithm with the following specifications.

Input: An excellent starred precoloring of a -free graph with .

Output: A precoloring extension of or a determination that none exists.

Clearly, Theorem 7 and Theorem 8 together imply Theorem 6. The proof of Theorem 8 consists of several steps. At each step we replace the problem that we are trying to solve by a polynomially sized collection of simpler problems, and the problems created in the last step can be encoded via 2-SAT. Here is an outline of the proof. First we show that an excellent starred precoloring of a -free graph can be replaced by a polynomially sized collection of excellent starred precolorings of that have an additional property (to which we refer as “being orthogonal”) and has a precoloring extension if and only if some member of does. Thus in order to prove Theorem 8, it is enough to be able to test if an orthogonal excellent starred precoloring of a -free graph has a precoloring extension. Our next step is an algorithm whose input is an orthogonal excellent starred precoloring of a -free graph , and whose output is a “companion triple” for . A companion triple consists of a graph that may not be -free, but certain parts of it are, a list assignment for , and a correspondence function that establishes the connection between and . Moreover, in order to test if has a precoloring extension, it is enough to test if is colorable.

The next step of the algorithm is replacing by a polynomially sized collection of list assignments for , such that is colorable if and only if there exists such that is colorable, and in addition for every the pair is “insulated”. Being insulated means that is the union of four induced subgraphs , and in order to test if is colorable, it is enough to test if is colorable for each . The final step of the algorithm is converting the problem of coloring each into a -SAT problem, and solving it in polynomial time. Moreover, at each step of the proof, if a coloring exists, then we can find it, and convert in polynomial time into a precoloring extension of .

This paper is organized as follows. In Section 2 we produce a collection of orthogonal excellent starred precolorings. In Section 3 we construct a companion triple for an orthogonal precoloring. In Section 4 we start with a precoloring and its companion triple, and construct a collection of lists such that every pair is insulated. Finally, in Section 5 we describe the reduction to 2-SAT. Section 6 contains the proof of Theorem 8 and of Theorem 6.

## 2 From Excellent to Orthogonal

Let be an excellent starred precoloring. For , the type of is the set . Thus the number of possible types for a given precoloring is at most . In this section we will prove several lemmas that allow us to replace a given precoloring by an equivalent polynomially sized collection of “nicer” precolorings, with the additional property that the size of the seed of each of the new precolorings is bounded by a function of the size of the seed of the precoloring we started with. Keeping the size of the seed bounded allows us to maintain the property that the number of different types of vertices of is bounded, and therefore, from the point of view of running time, we can always consider each type separately.

For we denote by the set . Thus if is of type , then . For and we denote by the set of vertices of of type .

A subset of is orthogonal if there exist such that for every either or . We say that is orthogonal if is orthogonal for every .

The goal of this section is to prove that for every excellent starred precoloring of a -free graph , there is a an equivalent collection of orthogonal excellent starred precolorings of . We start with a few technical lemmas.

###### Lemma 1.

Let be an excellent starred precoloring of a -free graph . Let and . Let be types such that and , and let and . Suppose that are such that , where possibly . Suppose further that the only possible edge among is , and is adjacent to and not to , and is adjacent to and not to . Then there does not exist with and such that is complete to and anticomplete to .

###### Proof.

Suppose such exists. Since no vertex of is mixed on a component of , it follows that is anticomplete to . Since and , it follows that there exists with . Similarly, there exists with . Since and , it follows that is anticomplete to and is anticomplete to .

Since it follows that is anticomplete to . Since (possibly shortcutting through ) is not a in , it follows that is adjacent to . If is non-adjacent to , and is non-adjacent to , then , and since is excellent, is non-adjacent to , and so is a , a contradiction, so we may assume that is adjacent to . But now is a , a contradiction. This proves Lemma 1. ∎

###### Lemma 2.

Let be an excellent starred precoloring of a -free graph . Let . Let be types such that and , and let and . Let with , and let with , where possibly and . Assume that

• some component of contains both ;

• some component of contains both ;

• for every there is a path in from to with for every ;

• the only possible edge among is ;

• are adjacent to and not to ;

• are adjacent to and not to .

Then there do not exist with , and such that

• some component of contains both and , and

• for every , and

• is complete to and anticomplete to .

###### Proof.

Suppose such exist. Since is an excellent starred precoloring, no vertex of is mixed on a component of , and therefore is anticomplete to . Since and , it follows that there exists with . Similarly, there exists with . Since and , it follows that is anticomplete to and is anticomplete to . Since , it follows that is anticomplete to , and similarly is anticomplete to .

First we prove that is adjacent to . Suppose not. Since is not a in , it follows that is non-adjacent to . But now or is a in , a contradiction. This proves that is adjacent to .

If is adjacent to , then is a , a contradiction. Therefore is non-adjacent to , and therefore is anticomplete to . Similarly, is anticomplete to . In particular it follows that .

Since there exists with such that is complete to . Since for every , it follows that is anticomplete to . Recall that , and so no vertex of is mixed on . Similarly no vertex of is mixed on . If is anticomplete to , then one of , , is a , so is complete to .

Since is not a , it follows that either is adjacent to , or is adjacent to . We may assume that is adjacent to .

Let be a path in from to with for every . Since is adjacent to and not to , there is exist adjacent such that is adjacent to and not to . Since for every , it follows that is anticomplete to . But now if is non-adjacent to , then is a , and if is adjacent to , then is a ; in both cases a contradiction. This proves Lemma 2. ∎

Let be an excellent starred precoloring of a -free graph . Let , and let . Let be such that and is a 4-precoloring of . Let be the set of vertices of such that as a neighbor with . Let

 S′=S∪S′′
 X′0=X0∪X′′∪X′′0
 X′=X∖(X′′∪S′′∪X′′0)
 Y∗′=Y∗∖X′′0.

We say that is obtained from by moving to the seed with colors , and moving to with colors . Sometimes we say that “we move to with colors , and to with colors ”.

In the next lemma we show that this operation creates another excellent starred precoloring.

###### Lemma 3.

Let be an excellent starred precoloring of a -free graph . Let and , and let be as above. Then either is an excellent starred precoloring.

###### Proof.

We need to check the following conditions:

1. is a proper coloring of ;

2. ;

3. is connected and no vertex in is complete to ;

4. every vertex in has neighbors of at least two different colors (with respect to ) in ;

5. no vertex in is mixed on a component of ; and

6. for every component of , there is a vertex in complete to it.

Next we check the conditions.

1. holds by the definition of .

2. holds since .

3. is connected since is connected, and every has a neighbor in . Moreover, since no vertex of is complete to , it follows that no vertex of is complete to .

4. follows from the fact that .

5. follows from the fact that and .

6. follows from the fact that and .

Let be an excellent starred precoloring. Let . Write For let (or when there is no danger of confusion) denote the vertex set of the component of that contains .

Let be an excellent starred precoloring, and let . We say that is -clean if there does not exist with the following properties:

• , and

• there is with , and

• has both a neighbor in and a neighbor in .

We say that is clean if it is -clean for every .

We say that is -tidy if there do not exist vertices such that

• , , and

• , and

• there is a path from to in such that for every , and

• there is with , and

• has a neighbor in and a neighbor in

Observe that since no vertex of is mixed on an a component of , it follows that is precisely the set of vertices of that are complete to , and an analogous statement holds for . We say that is tidy if it is -tidy for every .

We say that is -orderly if for every in with , is complete to . We say that is orderly if it is -orderly for every

Finally, we say that is -spotless if no vertex in with has both a neighbor in and a neighbor in . We say that is spotless if it is -spotless for every

Our goal is to replace an excellent starred precoloring by an equivalent collection of spotless precolorings. First we prove a lemma that allows us to replace an excellent starred precoloring with an equivalent collection of clean precolorings.

###### Lemma 4.

There is a function such that the following holds. Let be a -free graph, and let be an excellent starred precoloring of . Then there is an algorithm with running time that outputs a collection of excellent starred precolorings of such that:

• ;

• for every ;

• every is -clean for every for which is -clean;

• every is -clean;

• is an equivalent collection for .

###### Proof.

Without loss of generality we may assume that . Thus for every . We may assume that is not -clean for otherwise we may set . Let be the set of vertices of with and such that some has . Let be the subsets of with and the subsets of with . Let be the collection of all -tuples

 ((S1,Q1),(S