On 3-Coloring of (2 P 4 , C 5 )-Free Graphs ∗†

The 3-coloring of hereditary graph classes has been a deeply-researched problem in the last decade. A hereditary graph class is characterized by a (possibly inﬁnite) list of minimal forbidden induced subgraphs H 1 , H 2 , . . . ; the graphs in the class are called ( H 1 , H 2 , . . . )-free. The complexity of 3-coloring is far from being understood, even for classes deﬁned by a few small forbidden induced subgraphs. For H -free graphs, the complexity is settled for any H on up to seven vertices. There are only two unsolved cases on eight vertices, namely 2 P 4 and P 8 . For P 8 -free graphs, some partial results are known, but to the best of our knowledge, 2 P 4 -free graphs have not been explored yet. In this paper, we show that the 3-coloring problem is polynomial-time solvable on (2 P 4 , C 5 )-free graphs.


Introduction
Graph coloring is a notoriously known and well-studied concept in both graph theory and theoretical computer science.A k-coloring of a graph G = (V, E) is defined as a mapping c : V → {1, . . ., k} which is proper, i.e., it assigns distinct colors to u, v ∈ V if uv ∈ E. The k-coloring problem asks whether a given graph admits a k-coloring.For any k ≥ 3, the k-coloring is a wellknown NP-complete problem [27].We also define a more general list-k-coloring where each vertex v has a list P (v) of allowed colors such that P (v) ⊆ {1, . . ., k}.In that case, the coloring function c, in addition to being proper, has to respect the lists, that is, c(v) ∈ P (v) for every vertex v.
A graph class is hereditary if it is closed under vertex deletion.It follows that a graph class G is hereditary if and only if G can be characterized by a unique (not necessarily finite) set H G of minimal forbidden induced subgraphs.Special attention was given to hereditary graph classes where H G contains only one or only a very few elements.In such cases, when {H} = H G , or {H 1 , H 2 , . ..} = H G , we say that G ∈ G is H-free, or (H 1 , H 2 , . ..)-free, respectively.We let P t denote the path on t vertices, and C the cycle on vertices.We let H denote the complement of a graph H.For two graphs H 1 and H 2 , we let H 1 + H 2 denote their disjoint union, and we write kH for the disjoint union of k copies of a graph H.
In recent years, a lot of attention has been paid to determining the complexity of k-coloring of H-free graphs.Classical results imply that for every k ≥ 3, k-coloring of H-free graphs is NPcomplete if H contains a cycle [14] or an induced claw [24,30].Hence, it remains to consider the cases where H is a linear forest, i.e., a disjoint union of paths.The situation around complexity of (list) k-coloring on P t -free graphs where k ≥ 4 has been resolved completely.The cases k = 4, t ≥ 7 and k ≥ 5, t ≥ 6 are NP-complete [25] while cases for k ≥ 1, t = 5 are polynomial-time solvable [23].In fact, k-coloring is polynomial-time solvable on sP 1 + P 5 -free graphs for any s ≥ 0 [13].The borderline case where k = 4, t = 6 has been settled recently.There the 4-coloring problem (even the precoloring extension problem with 4 colors) is polynomial-time solvable [33] while the list 4-coloring problem is NP-complete [18].In 2021, Hajebi, Li, and Spirkl show that 5-coloring on 2P 4 -free graphs is NP-complete [21].Now, we move our focus towards the complexity of the 3-coloring problem, which was less well understood, in spite of the amount of the research interest it received in the past years.However, a considerable progress has been made in 2020; a quasi-polynomial algorithm running in time n O(log 2 (n)) on n-vertex P t -free graphs (t is a constant) was shown by Pilipczuk et al. [31], extending a breakthrough of Gartland and Lokshtanov [15].In the realms of polynomiality, Bonomo et al. [1] found a polynomial-time algorithm for P 7 -free graphs.Klimošová et al. [28] completed the classification of 3-coloring of H-free graphs, for any H on up to 7 vertices.These results were subsequently extended to P 6 + rP 3 -free graphs, for any r ≥ 0 [5].There are only two remaining graphs on at most 8 vertices, namely P 8 and 2P 4 , for which the complexity of 3-coloring is still unknown.
Algorithms for subclasses of P t -free graphs which avoid one or more additional induced subgraphs, usually cycles, have been studied.They might be a first step in the attempt to settle the case of P t -free graphs.This turned out to be the case for 3-coloring of P 7 -free graphs (as can be seen from preprints [2,7,8] leading to [1]) and 4-coloring of P 6 -free graphs [6].
Note that the problem of 4-coloring is NP-complete even when some (P t , C )-free graphs are considered when t ≥ 7. Hell and Huang [22] and Huang et al. [26] settled many NP-complete cases of this type.These results, in combination with the polynomiality of P 6 -free case, leave open only the following cases: (P 7 , C 7 )-, (P 8 , C 7 )-, and (P t , C 3 )-free graphs, for 7 ≤ t ≤ 21.
Chudnovsky and Stacho [11] studied the problem of 3-coloring of P 8 -free graphs which additionally avoid induced cycles of two distinct lengths; specifically, they consider graphs that are (P 8 , C 3 , C 4 )-free, (P 8 , C 3 , C 5 )-free, and (P 8 , C 4 , C 5 )-free.For the first two cases, they show that all such graphs are 3-colorable.For the last one, they provide a complete list of 3-critical graphs, i.e., the graphs with no 3-coloring such that all their proper induced subgraphs are 3-colorable.Independently, using a computer search, Goedgebeur and Schaudt [16] showed that there are only finitely many 3-critical (P 8 , C 4 )-free graphs.In fact, 3-coloring is polynomial-time solvable on (P t , C 4 )-free graphs for any t ≥ 1 [19].
The situation concerning 2P 4 or P 8 is still far from being determined when two forbidden induced subgraphs are considered; in particular, it is not known whether (P 8 , C 3 )-free, (P 8 , C 5 )free, (2P 4 , C 3 )-free, or (2P 4 , C 5 )-free graphs can be 3-colored in polynomial time 1 .This is in contrast with the algorithm for (P 7 , C 3 )-free graphs [3] which is considerably simpler than the one for P 7 -free graphs [1].Recently, Rojas and Stein [32] approached the problem by showing that for any odd t ≥ 9, there exists a polynomial-time algorithm that solves the 3-coloring problem in P t -free graphs of odd girth at least t − 2. In particular, their result implies that 3-coloring is polynomial-time solvable for (P 9 , C 3 , C 5 )-free graphs.
Freshly, a similar question was resolved in the case where, instead of a cycle, a 1-subdivision of K 1,s (a star with s leaves), denoted as SDK 1,s , is considered.Chudnovsky, Spirkl, and Zhong have shown that the class of (SDK 1,s , P t )-free graphs is list-3-colorable in polynomial time for any s, t ≥ 1 [10].For other related results and history of the problem, please consult a recent survey [17].
In this paper, we resolve one of the remaining open problems mentioned above, which considers 2P 4 -free graphs, as we will describe a polynomial-time algorithm for 3-coloring of (2P 4 , C 5 )-free graphs.To the best of our knowledge, this is a first attempt to attack the 3-coloring of 2P 4 -free graphs.
To prove our result, we will make use of some relatively standard techniques.Let ω(G) be the size of the largest clique of graph G.We use a seminal result of Grötschel, Lovász, and Schrijver [20] that shows the k-coloring problem on perfect graphs, i.e., graphs where each induced subgraph G is ω(G )-colorable, can be solved in polynomial time.Perfect graphs are characterized by the strong perfect graph theorem [9] as the graphs that have neither odd-length induced cycles nor complement of odd-length induced cycles on at least five vertices.
As K 4 and C 7 graphs are not 3-colorable, we can assume that our graph is (2P 4 , C 5 , C 7 , K 4 )free.As K 4 ⊆ C whenever ≥ 8 and 2P 4 ⊆ C whenever ≥ 10, it follows that either the graph is perfect, or it contains C 7 or C 9 .In the first case, we are done by the aforementioned polynomial-time algorithm.For the latter cases, we divide the analysis into two further subcases.First, we suppose that the graph is (2P 4 , C 5 , C 7 , C 7 , K 4 )-free and therefore it must contain C 9 .We analyze this case in Subsection 2.1.Second, we suppose that graph contains C 7 and we analyze this case in Subsection 2.3.
We will exploit the fact that once we find an induced P 4 , the vertices that are not adjacent to it must induce a P 4 -free graph (also known as cograph).Such graphs were among the first H-free graphs studied, and have many nice properties, e.g., any greedy coloring gives a proper coloring using the least number of colors [4].We will make use of a slightly stronger statement that handles the list-3-coloring problem.
The 3-coloring algorithm that we develop to prove Theorem 1.1 cannot be directly extended to solve the more general list-3-coloring problem, since it uses the 3-coloring algorithm for perfect graphs to deal with graphs avoiding C 7 and C 9 .However, apart from this one case, the algorithm works with the more general setting of list-3-coloring.In fact, we use reductions of lists as one of our base techniques.After several branching steps with polynomially many branches and suitable structural reductions of the original graph G, the algorithm will transform a 3-coloring instance of a (2P 4 , C 5 )-free graph G to a set of polynomially many heavily structured list-3-coloring instances.These structured instances can then be encoded by a 2-SAT formula, whose satisfiability is solvable in linear time [29].

Proof of Theorem 1.1
We are given a (2P 4 , C 5 )-free graph G = (V, E), and our goal is to determine whether it is 3-colorable.We will present an algorithm that solves this problem in polynomial time.The algorithm begins by checking that the graph is C 7 -free, and that the neighborhood of each vertex induces a bipartite graph, rejecting the instance if the check fails.Note that this check ensures, in particular, that G is K 4 -free.
The algorithm then partitions the graph into connected components, solving the 3-coloring problem for each component separately.From now on, we assume that the graph G = (V, E) is connected, C 7 -free, and each of its vertices has a bipartite neighborhood.
The basic idea of the algorithm is to choose an initial subgraph N 0 of bounded size, try all possible proper 3-colorings of N 0 , and analyze how the precoloring of N 0 affects the possible colorings of the remaining vertices.
We let N 1 denote the vertices in V \ N 0 which are adjacent to at least one vertex of N 0 , and we let N 2 be the set V \ (N 0 ∪ N 1 ).We will use the notation N (x) for the set of neighbors of x in G, and N i (x) for N i ∩ N (x).
Our algorithm will iteratively color the vertices of G.We will assume that throughout the algorithm, each vertex v has a list P (v) ⊆ {1, 2, 3} of available colors.We call P (v) the palette of v.The goal is then to find a proper coloring of G in which each vertex is colored by one of its available colors.The problem of deciding the existence of such coloring is known as the list-3-coloring problem, and is a generalization of the 3-coloring problem.
Whenever a vertex x of G is colored by a color c in the course of the algorithm, we immediately remove c from the palette of x's neighbors.Additionally, if the vertex x is not in N 0 , it is then deleted.The vertices in N 0 are kept in G even after they are colored.We then update the list-3-coloring instance using the following basic reductions: • If a vertex y has only one color c left in P (y), we color it by the color c and remove c from the palettes of its neighbors.If y ∈ N 0 , we then delete y.
• If P (y) is empty for a vertex y, the instance of list-3-coloring is rejected.
• If, for a vertex y ∈ N 0 , the size of P (y) is greater than the degree of y, we delete y.
• Diamond consistency rule: If y and y are a pair of nonadjacent vertices such that P (y) = P (y ), and if N (y) ∩ N (y ) is not an independent set, then any valid 3-coloring of G must assign the same color to y and y ; we therefore replace both P (y) and P (y ) with P (y)∩P (y ).
• Neighborhood domination rule: If y and y are a pair of nonadjacent vertices such that N (y) ⊆ N (y ) and P (y ) ⊆ P (y), and if y is not in N 0 , we delete y.
• If G has a connected component in which every vertex has at most two available colors, we determine whether the component is colorable by reducing the problem to an instance of 2-SAT.If the component can be colored, we remove it from G and continue, otherwise we reject the whole instance.
• If a connected component of G is P 4 -free, we solve the list-3-coloring problem for this component by Theorem 1.2.If the component is colorable we remove it, otherwise we reject the whole instance G.
It is clear that the rules are correct in the sense that the instance of list-3-coloring produced by a basic reduction is list-3-colorable if and only if the original instance was list-3-colorable.It is also clear that we may determine in polynomial time whether an instance of list-3-coloring (with fixed N 0 ) permits an application of a basic reduction, and perform the basic reduction, if available.Throughout the algorithm, we apply the basic reductions greedily as long as possible, until we reach a situation where none of them is applicable.
The basic reductions by themselves are not sufficient to solve the 3-coloring problem for G.Our algorithm will sometimes also need to perform branching, i.e., explore several alternative ways to color a vertex or a set of vertices.Formally, this means that the algorithm reduces a given instance G of list-3-coloring to an equivalent set of instances {G 1 , . . ., G k }; here saying that a list-3-coloring instance G is equivalent to a set {G 1 , . . ., G k } of instances means that G has a solution if and only if at least one of G 1 , . . ., G k has a solution.
In the beginning of the algorithm, we attach to each vertex v of G the list P (v) = {1, 2, 3} of available colors, thereby formally transforming it to an instance of list-3-coloring.The algorithm will then try all possible proper 3-colorings of N 0 , and for each such coloring, apply basic reductions as long as any basic reduction is applicable.If this fails to color all the vertices, more complicated reduction steps and further branching will be performed, to be described later.
Overall, the algorithm will ensure that the initial instance G is eventually reduced to a set of at most polynomially many smaller instances, each of which can be transformed to an equivalent instance of 2-SAT, which then can be solved efficiently.

The C 7 -free case
Our choice of N 0 will depend on the structure of G.More precisely, if G contains an induced copy of C 7 , we will choose one such copy as N 0 .This is by far the most challenging case, and we return to it later.
The case when G is C 7 -free can be handled in a simple way, as we now show.
Proof.Recall that we assume that G is K 4 -free and C 7 -free; otherwise G would clearly not be 3-colorable.Note that K 4 -freeness implies that G is C k -free for every k ≥ 8, and 2P 4 -freeness implies that G is C k -free for every k ≥ 10.
If G is also C 9 -free, then it is perfect by the strong perfect graph theorem, and since it is K 4 -free, it is 3-colorable.Assume then that G contains an induced copy of C 9 .Fix N 0 to be an induced copy of C 9 in G, and define N 1 and N 2 accordingly.We will show that for any proper coloring of N 0 , the basic reductions can solve the resulting list-3-coloring problem.
Fix a 3-coloring of N 0 , and apply the basic reductions, until none of them is applicable.We claim that this solves the instance completely, i.e., we either color the whole graph, or determine that no coloring exists.For contradiction, suppose that we reached a situation when G still contains uncolored vertices, but no basic reduction is applicable.
It follows that G contains a vertex with three available colors, and this vertex necessarily belongs to N 2 .In particular, N 2 is nonempty, and therefore we may find in G two adjacent vertices x, y with x ∈ N 1 and y ∈ N 2 .Recall that N 0 (x) is the set of vertices of N 0 adjacent to x.The vertices of N 0 (x) partition the cycle N 0 into edge-disjoint arcs, and at least one of these arcs has an odd number of edges.Let A be such an arc of odd length.
If A has length 1, then x is adjacent to two adjacent vertices of N 0 , hence the color of x is uniquely determined by the coloring of N 0 and x should have been deleted.If A has length 3 or 5, then A ∪ {x} induces a copy of C 5 or C 7 , respectively, which is impossible.Thus, A has length 7 or 9.In such case, we find a copy of 2P 4 in G, where one P 4 consists of y, x, a vertex z ∈ N 0 (x), and a vertex w ∈ A adjacent to z, while the other P 4 is formed by taking four consecutive internal vertices of A, each of which is at distance at least two from z and w; see Figure 1.In all cases we get a contradiction.
From now on, we assume that the graph G contains an induced C 7 .We choose one such C 7 as N 0 , and define N 1 and N 2 accordingly.

More complicated reductions
Apart from the basic reductions described previously, which we will apply whenever opportunity arises, we will also use more complicated reductions, to be applied in specific situations.
Cut reduction.Suppose G = (V, E) is a connected instance of list-3-coloring.Let X ⊆ V be a vertex cut of G, let C be a union of one or more connected components of G − X, and let C X be the subgraph of G induced by C ∪ X. Suppose further that the following conditions hold.
• C has at least two vertices.
• X is an independent set in G.
• All the vertices in X have the same palette, which has size 2.
• For any two vertices x, x in X, we have Assume without loss of generality that all the vertices of X have palette equal to {1, 2}.Let us say that a coloring c : X → {1, 2} of X is feasible for C, if it can be extended into a proper 3-coloring of the list-3-coloring instance C X .Note that the feasibility of a given coloring can be determined in polynomial time by Theorem 1.2, because C X is a cograph.
We distinguish three types of possible colorings of X: the all-1 coloring colors all the vertices of X by the color 1, the all-2 coloring colors all the vertices of X by color 2, and a mixed coloring is a coloring that uses both available colors on X. Observe that if X admits at least one mixed coloring feasible for C, then every (not necessarily mixed) coloring of X by colors 1 and 2 is feasible for C.This is because when we extend a mixed coloring of X to a coloring of C X , all the vertices y ∈ C must receive the color 3.If such a coloring of C exists, we can combine it with any coloring of X by colors 1 and 2.
The cut reduction of X and C is an operation which reduces G to a smaller, equivalent list-3-coloring instance, determined as follows.We choose an arbitrary mixed coloring c of X, and check whether it is feasible for C. If it is feasible, we reduce the instance G to G − C, leaving the palettes of the remaining vertices unchanged.The new instance is equivalent to the original one, since any proper list-3-coloring of G − C can be extended to a coloring of G, because all the colorings of X are feasible for C.
If the mixed coloring c is not feasible for C, we know that no mixed coloring is feasible.We then test the all-1 and the all-2 coloring for feasibility.If both are feasible, we reduce the instance G by replacing C with a single new vertex v, with palette P (v) = {1, 2}, and connecting v to all the vertices of X.Note that the reduced instance is an induced subgraph of the original one.It is easy to see that the reduced instance is equivalent to the original one.
If only one coloring of X is feasible for C, we delete C, color the vertices of X using the unique feasible coloring, and delete the corresponding color from the palettes of the neighbors of X in G − C. If no coloring of X is feasible for C, we declare that G is not list-3-colorable.

Neighborhood collapse.
Let G be an instance of list-3-coloring, and let v be a vertex of G. Suppose that N (v) induces in G a connected bipartite graph with nonempty partite classes X and Y .Suppose furthermore that all the vertices of X have the same palette P X , and all the vertices in Y have the same palette P Y .The neighborhood collapse of the vertex v is the operation that replaces X and Y by a pair of new vertices x and y, adjacent to each other and to v, with the property that any vertex of G − Y adjacent to at least one vertex in X will be made adjacent to x, and similarly every vertex adjacent to Y in G − X will be adjacent to y.We then set P (x) = P X and P (y) = P Y .Informally speaking, we have collapsed the vertices in X to a single vertex x, and similarly for Y and y.
It is clear that the collapsed instance is equivalent to the original one.However, since the new instance is not necessarily an induced subgraph of the original one, it might happen, e.g., that a collapse performed in a C 5 -free graph will introduce a copy of C 5 in the collapsed instance.In our algorithm, we will only perform collapses at a stage when C 5 -freeness will no longer be needed.
On the other hand, 2P 4 -freeness is preserved by collapses, as we now show.
Lemma 2.2.Let G be a 2P 4 -free instance of list-3-coloring in which a neighborhood collapse of a vertex v may be performed, and let G * be the graph obtained by the collapse.Then G * is 2P 4 -free.
Proof.Suppose G * contains an induced 2P 4 , and let P and Q be the two nonadjacent copies of P 4 .Let x and y be the two vertices obtained by collapsing sets X and Y , as in the definition of neighborhood collapse.Without loss of generality, P contains the vertex x.It follows that Q contains none of x, y or v, and in particular, Q is also a P 4 in G.
If the path P contains the edge xy, we may 'lift' P into the graph G by replacing the vertices x and y by appropriate vertices x ∈ X and y ∈ Y , and by replacing the edge xy by a shortest path from x to y in N (v).This transforms P into an induced path P in G on at least four vertices which is nonadjacent to Q. Thus, G also contains a 2P 4 .
Suppose now that P does not contain the edge xy, and therefore y is not in P .If x is the end-vertex of P , say P = xw 1 w 2 w 3 , we easily obtain a 2P 4 in G by simply replacing x by a vertex x ∈ X adjacent to w 1 in G. Suppose then that x is an internal vertex of P , say P = w 1 xw 2 w 3 .Since we know that P does not contain y, we may replace the vertex w 1 with v in P , knowing that vxw 2 w 3 is also an induced P 4 in G * nonadjacent to Q.By replacing the vertex x by a vertex x ∈ X adjacent to w 2 , we obtain the induced path vx w 2 w 3 in G which forms a 2P 4 together with Q.

Graphs containing C 7
We now turn to the most complicated part of our coloring algorithm, which solves the 3-coloring problem for a (2P 4 , C 5 )-free graph G that contains an induced C 7 .We let N 0 be an induced copy of C 7 in this graph, and define N 1 and N 2 accordingly.
We let v 1 , v 2 , . . ., v 7 denote the vertices of N 0 , in the order in which they appear on the cycle N 0 .We evaluate their indices modulo 7, so that, e.g., Fix a proper coloring of N 0 , and apply the basic reductions to G until no basic reduction is applicable.We now analyze the structure of G at this stage of the algorithm.We again let N 0 (x) denote the set of neighbors of x in N 0 .Lemma 2.3.After fixing the coloring of N 0 and applying all available basic reductions, the graph G has the following properties.
• Each induced copy of P 4 in G has at most two vertices in N 2 .
• G is connected.
Proof.To prove the first part, use the vertices of N 0 (x) to partition the cycle N 0 into edge-disjoint arcs.Note that none of these arcs has length 1, since then x would be adjacent to two vertices of distinct colors, and it would have been colored and deleted.Also, none of these arcs can have length 3, since such an arc together with the vertex x would induce a C 5 in G, contradicting C 5 -freeness.On the other hand, at least one of the arcs formed by N 0 (x) must have odd length.Thus, there is either an arc of length 7, implying N 0 (x) = {v i }, or there is an arc of length 5, implying N 0 (x) = {v i , v i+2 } for some i.This proves the first part of the lemma.To prove the second part, assume that P is an induced copy of P 4 in G with at least three vertices in N 2 .If P is fully contained in N 2 , then P forms a 2P 4 together with any P 4 contained in N 0 .Suppose that P \ N 2 consists of a single vertex x, as in Figure 2. Necessarily x is in N 1 , and by the first part of the lemma, N 0 \ N 0 (x) contains an induced P 4 which forms an induced 2P 4 with P .
To prove the last part of the lemma, note that N 0 is connected and therefore contained in a single component of G, and if G contained another connected component, then this other component would necessarily be P 4 -free and would be colored by a basic reduction.Lemma 2.3 is the last part of the proof that makes use of the C 5 -freeness of G. From now on, we will not need to use the fact that G is C 5 -free.In particular, we will allow ourselves reduction operations, such as the neighborhood collapse, which do not preserve C 5 -freeness.
We will assume, without mentioning explicitly, that after performing any modification of the list-3-coloring instance G, we always apply basic reductions until no more basic reductions are available.
In the rest of the proof, we use the term top component to refer to a connected component of N 2 .Observe that every top component is P 4 -free and therefore has a dominating set of size at most 2 [12].We say that a top component is relevant, if it contains a vertex z with |P (z)| = 3.Note that if G has no relevant top component, then all its vertices have at most two available colors, and the coloring problem can be solved by a single basic reduction.
We will say that a vertex x of N 1 is relevant if x is adjacent to a vertex belonging to a relevant top component.
Let x ∈ N 1 be a vertex, and let C be a top component.We say that x is a partial neighbor of C, if x is adjacent to at least one but not all the vertices of C. We say that x is a full neighbor of C, if it is adjacent to every vertex of C. Proof.Let y and z be two adjacent vertices belonging to C, such that x is adjacent to y but not to z. Suppose for contradiction that there is a vertex w ∈ N 2 adjacent to x but not belonging to C. Then wxyz is a copy of P 4 with three vertices in N 2 , as shown in Figure 3, which contradicts Lemma 2.3.This shows that x is not adjacent to any top component other than C.
Suppose now that N 0 (x) contains a single vertex v i .Then (a) The situation obtained from the assumption that N2(x) and N2(y) for x, y ∈ Ri are not comparable by inclusion.The dash-and-dot line represents an edge which is present in one case (red induced 2P4) and absent in the other (blue induced 2P4).
(b) The situation obtained when the neighborhoods of vertices in Ri in N2 are comparable by inclusion with N2(z) being the largest neighborhood.Note that these vertices are full neighbors of their top components.We will now reduce G to a set of polynomially many instances in which the set of relevant vertices has special form.We first eliminate the relevant vertices that have only one neighbor in N 0 .Let R i be the set of relevant vertices that are adjacent to v i and not adjacent to any other vertex of N 0 .Lemma 2.5.For any i ∈ {1, . . ., 7}, we can reduce G to an equivalent set of at most two instances, both of which satisfy R i = ∅.
Proof.By Lemma 2.4, we know that any vertex x ∈ R i is a full neighbor of each of its adjacent top components.
Let x, y be two distinct vertices of R i .We claim that the two sets N 2 (x) and N 2 (y) are comparable by inclusion.To see this, suppose for contradiction that there are vertices x ∈ N 2 (x) \ N 2 (y) and y ∈ N 2 (y) \ N 2 (x).Then we can find in G a copy of 2P 4 in which the first P 4 is v i+2 v i+3 v i+4 v i+5 , and the second P 4 is either x xyy Choose z ∈ R i so that N 2 (z) is as large as possible.In particular, for every x ∈ R i , we have N 2 (x) ⊆ N 2 (z).We then obtain two instances equivalent to G by coloring z by its two available colors.Note that by coloring z, we ensure that all the vertices N 2 (z) have at most two available colors, and since z is a full neighbor of all its adjacent top components, this ensures that the vertices of R i will no longer be relevant after z has been colored; see Figure 4b for illustration.
From now on, we deal with instances of G where every relevant vertex has exactly two neighbors in N 0 .Let S i be the set of relevant vertices adjacent to v i .
Figure 5: Considering a pair of vertices (x, y) of type γ for x ∈ S i , y ∈ S i+3 , the edge x y must be present, otherwise we obtain an induced 2P 4 .The other dashand-dotted edges are not necessarily present, and the vertex v i+5 is adjacent to at most one vertex from {x, y}.Proof.Suppose that the vertices in S i have available colors 1 and 2, while the vertices in S i+3 have available colors 2 and 3 (the case when the vertices in S i+3 have the same available colors as the vertices in S i is similar and we omit it).
For a pair of vertices x ∈ S i and y ∈ S i+3 , we distinguish the following three possibilities: (α) N 2 (x) and N 2 (y) are comparable by inclusion, (β) x is adjacent to y, or (γ) neither of the previous two conditions holds.
We say that the pair (x, y) is of type α if it satisfies the condition (α) above, and similarly for the other two types.Observe that if the pair (x, y) is of type γ, then there exist x ∈ N 2 (x) \ N 2 (y) and y ∈ N 2 (y) \ N 2 (x).Moreover, for any choice of such x and y , the pair x y must be an edge of G, otherwise x xv i v i−1 and y yv i+3 v i+4 would form a copy of 2P 4 .In particular, x and y belong to the same top component C, and both x and y are partial neighbors of C, as is depicted in Figure 5.
Let Z = S i ∪ S i+3 .Let m be the size of Z, and let us order the vertices of Z into a sequence We will reduce G to the set of all the instances that can be constructed by one of the following two rules: (a) All the vertices in Z are colored by their available color different from 2 (i.e., the vertices of S i are colored by 1, the vertices of S i+3 by 3).
(b) Fix a j ∈ {1, . . ., m} and proceed as follows: color the vertices z 1 , . . ., z j−1 by their available color different from 2, and color z j by 2.Moreover, if z j is a partial neighbor of a top component C, color a dominating set of size two in C, in all the possible ways.We now verify that in all the colorings described above, after all possible basic reductions are applied, either S i or S i+3 becomes empty.This is clearly the case for the coloring described in (a), in which all the vertices in S i ∪ S i+3 will be removed from G, so both sets will be empty.Consider now a coloring described in (b), and assume without loss of generality that z j is in S i .We claim that after the coloring is performed, there will be no relevant vertex left in S i+3 .To see this, consider a vertex z k ∈ S i+3 .If k < j, then z k has been colored by the color 3, see Figure 6.
If k > j we distinguish three possibilities depending on the type of the pair (z In particular, all the vertices in any top component adjacent to z k will only have two available colors (recall that if z j is a partial neighbor of a top component, we also color a dominating set of this top component, ensuring all its vertices have at most two available colors).Thus, z k will no longer be relevant.If the pair (z j , z k ) is of type β, i.e. z j z k is an edge, then z k has only the color 3 available and can be colored.Finally, suppose (z j , z k ) is of type γ.As discussed before, this means both z j and z k are partial neighbors of a top component C and have no other neighbors in N 2 .After the coloring is performed, all the vertices in C will have only two available colors, because we have colored its dominating set of size two.Hence z k is no longer relevant.We conclude that S i+3 becomes empty, as claimed.
It is clear that the coloring rules (a) and (b) admit only polynomially many possible colorings, and that any valid list coloring of G extends one of the partial colorings described in (a) or in (b).Thus, we reduced G to an equivalent set of polynomially many instances.
From now on, assume that we deal with an instance G in which for every i, one of the two sets S i and S i+3 is empty.Unless the instance is already completely solved, there must be at least one relevant vertex.Assume without loss of generality that G has a relevant vertex adjacent to v 1 and v 3 .It follows that S 1 and S 3 are nonempty, and hence S 4 , S 5 , S 6 and S 7 are empty.Moreover, as any relevant vertex is adjacent to a pair of vertices of the form {v i , v i+2 }, it follows that S 2 is empty as well.In particular, every relevant vertex x satisfies N 0 (x) = {v 1 , v 3 }.It follows that all the relevant vertices have the same palette of size 2; assume without loss of generality that this palette is {1, 2}.
We will now focus on describing the structure of the subgraph of G induced by the relevant vertices and the relevant top components adjacent to them.Let R denote the set of relevant vertices.Note that the subgraph of G induced by R ∪ N 2 does not contain P 4 , otherwise we could use the path v 4 v 5 v 6 v 7 to get a 2P 4 in G.
Note also that if two relevant vertices x and y are adjacent, then any common neighbor of x and y must be colored by color 3, thanks to the diamond consistency rule.We thus know that adjacent relevant vertices have no common neighbors outside N 0 .We may also assume that the graph induced by the relevant vertices is bipartite, otherwise G would clearly not be 3-colorable.Lemma 2.7.Suppose that x and y are two adjacent relevant vertices.Let us write X = N 2 (x) and Y = N 2 (y).Then there are disjoint sets X, Y ⊆ R, with x ∈ X and y ∈ Y , satisfying these properties: 2. X and Y are independent sets of G.
3. The vertices in X ∪Y are only adjacent to vertices in X ∪Y ∪X ∪Y ; in particular, X ∪Y induce a top component.
Proof.Consider the subgraph G[R] of G induced by the relevant vertices, and let C be the connected component of G[R] containing x and y.Recall that C must be bipartite.We let X and Y be its partite classes containing x and y, respectively.Note that C is complete bipartite, otherwise it would contain a P 4 .
We will now show that all the vertices in X have the same neighbors in N 2 .Indeed, if we could find a pair of vertices x 1 , x 2 ∈ X and a vertex x ∈ N 2 (x 1 ) not adjacent to x 2 , then x x 1 yx 2 would induce a P 4 .It follows that for every x 1 ∈ X we have N 2 (x 1 ) = X , and similarly for every We saw that adjacent relevant vertices have no common neighbors, so X and Y are disjoint.Every vertex in X must be adjacent to every vertex in Y , for if there were nonadjacent vertices x ∈ X and y ∈ Y , then x xyy would induce a P 4 .This proves the first claim of the lemma.
To prove the second claim, observe that X and Y are independent by construction.
To prove the third claim, proceed by contradiction and assume that a vertex x ∈ X ∪ Y is adjacent to a vertex z not belonging to X ∪ Y ∪ X ∪ Y .We may assume that x belongs to X .Necessarily, z belongs to R ∪ N 2 , and zx xy induces a forbidden P 4 .
Suppose G[R] contains at least one edge xy, and let X, Y, X , Y be as in the previous lemma.Note that there are only two possible ways to color G[X ∪ Y ] -either X is colored 1 and Y is colored 2, or vice versa.We can check in polynomial time which of these two colorings can be extended to a valid coloring of G[X ∪ Y ∪ X ∪ Y ].If neither of the two colorings extends, we reject G, if only one of the two coloring extends, we color X ∪ Y accordingly, and if both colorings extend, we remove the vertices X ∪ Y from G, resulting in a smaller equivalent instance, in which X ∪ Y are no longer relevant.Repeating this for every component of G[R] that contains at least one edge, we eventually reduce the problem to an instance in which the relevant vertices form an independent set.
From now on, we assume R is independent in G.For a vertex x ∈ R, let C 2 (x) denote the set of top components that contain at least one neighbor of x.Proof.Suppose the lemma fails for some x and y.We may then assume that there is a top we know from Lemma 2.4 that x is a full neighbor of all the top components in C 2 (x).Choose a vertex u ∈ C and a vertex v ∈ C ∩ N 2 (y).Then uxvy is a copy of P 4 in R ∪ N 2 , which is impossible.
Let us say that two relevant vertices x and y are equivalent if C 2 (x) = C 2 (y).As the next step in our algorithm, we will process the equivalence classes one by one, with the aim to reduce the instance G to an equivalent instance in which each relevant vertex is adjacent to a single top component.
Let x ∈ R be a vertex such that |C 2 (x)| ≥ 2, and let R x be the equivalence class containing x.By Lemma 2.4, each vertex in R x is a full neighbor of any component in C 2 (x), and by Lemma 2.8, no vertex outside of R x may be adjacent to a relevant top component in C 2 (x).Thus, R x is a vertex cut separating the relevant top components in C 2 (x) from the rest of G.We may therefore Figure 8: Illustrations to the proof of Lemma 2.9.The left part shows a situation when y is not adjacent to any vertex in N 2 (x), the right part shows a situation when y has a neighbour in N 2 (x) which is disconnected.Each part depicts two different possibilities.The blue P 4 shows the case y ∈ R x , while the red P 4 shows the case when y ∈ C. apply the cut reduction through the vertex cut R x to reduce G to a smaller instance in which the vertices of R x are no longer relevant.
We repeat the cut reductions until there is no relevant vertex adjacent to more than one top component.From now on, we deal with instances in which each relevant vertex is adjacent to a unique top component; note that this top component is necessarily relevant.Lemma 2.9.Let x be a relevant vertex, let C be the top component adjacent to x, let R x be the equivalence class of x, and let y ∈ R x ∪ C be a vertex not adjacent to x.Then y is adjacent to at least one vertex in N 2 (x).Moreover, if N 2 (x) induces a disconnected subgraph of G, then y is adjacent to all the vertices of N 2 (x).
Proof.Refer to Figure 8.If y is not adjacent to any vertex of N 2 (x), then we can find an induced path with at least four vertices by considering the shortest path from x to y in the graph induced by C ∪ {x, y}.Therefore y has at least one neighbor in N 2 (x).Suppose now that N 2 (x) is disconnected.If y is not adjacent to all the vertices of N 2 (x), then we can find a vertex u ∈ N 2 (x) adjacent to y, and a vertex v ∈ N 2 (x) nonadjacent to y, in such a way that u and v are in distinct components of N 2 (x).Then yuxv is an induced P 4 .
Fix now a relevant top component C and let R be set of relevant vertices in N 1 adjacent to C. Fix a vertex x ∈ R so that N 2 (x) is as large as possible.Let R x be the equivalence class containing x.We distinguish several possibilities, based on the structure of N 2 (x).
N 2 (x) is disconnected.Suppose first that N 2 (x) induces in G a disconnected subgraph.By Lemma 2.9, any vertex in R x is adjacent to all vertices in N 2 (x).By our choice of x, this implies that for any x ∈ R x we have N 2 (x ) = N 2 (x).We may therefore apply the cut reduction for the cut R x that separates C from the rest of G, to obtain a smaller instance in which the vertices of R x are no longer relevant.Figure 10: Recall that u is adjacent to all vertices of C. If there is a y ∈ C adjacent to both u and v, there is no other neighbor z of y.Otherwise, either zv is an edge, causing a K 4 , or zv is not an edge, causing an induced P 4 .N 2 (x) is connected, with ≥ 3 vertices.Now suppose that N 2 (x) induces a connected graph, and that N 2 (x) has at least three vertices.We now verify that N 2 (x) induces a complete bipartite graph, otherwise C contains P 4 or G is not 3-colorable.Let Y and Z be the two partite classes of N 2 (x).Note that any two vertices y, y in Y have the same neighbors in G: indeed if u were a vertex adjacent to y but not to y , then uyxy would induce a copy of P 4 , as depicted in Figure 9.By the same argument, all the vertices in Z have the same neighbors in G as well.Diamond consistency enforces that all the vertices in Y have the same palette, and similarly for Z.We may then invoke neighborhood domination to delete from Y all vertices except a single vertex y, and do the same with Z, reducing G to an equivalent instance in which N 2 (x) consists of a single edge.N 2 (x) is a single vertex.Suppose that N 2 (x) consists of a single vertex y.If y is the only vertex of C, then y must have the palette {1, 2, 3}, otherwise C would not be a relevant component.In such case, we may simply color y with color 3 and delete it, as this does not restrict the possible colorings of G − y in any way.If, on the other hand, C has more than one vertex, it follows from Lemma 2.9 that all the vertices of R x are adjacent to y, and by the choice of x, every vertex in R x is adjacent to y as its only neighbor in C. We may then apply cut reduction for the cut R x .In all cases, we obtain a smaller equivalent instance, in which the vertices in R x are no longer relevant.N 2 (x) is a single edge.The last case to consider deals with the situation when N 2 (x) contains exactly two adjacent vertices u and v. Assume that deg G (u) ≥ deg G (v). Recall that the set R of relevant vertices is independent.Note that for any vertex x ∈ R x , N 2 (x ) is connected, otherwise Lemma 2.9 implies that N 2 (x ) is contained in N 2 (x), contradicting N 2 (x) being a single edge.
We first claim that any vertex y ∈ R x ∪ (C − u) adjacent to v is also adjacent to u. Suppose this is not the case.Then, since deg G (u) ≥ deg G (v), there must also be a vertex z ∈ R x ∪ (C − v) adjacent to u but not to v. If yz is an edge, then zyvx is a copy of P 4 , and if yz is not an edge, then zuvy is a copy of P 4 , as shown in Figure 11.In both cases we have a contradiction, establishing the claim.Note that the claim, together with Lemma 2.9, implies that u is adjacent to all the other vertices of R x ∪ C.
Next, we show that if C contains a vertex adjacent to both u and v, then we may reduce G to a smaller equivalent instance.Suppose y ∈ C is adjacent to u and v. Then P (y) = P (x) = {1, 2} by diamond consistency.We now claim that y has no other neighbors in G beyond u and v. Suppose that z ∈ {u, v} is a neighbor of y.Then z cannot be adjacent to v, since uvyz would form a K 4 .Therefore zyvx is a copy of P 4 , a contradiction illustrated by Figure 10.We conclude that N (y) = {u, v} ⊆ N (x), and since P (y) = P (x), we may delete y due to neighborhood domination.
From now on, we assume that u and v have no common neighbor in C. Recall that u is adjacent to all the other vertices in C ∪ R x .We now reduce G to an instance where C − u is an independent set.We already know that v is isolated in C − u by the previous paragraph.Suppose that C − u has a component D with more than one vertex.If D has a vertex v adjacent to a vertex x ∈ R x , we can repeat the reasoning of the previous paragraph with x and v in the place of x and v, showing that u and v cannot have any common neighbor in C, contradicting the assumption that D has more than one vertex.We can thus conclude that D is not adjacent to any vertex in R x .Then u is a cut-vertex separating D from the rest of G.We may test which colorings of u can be extended into D (since D is P 4 -free, this can be done efficiently), then restrict the palette of u to only the feasible colors, and then delete D.  We are now left with a situation when C is a star with center u, and every vertex of R x is adjacent to u and to at most one vertex of C − u.If there is a vertex w ∈ C − u adjacent to more than one vertex in R x , it means that the neighborhood of w is a connected bipartite graph (a star with center u) to which we may apply neighborhood collapse; see Figure 12.
Suppose now that every vertex w ∈ C − u has only one neighbor in R x (if w had no neighbor in R x , it would have degree 1 and we could remove it).If w's palette has 3 colors, we can remove it, so we may assume that every vertex in C − u has a palette of size 2. Then u's palette must have 3 colors, otherwise C would not be a relevant component.If a vertex in C − u has palette {1, 2}, then u must be colored 3 and then R x is no longer relevant.
It remains to consider the case when each vertex of C − u has the palette {1, 3} or {2, 3}.Let W 1 and W 2 be the sets of vertices of C − u having palette {1, 3} and {2, 3}, respectively.Let X 1 and X 2 be the sets of vertices of R x that are adjacent to a vertex in W 1 and W 2 , respectively.Let X 0 be the set of vertices in R x that have no neighbor in C − u.The situation is shown in Figure 13.Let us consider the possible colorings of C ∪ R x .If u is colored by 3, then the whole set W 1 is colored by 1, W 2 is colored by 2, hence X 1 is colored by 2 and X 2 by 1, while the vertices in X 0 can be colored arbitrarily by 1 or 2. On the other hand, if u receives a color α = 3, then all the vertices in R x receive the color β ∈ {1, 2} \ {α}, and the vertices in C − u can be colored by 3. The set R x therefore admits three types of feasible colorings: the all-1 coloring, the all-2 coloring, and any coloring where the set X 1 is colored by 2 and X 2 by 1.This set of colorings can be equivalently characterized by the following properties: • If a vertex in X 1 is colored by 1, then the whole R x receives 1.
• If a vertex in X 2 is colored by 2, then the whole R x is colored by 2.
• All the colors in X 1 are equal and all the colors in X 2 are equal.
The above properties can be encoded by a 2-SAT formula whose variables correspond to vertices of R x .
To summarize, we have shown that a 3-coloring instance G can be reduced to an equivalent set of polynomially many simpler list-3-coloring instances.The structure of these simpler instances guarantees that for any relevant top component C, we can form a 2-SAT formula describing the colorings of the relevant vertices adjacent to C that can be extended to a proper coloring of C.Moreover, in the subgraph of G induced by the vertices not belonging to any relevant top component, each vertex has a palette of size at most two.The colorings of this subgraph can again be encoded by a 2-SAT formula.Such an instance of list-3-coloring then admits a solution if and only if there is a satisfying assignment for the conjunction of the 2-SAT formulas described above.The existence of such an assignment can be found in polynomial time.This completes the proof of Theorem 1.1.

Conclusions
We have shown that 3-coloring on (2P 4 , C 5 )-free graphs is solvable in polynomial time.As we discussed in the introduction, this approach might serve as a step towards resolving 3-coloring on 2P 4-free graphs because it remains to consider 2P 4-free graphs containing C 5 .
Apart from the main question above, under more refined scale, the complexity of 3-coloring on (2P 4 , C 3 )-free, (P 8 , C 3 )-free, or (P 8 , C 5 )-free graphs remains unknown.In another direction, it would be interesting to extend our result to the list 3-coloring setting.

Figure 1 :
Figure 1: Picture showing the induced 2P 4 in the case of G being C 7 -free.If the dash-and-dotted edge is present, A has length 7, otherwise A has length 9.

Figure 2 :
Figure 2: Finding an induced 2P4 , assuming P is an induced P 4 with exactly three vertices in N 2 .Note that P can look differently, but always contains x. Figure 3: Vertex x ∈ N 1 being a partial neighbor of a top component C and neighboring another top component C leads to an induced 2P 4 .

Figure 3 :
Figure 2: Finding an induced 2P4 , assuming P is an induced P 4 with exactly three vertices in N 2 .Note that P can look differently, but always contains x. Figure 3: Vertex x ∈ N 1 being a partial neighbor of a top component C and neighboring another top component C leads to an induced 2P 4 .

Lemma 2 . 4 .
Suppose x ∈ N 1 is a partial neighbor of a top component C. Then x is not a neighbor of any other top component.Moreover, |N 0 (x)| = 2.

Figure 4 :
Figure 4: Illustrations of the situations in the proof of Lemma 2.5.

Figure 7 :
Figure 7: The situation considered in the remaining part of the main proof.

Lemma 2 . 8 .
For any two relevant vertices x and y, we either have C 2 (x) = C 2 (y), or C 2 (x) and C 2 (y) are disjoint.

Figure 11 :
Figure 11: Illustrations of the situation when N 2 (x) is a single edge uv.Again, case y ∈ R x is shown as blue y and blue P 4 , while y ∈ (C − u) is shown as red y and red P 4 .There are two subcases corresponding to yz being an edge or not.

Figure 9 :
Figure 9: There is an induced P 4 in N 2 if N 2 (x) is connected with ≥ 3 vertices and for y, y ∈ Y there exists a u neighboring only one of them.

Figure 12 :
Figure 12: Situation in which we can apply a neighborhood collapse.

Figure 13 :
Figure 13: The last case in which each vertex of C − u has palette {1, 3} or {2, 3}.The blue text represents the three possibilities to color u and what colors that implies for other parts of the graph.