Clique-width and Well-Quasi-Ordering of Triangle-Free Graph Classes

Daligault, Rao and Thomass\'e asked whether every hereditary graph class that is well-quasi-ordered by the induced subgraph relation has bounded clique-width. Lozin, Razgon and Zamaraev (JCTB 2017+) gave a negative answer to this question, but their counterexample is a class that can only be characterised by infinitely many forbidden induced subgraphs. This raises the issue of whether the question has a positive answer for finitely defined hereditary graph classes. Apart from two stubborn cases, this has been confirmed when at most two induced subgraphs $H_1,H_2$ are forbidden. We confirm it for one of the two stubborn cases, namely for the $(H_1,H_2)=(\mbox{triangle},P_2+P_4)$ case, by proving that the class of $(\mbox{triangle},P_2+P_4)$-free graphs has bounded clique-width and is well-quasi-ordered. Our technique is based on a special decomposition of $3$-partite graphs. We also use this technique to prove that the class of $(\mbox{triangle},P_1+P_5)$-free graphs, which is known to have bounded clique-width, is well-quasi-ordered. Our results enable us to complete the classification of graphs $H$ for which the class of $(\mbox{triangle},H)$-free graphs is well-quasi-ordered.

Well-quasi-orderings. A graph class G is well-quasi-ordered by a containment relation if for any infinite sequence G 0 , G 1 , . . . these cases, it is neither known whether the graph class under consideration has bounded clique-width nor whether it is well-quasi-ordered by the induced subgraph relation.
Results and methodology. In Section 5, we prove that Conjecture 1 holds for the class of (K 3 , P 2 + P 4 )-free graphs by showing that this class has bounded clique-width and is well-quasi-ordered by the induced subgraph relation. Instead of using ad hoc arguments, we emphasize that our underlying research goal is to develop methodology that could also be applied more widely to other classes and which increases our understanding of the structure of special graph classes. In this paper we focus on K 3 -free graphs and we prove the two results on (K 3 , P 2 + P 4 )-free graphs by using a general method explained in Section 4.
Our method is based on extending (a labelled version of) well-quasi-orderability or boundedness of clique-width of the bipartite graphs in a hereditary graph class X to a special subclass of 3-partite graphs in X . The crucial property of these 3-partite graphs is that no three vertices from the three different partition classes form a clique or independent set. We say that such 3-partite graphs are curious. The method finds its origin in a paper of Fouquet, Giakoumakis and Vanherpe [24], who characterized totally decomposable bipartite graphs, that is, bipartite graphs that can recursively be canonically decomposed into graphs isomorphic to an isolated vertex. Dabrowski, Dross and Paulusma [12] generalized this decomposition from bipartite graphs to k-partite graphs for any k ≥ 2 and partially characterized totally 3-decomposable graphs. This sufficed to prove that (K 3 , P 1 + P 5 )-free graphs have bounded clique-width [12], but it is not strong enough for our purposes.
Our new decomposition method allows us to also deal with curious graphs that are not totally 3-decomposable.
In Section 5 we show how to generalize results for curious (K 3 , P 2 + P 4 )-free graphs to the whole class of (K 3 , P 2 + P 4 )-free graphs. Due to the generality of our method, it immediately follows that the class of (K 3 , P 1 + P 5 )-free graphs is also well-quasi-ordered, which was not previously known (see [3,33]). Since (K 3 , P 1 + 2P 2 )-free graphs are (K 3 , P 1 + P 5 )-free (and (K 3 , P 2 + P 4 )-free), our results immediately imply that the class of (K 3 , P 1 + 2P 2 )-free graphs is also well-quasi-ordered by the induced subgraph relation, which was also previously unknown (see [3,33]). As mentioned, it was already known [12] that the class of (K 3 , P 1 + P 5 )-free graphs has bounded clique-width (and so the same was known for the class of (K 3 , P 1 + 2P 2 )-free graphs); as we will see, this also follows directly from our method. See Fig. 1 for pictures of the forbidden induced subgraphs mentioned in this paragraph. Dichotomy for K 3 -free graphs. Previously, well-quasi-orderability was known for (K 3 , P 6 )-free graphs [3], (P 2 + P 4 )-free bipartite graphs [32] and (P 1 + P 5 )-free bipartite graphs [32]. It has also been shown that H -free bipartite graphs are not well-quasi-ordered if H contains an induced 3P 1 + P 2 [33], 3P 2 [20] or 2P 3 [32]. Moreover, for every s ≥ 1, the class of (K 3 , sP 1 )-free graphs is finite due to Ramsey's Theorem [40]. The above results lead to the following known dichotomy for H -free bipartite graphs. 1 for some s ≥ 1 or H is an induced subgraph of P 1 + P 5 , P 2 + P 4 or P 6 . Now combining the aforementioned known results for (K 3 , H)-free graphs and H -free bipartite graphs with our new results yields the following new dichotomy for H -free triangle-free graphs, which is exactly the same as the one in Theorem 1.

Theorem 2.
Let H be a graph. The class of (K 3 , H)-free graphs is well-quasi-ordered by the induced subgraph relation if and only if H = sP 1 for some s ≥ 1 or H is an induced subgraph of P 1 + P 5 , P 2 + P 4 , or P 6 .
Besides our method based on curious graphs, we also expect that Theorem 2 will itself be a useful ingredient for showing results on well-quasi-orderability for other graph classes, just as Theorem 1 has already proven to be useful for this (see e.g. [32]).
For clique-width the following dichotomy is known for H -free bipartite graphs; see Section 2 for the definition of the graph S h,i, j . 1 for some s ≥ 1 or H is an induced subgraph of K 1,3 + 3P 1 , K 1,3 + P 2 , P 1 + S 1,1,3 or S 1,2,3 .

Theorem 3 ([16]). Let H be a graph. The class of H-free bipartite graphs has bounded clique-width if and only if H = sP
It would be interesting to determine whether (K 3 , H)-free graphs allow the same dichotomy with respect to the boundedness of their clique-width. The evidence so far is affirmative, but in order to answer this question two remaining cases need to be solved, namely (H 1 , H 2 ) = (K 3 , P 1 + S 1,1,3 ) and (H 1 , H 2 ) = (K 3 , S 1,2,3 ). Both cases turn out to be highly nontrivial; in particular, the class of (K 3 , P 1 + S 1,1,3 )-free graphs contains the class of (K 3 , P 1 + P 5 )-free graphs, and the class of (K 3 , S 1,2,3 )-free graphs contains both the classes of (K 3 , P 1 + P 5 )-free and (K 3 , P 2 + P 4 )-free graphs.
In Section 6 we give state-of-the-art summaries for well-quasi-orderability and boundedness of clique-width of bigenic graph classes (which include our new results), together with an overview of the missing cases for both problems (which include the missing cases mentioned in this section). In particular, these summaries show that our results for (K 3 , P 2 + P 4 )-free graphs are tight in the sense that (H, P 2 + P 4 )-free graphs have unbounded clique-width and are not well-quasi-ordered by the induced subgraph relation for any induced supergraph H of K 3 , unless H is the paw (the graph P 1 + P 3 ). In Section 7 we conclude our paper with some remarks for future work.

Preliminaries
Throughout the paper, we consider only finite, undirected graphs without multiple edges or self-loops. Below, we define further graph terminology.
The disjoint union (V (G) ∪ V (H), E(G) ∪ E(H)) of two vertex-disjoint graphs G and H is denoted by G + H and the disjoint union of r copies of a graph G is denoted by rG. The complement G of a graph G has vertex set V (G) = V (G) and an edge between two distinct vertices u, v if and only if uv / ∈ E(G). For a subset S ⊆ V (G), we let G[S] denote the subgraph of G induced by S, which has vertex set S and edge set {uv | u, v ∈ S, uv ∈ E(G)}. If S = {s 1 , . . . , s r } then, to simplify notation, we may also write G[s 1 , . . . , s r ] instead of G[{s 1 , . . . , s r }]. We use G \ S to denote the graph obtained from G by deleting every vertex in S, that is, G \ S = G[V (G) \ S]. We write G ⊆ i G to indicate that G is an induced subgraph of G.
The graphs C r , K r , K 1,r−1 and P r denote the cycle, complete graph, star and path on r vertices, respectively. The graphs K 3 and K 1,3 are also called the triangle and claw, respectively. A graph G is a linear forest if every component of G is a path (on at least one vertex). The graph S h,i, j , for 1 ≤ h ≤ i ≤ j, denotes the subdivided claw, that is, the tree that has only one vertex x of degree 3 and exactly three leaves, which are at distance h, i and j from x, respectively. Observe that S 1,1,1 = K 1,3 . We let S denote the class of graphs, each connected component of which is either a subdivided claw or a path.
For a set of graphs {H 1 , . . . , H p }, a graph G is (H 1 , . . . , H p )-free if it has no induced subgraph isomorphic to a graph in {H 1 , . . . , H p }; if p = 1, we may write H 1 -free instead of (H 1 )-free. A graph is k-partite if its vertex can be partitioned into k (possibly empty) independent sets; 2-partite graphs are also known as bipartite graphs. The biclique or complete bipartite graph K r,s is the bipartite graph with sets in the partition of size r and s respectively, such that every vertex in one set is adjacent to every vertex in the other set. For a graph G = (V , E), the set N(u) = {v ∈ V | uv ∈ E} denotes the neighbourhood of u ∈ V . Let X be a set of vertices in G. A vertex y ∈ V \ X is complete to X if it is adjacent to every vertex of X and anti-complete to X if it is non-adjacent to every vertex of X . A set of vertices Y ⊆ V \ X is complete (resp. anti-complete) to X if every vertex in Y is complete (resp. anti-complete) to X . If X and Y are disjoint sets of vertices in a graph, we say that the edges between these two sets form a matching if each vertex in X has at most one neighbour in Y and vice versa; if each vertex has exactly one such neighbour, we say that the matching is perfect. Similarly, the edges between these sets form a co-matching if each vertex in X has at most one non-neighbour in Y and vice versa. We say that the set X dominates Y if every vertex of Y has at least one neighbour in X . Similarly, a vertex x dominates Y if every vertex of Y is adjacent to x. A vertex y ∈ V \ X distinguishes X if y has both a neighbour and a non-neighbour in X . The set X is a module if it has only trivial modules. Two vertices are false twins if they have the same neighbourhood (note that such vertices must be non-adjacent). Clearly any prime graph on at least three vertices cannot contain a pair of false twins, as any such pair of vertices would form a non-trivial module.
We will use the following structural result.

Lemma 1 ([12]
). Let G be a connected (K 3 , C 5 , S 1,2,3 )-free graph that does not contain a pair of false twins. Then G is either bipartite or a cycle.

Clique-width
The clique-width cw(G) of a graph G is the minimum number of labels needed to construct G by using the following four operations: : creating a new graph consisting of a single vertex v with label i; 2. G 1 ⊕ G 2 : taking the disjoint union of two labelled graphs G 1 and G 2 ; 3. η i, j : joining each vertex with label i to each vertex with label j (i = j); 4. ρ i→ j : renaming label i to j.
We say that a construction of a graph G with the four operations is a k-expression if it uses at most k labels. Thus the clique-width of G is the minimum k for which G has a k-expression. Recall that a class of graphs G has bounded clique-width if there is a constant c such that the clique-width of every graph in G is at most c; otherwise the clique-width is unbounded.
Let G be a graph. We define the following operations. For an induced subgraph G ⊆ i G, the subgraph complementation operation (acting on G with respect to G ) replaces every edge present in G by a non-edge, and vice versa. Similarly, for two disjoint vertex subsets S and T in G, the bipartite complementation operation with respect to S and T acts on G by replacing every edge with one end-vertex in S and the other one in T by a non-edge and vice versa. We now state some useful facts about how the above operations (and some other ones) influence the clique-width of a graph. We will use these facts throughout the paper. Let k ≥ 0 be a constant and let γ be some graph operation. We say that a graph class G is (k, γ )-obtained from a graph class G if the following two conditions hold: 1. every graph in G is obtained from a graph in G by performing γ at most k times, and 2. for every G ∈ G there exists at least one graph in G obtained from G by performing γ at most k times.
We say that γ preserves boundedness of clique-width if for any finite constant k and any graph class G, any graph class G that is (k, γ )-obtained from G has bounded clique-width if and only if G has bounded clique-width.

Lemma 2 ([11]
). Let G be a graph and let P be the set of all induced subgraphs of G that are prime. Then cw(G) = max H∈P cw(H).

Well-quasi-orderability
A quasi order ≤ on a set X is a reflexive, transitive binary relation. Two elements x, y ∈ X in this quasi-order are comparable if x ≤ y or y ≤ x, otherwise they are incomparable. A set of elements in a quasi-order is a chain if every pair of elements is comparable and it is an antichain if every pair of elements is incomparable. The quasi-order ≤ is a well-quasiorder if any infinite sequence of elements x 1 , x 2 , x 3 , . . . in X contains a pair (x i , x j ) with x i ≤ x j and i < j. Equivalently, a quasi-order is a well-quasi-order if and only if it has no infinite strictly decreasing sequence x 1 x 2 x 3 · · · and no infinite antichain.
For an arbitrary set M, let M * denote the set of finite sequences of elements of M. A quasi-order ≤ on M defines a quasi-order ≤ * on M * as follows: (a 1 , . . . , a m ) ≤ * (b 1 , . . . , b n ) if and only if there is a sequence of integers i 1 , . . . , i m with 1 ≤ i 1 < · · · < i m ≤ n such that a j ≤ b i j for j ∈ {1, . . . , m}. We call ≤ * the subsequence relation. [27]). If (M, ≤) is a well-quasi-order then (M * , ≤ * ) is a well-quasi-order.

Lemma 3 (Higman's Lemma
To define the notion of labelled induced subgraphs, let us consider an arbitrary quasi-order (W , ≤). We say that G is a labelled graph if each vertex v of G is equipped with an element l G (v) ∈ W (the label of v). Given two labelled graphs G and H , we say that G is a labelled induced subgraph of H if G is isomorphic to an induced subgraph of H and there is an then a graph class X cannot contain an infinite sequence of labelled graphs that is strictly-decreasing with respect to the labelled induced subgraph relation. We therefore say that a graph class X is well-quasi-ordered by the labelled induced subgraph relation if it contains no infinite antichains of labelled graphs whenever (W , ≤) is a well-quasi-order. Such a class is readily seen to also be well-quasi-ordered by the induced subgraph relation.
Daligault, Rao and Thomassé [18] showed that every hereditary class of graphs that is well-quasi-ordered by the labelled induced subgraph relation is defined by a finite set of forbidden induced subgraphs. Korpelainen, Lozin and Razgon [34] conjectured that if a hereditary class of graphs G is defined by a finite set of forbidden induced subgraphs, then G is wellquasi-ordered by the induced subgraph relation if and only if it is well-quasi-ordered by the labelled induced subgraph relation. Brignall, Engen and Vatter [8] recently found a class G * with 14 forbidden induced subgraphs that is a counterexample for this conjecture, that is G * is well-quasi-ordered by the induced subgraph relation but not by the labelled induced subgraph relation. However, so far, all known results for bigenic graph classes, including those in this paper, agree with the conjecture for bigenic graph classes.
Similarly to the notion of preserving boundedness of clique-width, we say that a graph operation γ preserves well-quasiorderability by the labelled induced subgraph relation if for any finite constant k and any graph class G, any graph class G that is (k, γ )-obtained from G is well-quasi-ordered by this relation if and only if G is. Lemma 4 ( [15] [3,32]). (P 7 , S 1,2,3 )-free bipartite graphs are well-quasi-ordered by the labelled induced subgraph relation.
Let (L 1 , ≤ 1 ) and (L 2 , ≤ 2 ) be well-quasi-orders. We define the Cartesian Product (L 1 , ≤ 1 ) × (L 2 , ≤ 2 ) of these well-quasiorders as the order (L, ≤ L ) on the set L := L 1 × L 2 where (l 1 , l 2 ) ≤ L (l 1 , l 2 ) if and only if l 1 ≤ 1 l 1 and l 2 ≤ 2 l 2 . Lemma 3 implies that (L, ≤ L ) is also a well-quasi-order. If G has a labelling with elements of L 1 and of L 2 , say l 1 : V (G) → L 1 and Lemma 7. Fix a well-quasi-order (L 1 , ≤ 1 ) that has at least one element. Let X be a class of graphs. For each G ∈ X fix a labelling l 1 G : V (G) → L 1 . Then X is well-quasi-ordered by the labelled induced subgraph relation if and only if for every well-quasi-order (L 2 , ≤ 2 ) and every labelling of the graphs in X by this order, the combined labelling in (L 1 , ≤ 1 ) × (L 2 , ≤ 2 ) obtained from these labellings also results in a well-quasi-ordered set of labelled graphs.
Proof. If X is well-quasi-ordered by the labelled induced subgraph relation then by definition it is well-quasi-ordered when labelled with labels from (L 1 , ≤ 1 ) × (L 2 , ≤ 2 ). If X is not well-quasi-ordered by the labelled induced subgraph relation then there must be a well-quasi-order (L 2 , ≤ 2 ) and an infinite set of graphs G 1 , G 2 , . . . whose vertices are labelled with elements of L 2 such that these graphs form an infinite labelled antichain. For each graph G i , replace the label l on vertex v by The graphs are now labelled with elements of the well-quasi-order (L 1 , ≤ 1 ) × (L 2 , ≤ 2 ) and result in an infinite labelled antichain of graphs labelled with such combined labellings. This completes the proof. 2

k-uniform graphs
For an integer k ≥ 1, a graph G is k-uniform if there is a symmetric square 0, 1 matrix K of order k and a graph F k on vertices 1, 2, . . . , k such that G ∈ P(K , F k ), where P(K , F k ) is the graph class defined as follows. Let H be the disjoint union of infinitely many copies of F k . For i ∈ {1, . . . , k}, let V i be the subset of V (H) containing vertex i from each copy of F k . Construct from H an infinite graph H(K ) on the same vertex set by applying a subgraph complementation to V i if and only if K (i, i) = 1 and by applying a bipartite complementation to a pair V i , V j if and only if K (i, j) = 1. Thus, two vertices u ∈ V i and v ∈ V j are adjacent in H(K ) if and only if uv ∈ E(H) and K (i, j) = 0 or uv / ∈ E(H) and K (i, j) = 1. Then, P(K , F k ) is the hereditary class consisting of all the finite induced subgraphs of H(K ). The minimum k such that G is k-uniform is the uniformicity of G. The second of the next two lemmas follows directly from the above definitions.
The following result was proved by Korpelainen and Lozin. The class of disjoint unions of cliques is a counterexample for the reverse implication.

Lemma 8 ([33]). Any class of graphs of bounded uniformicity is well-quasi-ordered by the labelled induced subgraph relation.
The following lemma follows from the definition of clique-width and the definition of k-uniform graphs (see also [2] for a more general result). For completeness, we include a formal proof.

Lemma 9.
For every k ≥ 1, every k-uniform graph has clique-width at most 2k.
Proof. Let k ≥ 1 and let H(K ) be the graph from the definition of k-uniform for some F k and K . We will show that every finite induced subgraph of H(K ) has clique-width at most 2k. Let X 1 , X 2 , . . . be the sets of vertices corresponding to each copy of F k in the construction of H(K ) and note that |X h | = k for all h ≥ 1 and that |X h ∩ V i | = 1 for all h ≥ 1, i ∈ {1, . . . , k}. Furthermore, if two vertices x ∈ V i and y ∈ V j do not lie in the same set X h , then x and y are adjacent if and only if K (i, j) = 1. For ≥ 0, let H = H(K )[X 1 ∪ · · · ∪ X ] (so H 0 is the empty graph, which has no vertices).
We will prove by induction on ≥ 0 that there is a 2k-expression for H , with the property that once this 2k-expression has been applied, for all i ∈ {1, . . . , k}, every vertex in V (H ) ∩ V i has label i. The = 0 case is trivial. Now suppose that the induction hypothesis holds for some ≥ 0, so there is a 2k-expression for H with the property that once this 2k-expression has been applied, for all i ∈ {1, . . . , k} every vertex in V (H ) ∩ V i has label i. We will construct a 2k-expression for H +1 with the property that once this new 2k-expression has been applied, for all i ∈ {1, . . . , k} every vertex in V (H +1 ) ∩ V i has label i. To do this, we first take the 2k-expression for H and then for every i ∈ {1, . . . , k}, we create the unique vertex of X +1 ∩ V i with label k + i and take the disjoint union of these vertices with the constructed H . Next, for i, j ∈ {1, . . . , k} with i < j, if the unique vertex of X +1 ∩ V i is adjacent to the unique vertex of X +1 ∩ V j in H +1 , then we apply the join operation η k+i,k+ j (). Next, for i, j ∈ {1, . . . , k}, if K (i, j) = 1, then we apply the join operation η i,k+ j (). Finally, for every i ∈ {1, . . . , k} we apply the relabel operation ρ k+i→i (). The resulting 2k-expression constructs H +1 with the required labels, so the induction hypothesis also holds for + 1. By induction, the induction hypothesis holds for every ≥ 0 and so we conclude that H has clique-width at most 2k for every . Now if G is a k-uniform graph then it is a finite induced subgraph of H(K ), so there is an such that G is an induced subgraph of H . It follows that G has clique-width at most 2k. This completes the proof. 2

Outline of our proof method
We prove our results on both well-quasi-orderability and boundedness of clique-width by a further generalization of the canonical decomposition method introduced by Fouquet, Giakoumakis and Vanherpe [24] for bipartite graphs. As discussed in Section 1, this method was generalized to 3-partite graphs in [12], but for our purposes we need a non-trivial refinement. We explain this refinement in detail in Section 4, but below we sketch the main ideas behind it. In order to do this, we first need to introduce some terminology.
Let G be a 3-partite graph given with a partition of its vertex set into three independent sets V 1 , V 2 and V 3 . Suppose that each set V i can be partitioned into sets V 0 i , . . . , V i (the value of is the same for each i ∈ {1, 2, 3}) such that, taking subscripts modulo 3: We say that the graphs G i are the slices of G. If the slices belong to some graph class X , then we say that G can be partitioned into slices from X ; see Fig. 2 for an example. In Section 4.1 we prove the following two results: (i) every 3-partite graph that can be partitioned into slices of clique-width at most k has clique-width at most max(3k, 6); (ii) for every set Y of 3-partite graphs that belong to some hereditary graph class X : if the graphs in Y can be partitioned into slices from some subclass Z ⊆ X that is well-quasi-ordered by the labelled induced subgraph relation, then Y is also well-quasi-ordered by the labelled induced subgraph relation.
In Section 4.2, we give sufficient conditions for a 3-partite graph to have the above decomposition into slices, so that we can apply results (i) and (ii) for boundedness of clique-width and being well-quasi-ordered by the labelled induced subgraph relation (and thus by the induced subgraph relation), respectively. To explain these conditions, we need to introduce some more terminology. Let G be a 3-partite graph given together with a partition of its vertex set into three independent sets V 1 , V 2 and V 3 . An induced K 3 or 3P 1 in G is rainbow if it has exactly one vertex in each set V i . We say that G is curious with respect to the partition (V 1 , V 2 , V 3 ) if it contains no rainbow K 3 or 3P 1 when its vertex set is partitioned in this way. We say that G is curious if there is a partition (V 1 , V 2 , V 3 ) with respect to which it is curious; note that bipartite graphs are curious, since we allow the case when V i = ∅ for some i. In Section 4.2 we will prove the following result: (iii) if the set X of bipartite graphs in a hereditary graph class X is well-quasi-ordered by the labelled induced subgraph relation or have bounded clique-width, then the same is true for the curious graphs in X .
We will prove result (iii) by showing that the curious graphs in X allow a partition into slices from X , so that we can indeed apply results (i) and (ii).
Finally, in Section 5, we apply result (iii) on the classes of (K 3 , P 1 + P 5 )-free graphs and (K 3 , P 2 + P 4 )-free graphs, in order to prove that these classes have bounded clique-width and are well-quasi-ordered by the labelled induced subgraph relation. To do this, we prove two structural lemmas. These lemmas consider the case when a graph in one of these classes contains an induced subgraph isomorphic to C 5 . We partition the remaining vertices of the graph into sets according to their neighbourhood in this C 5 and analyse the edges between the vertices in these sets. We use this analysis to show how to use a constant number of vertex deletions and bipartite complementations to transform the graph into a disjoint union of curious graphs and 3-uniform graphs in the respective graph class. The two lemmas enable us to apply result (iii) after combining them with Theorem 3 and Lemma 6, respectively, which imply that the bipartite graphs in the classes of (K 3 , P 1 + P 5 )-free graphs and (K 3 , P 2 + P 4 )-free graphs have bounded clique-width and are well-quasi-ordered by the (labelled) induced subgraph relation, respectively.

Partitioning 3-partite graphs
In Section 4.1 we recall our graph decomposition on 3-partite graphs. We then show how to extend results on bounded clique-width or well-quasi-orderability by the labelled induced subgraph relation from bipartite graphs in an arbitrary hereditary class of graphs to the 3-partite graphs in this class that are decomposable in this way. In Section 4.2 we give sufficient conditions for a 3-partite graph to have such a decomposition.

The decomposition
Let G be a 3-partite graph given with a partition of its vertex set into three independent sets V 1 , V 2 and V 3 . Suppose that each set V i can be partitioned into sets V 0 i , . . . , V i (the value of is the same for each i ∈ {1, 2, 3}) such that, taking subscripts modulo 3: Recall that the graphs G i are the slices of G and that if the slices belong to some graph class X , then G can be partitioned into slices from X .

Lemma 10.
If G is a 3-partite graph that can be partitioned into slices of clique-width at most k, then G has clique-width at most max(3k, 6).
Proof. Since every slice G j of G has clique-width at most k, it can be constructed using a k-expression, which uses the labels 1, . . . , k. Applying relabelling operations if necessary, we may assume that at the end of this construction, every vertex has label 1. We can modify this k-expression so that we use the 3k labels 1 1 , . . . , k 1 , 1 2 , . . . , k 2 , 1 3 , . . . , k 3 instead (so the modified expression will be a 3k-expression for G j ), in such a way that at all points in the construction, for each To do this we replace: ))))))).
This new 3k-expression uses 3k labels and at the end of it, every vertex in V i is labelled with label 1 i . We find such a 3k-expression E j for every slice G j of G independently.

Lemma 11. Let X be a hereditary graph class containing a class Z . Let Y be the set of 3-partite graphs in X that can be partitioned into slices from Z . If Z is well-quasi-ordered by the labelled induced subgraph relation, then so is Y .
Proof. For each graph G in Y , we may fix a partition into independent sets (V 1 , V 2 , V 3 ) with respect to which the graph can be partitioned into slices from Z . Let (L 1 , ≤ 1 ) be the well-quasi-order with L 1 = {1, 2, 3} in which every pair of distinct elements is incomparable. By Lemma 7, we need only consider labellings of graphs in Y of the form (i, l(v)) where v ∈ V i and l(v) belongs to an arbitrary well-quasi-order L. Suppose G can be partitioned into slices G 0 , . . . , G k , with vertices labelled as in G. Note that the ordered list G 0 , . . . , G k completely specifies the edges of G and the labels on its vertices. Indeed, two vertices x, y ∈ V (G i ) are adjacent in G if and only if they are adjacent in G i and two vertices

Curious graphs
Let G be a 3-partite graph given together with a partition of its vertex set into three independent sets V 1 , V 2 and V 3 . Recall that an induced K 3 or 3P 1 in G is rainbow if it has exactly one vertex in each set V i . Also recall that G is curious with respect to the partition (V 1 , V 2 , V 3 ) if it contains no rainbow K 3 or 3P 1 when its vertex set is partitioned in this way, and that G is curious if there is a partition (V 1 , V 2 , V 3 ) with respect to which it is curious. In this section we will prove that given a hereditary class X , if the bipartite graphs in X are well-quasi-ordered by the labelled induced subgraph relation or have bounded clique-width, then the same is true for the curious graphs in X .
-monotone if it is either increasing or decreasing.
Bipartite graphs that are 2P 2 -free are also known as bipartite chain graphs. It is well known (and easy to verify) that a bipartite graph G is 2P 2 -free if and only if the vertices in each independent set of the bipartition admit a monotone ordering. Suppose G is a curious graph with respect to some partition (V 1 , V 2 , V 3 ). We say that (with respect to this partition) the graph G is a curious graph of type t if exactly t of the graphs

Curious graphs of type 0 and 1
Note that if G is a curious graph of type 0 or 1 with respect to the partition (V 1 , V 2 , V 3 ) then without loss of generality, we may assume that

Lemma 12. Let G be a curious graph with respect to
Proof. For a set S ⊆ V , we use N S (u) := N(u) ∩ S to denote the set of vertices in S that are adjacent to u. We may choose a linear order x 1 , . . . , x of the vertices of V 1 according to their neighbourhood in V 2 , breaking ties according to their neighbourhood in V 3 i.e. an order such that: Clearly such an ordering is decreasing in Suppose, for contradiction, that this order is not increasing in , which completes the proof. 2 Lemma 13. If G is a curious graph of type 0 or 1 with respect to a partition (V 1 , V 2 , V 3 ) then G can be partitioned into slices that are bipartite.
Proof. Since G is a curious graph of type 0 or 1, without loss of generality, we may assume that In particular, note that the vertices of V 2 ∪ V 0 3 and V 0 2 ∪ V 3 are complete and anti-complete to V 1 , respectively. The following properties hold: is a rainbow K 3 , a contradiction. It follows that: The above properties about the edges between the sets V i j imply the following statements: is bipartite. This completes the proof. 2

Curious graphs of type 2 and 3
Lemma 14. Fix t ∈ {2, 3}. If G is a curious graph of type t with respect to a partition (V 1 , V 2 , V 3 ) then G can be partitioned into slices of type at most t − 1.
Proof. Fix t ∈ {2, 3} and let G be a curious graph of type t with respect to a partition ( , every vertex of V 3 has exactly two neighbours in the 2P 2 and these neighbours either both lie Let x 1 , x 2 ∈ V 1 and y 1 , y 2 ∈ V 2 induce a 2P 2 in G such that x 1 is adjacent to y 1 but not to y 2 and x 2 is adjacent to y 2 but not to y 1 Therefore z can have at most one neighbour in {x 1 , y 1 } and at most one neighbour in {x 2 , y 2 }. If z is non-adjacent to x 1 and y 2 then G[x 1 , y 2 , z] is a rainbow 3P 1 , a contradiction. Therefore, z can have at most one non-neighbour in {x 1 , y 2 }, and similarly z can have at most one non-neighbour in {x 2 , y 1 }. Therefore, if z is adjacent to x 1 , then it must be non-adjacent to y 1 , so it must be adjacent to x 2 , so it must be non-adjacent to y 2 . Similarly, if z is non-adjacent to x 1 then it must be adjacent to y 2 , so it must be non-adjacent to x 2 , so it must be adjacent to y 1 . Hence Claim 1 follows.
. We say that a vertex of V 3 distinguishes two graphs G[H i ] and G[H j ] if its neighbours in H i and H j do not belong to the same set V k . We group these sets H i into blocks B 1 , . . . , B p that are not distinguished by any vertex of V 3 . In other words, every B i contains at least one 2P 2 and every vertex of V 3 is complete to one of the sets B i ∩ V 1 and B i ∩ V 2 and anti-complete to the other. For We define a relation < B on the blocks as follows:

one of these cases must apply, which implies that either B i < B B j or B j < B B i for every pair of distinct blocks B i and B j .
By definition of the blocks B i and B j there must be a vertex z ∈ V 3 that distinguishes them. Without loss of generality we may assume that z is complete to B i Claim 2 follows by symmetry.

Claim 3. The relation < B is transitive.
Suppose that B i < B B j and B j < B B k . Since B j and B k are distinct, there must be a vertex z ∈ V 3 that distinguishes them, and by combining Claim 2 with the fact that B j < B B k it follows that z must be complete to B . Then x is adjacent to y, since B i < B B j and y is adjacent to z by choice of z. Now x is must be non-adjacent to z otherwise G[x, y, z] would be a rainbow K 3 . Therefore z is anti-complete to B i 1 . Recall that every vertex of V 3 is complete to one of B i 1 and B i 2 and anti-complete to the other (due to Claim 1). Therefore z is complete to B i 2 , and so z distinguishes B i and B k . By Claim 2 it follows that B i < B B k . This completes the proof of Claim 3. Combining Claims 1-3, we find that < B is a linear order on the blocks. We obtain the following conclusion, which we call the chain property. Suppose, for contradiction, that x ∈ R 1 is adjacent to y ∈ B i 2 and non-adjacent to

Claim 4. The set of blocks admits a linear order B
Now if x is adjacent to z then G[x, y, z] is a rainbow K 3 and if x is non-adjacent to z then G[x, y , z] is a rainbow 3P 1  Assume that the chain property holds (possibly after some applications of the Update Procedure). Without loss of generality, assume x ∈ R 1 has both a neighbour y and a non-neighbour y in some set B j 2 (the case where x ∈ R 2 follows similarly). We will show that the chain property continues to hold after adding x to B j 1 and B j and removing it from R 1 . Recall that every vertex of B j 1 has the same neighbourhood in V 3 by definition of B j . We first show that x has the same neighbourhood in V 3 as the vertices of B , so x must be non-adjacent to y , otherwise , so x must be adjacent to y , otherwise G[x, y , z] would be a rainbow 3P 1 . We conclude that Property (i) of the chain property is also preserved if we apply the Update Procedure with the vertex x. By symmetry and induction this completes the proof of Claim 6.
By Claim 6 we may therefore apply the Update Procedure exhaustively, after which the chain property will continue to hold. Once this procedure is complete, every remaining vertex of R 1 will be either complete or anti-complete to each set B j 2 .
In fact, by Claim 5, we know that for every vertex x ∈ R 1 , there is an i ∈ {0, . . . , p} such that x has a neighbour in all B j 2 with j > i (if such a j exists) and x has a non-neighbour in all B j 2 with j ≤ i (if any such j exists). Since x is complete or anti-complete to each set B j 2 , we obtain the following conclusion: -for every vertex x ∈ R 1 , there is an i ∈ {0, . . . , p} such that x is complete to all B j 2 with j > i (if such a j exists) and x is anti-complete to all B j 2 with j ≤ i (if any such j exists). We denote the corresponding subset of R 1 by Y i 1 .
By symmetry, we also obtain the following: We also partition the vertices of V 3 into p + 1 subsets V 0 3 , . . . , V p 3 such that the vertices of V j 3 are complete to B i 2 and anti-complete to B i 1 for i ≤ j and complete to B i 1 and anti-complete to B i Then z must be adjacent to x otherwise G[x, y , z] would be a rainbow 3P 1 and z must be non-adjacent to y, otherwise G[x , y, z] would be a rainbow K 3 . This completes the proof of Claim 7.
By Claims 4, 6 and 7 the graph G can be partitioned into is 2P 2 -free (by construction, since the original sequence H 1 , H 2 , . . . , H q of 2P 2 s was maximal), it follows that each G i is of type at most t − 1. Furthermore, since each G[B i ] is bipartite, it forms a curious graph in which the set V 3 is empty, so it has type at most 1. This completes the proof. 2

Curious graphs, clique-width and well-quasi-orderability
We are now ready to state the main result of this section.
Theorem 4. Let X be a hereditary class of graphs. If the set of bipartite graphs in X is well-quasi-ordered by the labelled induced subgraph relation or has bounded clique-width, then the same property also holds for the set of curious graphs in X .
Proof. Let X be the set of bipartite graphs in X and let X be the set of curious graphs in X ; note that X is a subset of X . By Lemma 13, if G ∈ X is a curious graph of type 0 or 1 with respect to a partition (V 1 , V 2 , V 3 ), then G can be partitioned into slices from X . By Lemma 14, if G ∈ X is a curious graph of type 2 with respect to a partition (V 1 , V 2 , V 3 ), then G can be partitioned into slices from X of type at most 1. By Lemma 14, if G ∈ X is a curious graph of type 3 with respect to a partition (V 1 , V 2 , V 3 ), then G can be partitioned into slices from X of type at most 2.
Lemma 11 implies that if a subclass Z of X is well-quasi-ordered by the labelled induced subgraph relation, then the set Y of graphs in X that can be partitioned into slices from Z is also well-quasi-ordered by the labelled induced subgraph relation. We combine this statement with the three statements in the paragraph above. Suppose that X is well-quasiordered by the labelled induced subgraph relation. Then the set of curious graphs in X of type 0 or 1 is well-quasi-ordered by the labelled induced subgraph relation. Thus the set of curious graphs in X of type 2 is also well-quasi-ordered by the labelled induced subgraph relation. Thus the set of curious graphs in X of type 3 is also well-quasi-ordered by the labelled induced subgraph relation. Therefore, if the set of bipartite graphs in X is well-quasi-ordered by the labelled induced subgraph relation, then the set of curious graphs in X is also well-quasi-ordered by the labelled induced subgraph relation.
Lemma 10 implies that if a graph G ∈ X can be partitioned into slices of clique-width at most k, then G has clique-width at most max(3k, 6). We combine this statement with the three statements in the first paragraph. Suppose that the graphs in X have bounded clique-width. Then the curious graphs in X of type 0 or 1 also have bounded clique-width. Thus the curious graphs in X of type 2 also have bounded clique-width. Thus the curious graphs in X of type 3 also have bounded clique-width. Therefore, if the set of bipartite graphs in X has bounded clique-width then the set of curious graphs in X also has bounded clique-width. This completes the proof. 2

Applications of our method
In this section we show that the class of (K 3 , P 1 + P 5 )-free graphs and the class of (K 3 , P 2 + P 4 )-free graphs have bounded clique-width and are well-quasi-ordered by the labelled induced subgraph relation. To do this, we first prove the two structural lemmas mentioned in Section 3. Recall that these lemmas consider the case where a graph in one of these classes contains an induced subgraph isomorphic to C 5 and that the main approach used in the proof is to partition the remaining vertices of the graph into sets according to their neighbourhood in this C 5 and then analyse the edges between the vertices in these sets. As discussed, this enables us to use a bounded number of vertex deletions and bipartite complementations, to transform the graph into a disjoint union of curious graphs and 3-uniform graphs in the respective graph class. We then combine these lemmas with Theorem 3 and Lemma 6 to prove Theorem 5, which is our main result.
The first of the two lemmas is implicit in the proofs of [12, Lemma 9 and Theorem 3], but without an explicit upper bound on the number of operations used and the number of obtained curious graphs. For completeness, we give a direct proof and provide such explicit bounds. Note that the bounds on the number of vertex deletions, bipartite complementations and curious graphs in both lemmas are not tight, but any upper bound on these numbers will be sufficient for our purposes.
Lemma 15. Given any connected (K 3 , P 1 + P 5 )-free graph G that contains an induced C 5 , we can apply at most 5 vertex deletions and at most 31 bipartite complementation operations to obtain a graph H that is the disjoint union of 11 (K 3 , P 1 + P 5 )-free curious graphs.
Proof. Let G be a connected (K 3 , P 1 + P 5 )-free graph that contains an induced cycle C on the vertices v 1 , . . . , v 5 , listed in order along the cycle. To aid notation, for the remainder of the proof subscripts on vertices and on sets should be interpreted modulo 5. We will show how to use vertex deletions and bipartite complementations to partition the graph into a disjoint union of curious graphs. At the end of the proof, we will verify the number of operations used.
Since G is K 3 -free, every vertex not on the cycle C has at most two neighbours on C and if it does have two neighbours on C , then these neighbours must be non-consecutive vertices of the cycle. We may therefore partition the vertices in V (G) \ V (C) into eleven sets as follows: -U is the set of vertices anti-complete to C , -for i ∈ {1, . . . , 5}, W i is the set of vertices whose unique neighbour on C is v i and -for i ∈ {1, . . . , 5}, V i is the set of vertices adjacent to v i−1 and v i+1 and non-adjacent to the rest of C .
We now prove a series of claims. We start by showing how to use a bipartite complementation to disconnect a curious graph containing U from the rest of the graph. This will enable us to assume that U = ∅ for the remainder of the proof (Claim 1). We then analyse the edges between the remaining non-empty sets (i.e. those of the form W i and V i ) and show that we can use bipartite complementations to disconnect curious graphs containing (subsets of) these sets from the rest of the graph. This will enable us to assume that V i = W i = ∅ for all i ∈ {1, . . . , 5} (Claims 10 and 11). After this, the only case left to consider will be when G = C , in which case we simply apply five vertex deletions. At the end of the proof, we will count the number of vertex deletions and bipartite complementations used and the number of curious graphs obtained throughout the proof and verify that the bounds specified in the lemma are satisfied.

Claim 1.
We may assume that U = ∅.
Suppose, for contradiction, that there are two vertices u, u ∈ U that do not have the same neighbourhood in some set ] is a P 1 + P 5 if they are not. This contradiction means that every vertex in U has the same neighbourhood in every set V i and every set W i . Since G is connected, there must be a vertex v in some V i or W i that is adjacent to every vertex of U . Since G is K 3 -free, U must therefore be an independent set. Applying a bipartite complementation between U and the vertices adjacent to the vertices of U disconnects G[U ] from the rest of the graph. Since U is independent, G[U ] is a curious graph (with two of the three partition classes empty). This completes the proof of Claim 1.
This completes the proof of Claim 2.  Suppose, for contradiction, that x ∈ W i+2 has a neighbour y ∈ W i and a non-neighbour y ∈ W i . By Claim 2, y is non-adjacent to y . Thus G[ y , y, x, v i+2 , v i+3 , v i+4 ] is a P 1 + P 5 , a contradiction. Claim 4 follows by symmetry. Suppose, for contradiction, that x ∈ V i has a neighbour y ∈ W i and a non-neighbour y ∈ W i . By Claim 2, y is nonadjacent to y . Thus G[ y , y, x, v i+1 , v i+2 , v i+3 ] is a P 1 + P 5 , a contradiction. Therefore every vertex in V i is complete or anti-complete to W i . Now suppose, for contradiction, that y ∈ W i has a neighbour x ∈ V i and a non-neighbour  Suppose, for contradiction, that x ∈ V i is non-adjacent to y ∈ V i−1 and z ∈ V i+1 . By Claim 2, y is non-adjacent to z. Thus Note that by doing this we partition the vertices of V 1 ∪ · · · ∪ V 5 into a total of 15 subsets (some or all of which may be empty). By definition of this partition, if x ∈ V i is non-adjacent to y ∈ V i+1 , then x ∈ V − i and y ∈ V + i+1 . Moreover, every vertex of V − i has a non-neighbour in V + i+1 and vice versa. Note that for i ∈ {1, . . . , 5} the sets V 0 Next, for each i ∈ {1, . . . , 5} we analyse the edges between W i and the subsets of V i−2 and V i+2 .
Suppose, for contradiction, that x ∈ W i has a neighbour y ∈ V + i+2 . By definition of V + i+2 , y must have a non-neighbour , z] is a P 1 + P 5 , a contradiction. Claim 7 follows by symmetry.
This completes the proof of Claim 8.
(ii) If x ∈ W i has a neighbour in V 0 i+3 , then x is anti-complete to V i+2 and complete to V + i+3 .
Suppose x ∈ W i has a neighbour y ∈ V 0 i+2 . If z ∈ V i+3 then y is adjacent to z, so x must be non-adjacent to z, otherwise G[x, y, z] would be a K 3 . Therefore x is anti-complete to V i+3 . If y ∈ V − i+2 then y has a non-neighbour z ∈ V i+3 . Note that z is non-adjacent to x. Now x must be adjacent to y , otherwise G[x, y , z ] would be a 3P 1 , contradicting Claim 8. It follows that x is complete to V − i+2 . Claim 9 follows by symmetry.
Recall that W i is anti-complete to V − i−2 ∪ V + i+2 by Claim 7. By Claim 9 we can partition W i into three (possibly empty) subsets as follows: -W 2 i the set of vertices in W i that have neighbours in V 0 i+2 (and are therefore anti-complete to V i+3 and complete to V − i+2 ), -W 3 i the set of vertices in W i that have neighbours in V 0 i+3 (and are therefore anti-complete to V i+2 and complete to V + i+3 ) and -W 0 We first show how to remove all edges from vertices in G[W 0 ] to the rest of G by using three bipartite complementations. In other words, we will use three bipartite complementations to remove all edges between G[W 0 . Therefore, by applying at most one bipartite complementation, we can remove all edges with one end-vertex in V − i+2 and the other end-vertex outside W 0 Symmetrically, by applying at most one bipartite complementation, we can remove all edges with one end-vertex in V + i−2 and the other end-vertex outside W 0 Thus we can apply three bipartite complementations to disconnect G[W 0 ] from the rest of the graph. By ] is a curious graph. This completes the proof of Claim 10.
By the Claim 10, the only sets that remain non-empty are ones of form W 3 i , W 2 i or V 0 i . We prove the following claim.
Claim 11. For i ∈ {1, . . . , 5}, we may assume that We first show how to remove all edges from vertices in G[W 3 to the rest of the graph by using three bipartite complementations. In other words, we will use three bipartite complementations to remove all edges between i is either complete or anti-complete to W i+2 and either complete or anti-complete to W i−2 . By Claim 5, W 3 i is either complete or anti-complete to V 0 i . By Claim 9, i . Therefore, by applying at most one bipartite complementation, we can remove all edges with one end-vertex in W 3 i and the other end-vertex outside W 3 Symmetrically, by applying at most one bipartite complementation, we can remove all edges with one end-vertex in W 2 i+1 and the other end-vertex outside Therefore, by applying at most one bipartite complementation, we can remove all edges with one end-vertex in V 0 i−2 and the other end-vertex outside W 3

Thus we can apply three bipartite complementations to disconnect G[W
from the rest of the graph. By curious graph. This completes the proof of Claim 11.
By Claim 11, we may assume that G only contains the five vertices in the cycle C . We delete these vertices.
To complete the proof, it remains to verify the number of operations applied and the number of obtained curious graphs.

Lemma 16.
Given any prime (K 3 , P 2 + P 4 )-free graph G that contains an induced C 5 , we can apply at most 2570 vertex deletions and at most 459 bipartite complementation operations to obtain a graph H that is the disjoint union of at most 19 (K 3 , P 2 + P 4 )-free curious graphs and at most one 3-uniform graph.
Proof. Let G be a prime (K 3 , P 2 + P 4 )-free graph that contains an induced cycle C on the vertices v 1 , . . . , v 5 , listed in order along the cycle. To aid notation, for the remainder of the proof subscripts on vertices and on sets should be interpreted modulo 5. We will show how to use vertex deletions and bipartite complementations to partition the graph into a disjoint union of curious graphs and 3-uniform graphs. At the end of the proof, we will verify the number of operations used. Since G is K 3 -free, every vertex not on the cycle C has at most two neighbours on C and if it does have two neighbours on C , then these neighbours must be non-consecutive vertices of the cycle. We may therefore partition the vertices in V (G) \ V (C) into eleven sets as follows: -U is the set of vertices anti-complete to C , -for i ∈ {1, . . . , 5}, W i is the set of vertices whose unique neighbour on C is v i and -for i ∈ {1, . . . , 5}, V i is the set of vertices adjacent to v i−1 and v i+1 and non-adjacent to the rest of C .
We now prove a series of claims. We start by showing how to use a bounded number of vertex deletions and bipartite complementations to disconnect a 3-uniform or bipartite induced subgraph containing U from the rest of the graph. This will enable us to assume (Claim 25) that U = ∅ for the remainder of the proof. Similarly, we analyse the edges between the vertices in the other sets (of the form V i and W i ) defined above and show that we can use bipartite complementations to disconnect curious graphs containing (subsets of) these sets from the rest of the graph (Claims 25, 27, 30, 31, 32 and 33).
This will enable us to assume that W i = ∅ for all i ∈ {1, . . . , 5} and that all remaining vertices in sets V i for i ∈ {1, . . . , 5} have very restricted neighbourhoods (that is, we will be able to assume that V i = V 0 i for every i ∈ {1, . . . , 5}, where V 0 i is a subset of V i defined later in the proof). Under these assumptions, it will be sufficient to then apply five more bipartite complementations to transform G into a curious graph. At the end of the proof, we will count the number of vertex deletions and bipartite complementations used and the number of 3-uniform and curious graphs obtained throughout the proof and verify that the bounds specified in the lemma are satisfied.
] is a P 2 + P 4 , a contradiction. This completes the proof of Claim 1.
This completes the proof of Claim 2.  Indeed, suppose for contradiction that x ∈ V i has a neighbour y ∈ W i and a non-neighbour y ∈ W i . By Claim 1, y is non-adjacent to y . It follows that G[v i+2 , v i+3 , x, y, v i , y ] is a P 2 + P 4 , a contradiction. This completes the proof of Claim 4.
For i ∈ {1, . . . , 5}, let V * i denote the set of vertices in V i that have neighbours in U and let V 0 We will show how to use five bipartite complementations to separate G[U ∪ V * ] from the rest of the graph. Note that by definition and by Claim 1, no vertex of U has a neighbour outside V * . It is therefore sufficient to show how to disconnect V * from the vertices outside U ∪ V * .
In fact, for vertices in V * i we can prove a stronger version of Claim 4.
Indeed, suppose for contradiction that x ∈ V * i is adjacent to y ∈ W i and let z ∈ U be a neighbour of x. By Claim 1, y is non-adjacent to z. It follows that G[v i+2 , v i+3 , v i , y, x, z] is a P 2 + P 4 , a contradiction. This completes the proof of Claim 5.
Indeed, suppose x ∈ V * i , y ∈ U and z ∈ V i−1 with x adjacent to y. If z is adjacent to both x and y then G[x, y, z] is a K 3 , a contradiction. If z is non-adjacent to both x and y then G[x, y, v i , z, v i+3 , v i+2 ] is a P 2 + P 4 , a contradiction. Claim 6 follows by symmetry.
This follows from Claim 6 by definition of V * i and V 0 . This completes the proof of Claim 7.
Suppose, for contradiction, that x ∈ V * i is non-adjacent to a vertex y ∈ W i+2 and let z ∈ U be a neighbour of x. By  Claim 1, y is non-adjacent to z. Therefore G[ y, v i+2 , v i , v i−1 , x, z] is a P 2 + P 4 , a contradiction. Claim 8 follows by symmetry.
By definition of U , every vertex in U is anti-complete to C . By Claim 1, U is anti-complete to W j for all j ∈ {1, . . . , 5} and by definition of V 0 j , U is non-adjacent to V 0 j for all j ∈ {1, . . . , 5}. This completes the proof of Claim 9.
Recall that at the start of the proof we assumed that the graph G is prime. By Claim 9 if for each i ∈ {1, . . . , 5} we apply a bipartite complementation between V * i and V 0 } then this would remove all edges between V * ∪ U and V (G) \ (V * ∪ U ) and leave all other edges unchanged. However, after doing this, the result might be a graph that is not prime. As such, we will not use Claim 9 to disconnect G[V * ∪ U ] from the rest of the graph at this stage, but wait until later in the proof, when we no longer require the property that G is prime. Next, we analyse the structure of We first show that T is a module in G.
by Claim 9. Since U and V * i are independent sets by Claims 1 and 2, respectively and every component of is either complete to S and anti-complete to T or anti-complete to S and complete to T , so no vertex can distinguish two vertices in T . It follows that T is a module in G. Since G is prime, we conclude that |T | = 1. This completes the proof of Claim 10.
We show that if |V * i | > 1 then S is a module in G. Suppose, for contradiction, that S is not a module in G. Since S ⊆ U , if a vertex v in G can distinguish two vertices in S then v ∈ V * ∪ U by Claim 9. Since U and V * is either complete to S and anti-complete to T or anti-complete to S and complete to T , so no vertex of V * i−1 ∪ V * i+1 can distinguish two vertices in S. Therefore, there must be a vertex in V i−2 ∪ V i+2 that distinguishes two vertices of S. Without loss of generality, assume that there is a vertex x ∈ V i+2 that is adjacent to y ∈ S and non-adjacent to y ∈ S. Let z be a vertex of T , i.e. a vertex of V * i that is adjacent to both y and y . Note that |V * i | > 1 and any two vertices of V * i belong to different connected components of G[V * i ∪ U ] by Claim 10. This means that there must be a vertex z ∈ V * i \ {z} and it must have a neighbour y ∈ U \ S. Note that x is non-adjacent to z and z by Claim 2. It follows that G[ y , z, v i+2 , v i+3 , x, y ] or G[ y , z , x, y, z, y ] is a P 2 + P 4 if x is adjacent or non-adjacent to y , respectively. This contradiction implies that S is indeed a module. Since G is prime, we conclude that |S| = 1. This completes the proof of Claim 11.
Suppose, for contradiction, that V * i and V * i+2 each contain at least two vertices. Then by Claims 10 and 11, every connected component of G[V * i ∪ U ] containing a vertex of V * i consists of a single edge and since V * i contains at least two vertices, there must be at least two such components. Similarly, there must be two such components in G[V * i+2 ∪ U ]. Therefore we can find x ∈ V * i adjacent to y ∈ U and y ∈ U \ {y} adjacent to z ∈ V * i+2 . By Claim 2, x is non-adjacent to z, so ] is a P 2 + P 4 , a contradiction. Claim 12 follows by symmetry.
We will show that this graph is 3-uniform. By Claims 1 and 2, V * i , V * i+1 and U are independent sets. By Claims 10 and 11, every vertex of V * i ∪ V * i+1 has exactly one neighbour in U and every vertex of U has at most one neighbour in V * i and at most one neighbour in V * i+1 .
If x ∈ V * i and y ∈ V * i+1 have a common neighbour z ∈ U then x must be non-adjacent to y by Claim 6. If x ∈ V * i is non-adjacent to y ∈ V * i+1 and z is the neighbour of x in U then y must adjacent to z by Claim 6. Therefore a vertex x ∈ V * i is non-adjacent to a vertex y ∈ V * i+1 if and only if they have the same unique neighbour z ∈ U .
Now applying a bipartite complementation between V * i and V * i+1 , we obtain a graph every component of which is an induced subgraph of K 3 , with at most one vertex of each component in each of V * i , V * i+1 and U . Therefore H is a 3-uniform graph. (In terms of the definition of 3-uniform graphs, we have k = 3, F k = K 3 and K is the 3 × 3 matrix which has K 1,2 = K 2,1 = 1 and is zero everywhere else.) This completes the proof of Claim 13.
Claims 9 and 13 would allow us to remove G[V * ∪ U ] from the graph. However, if we did this, then we might violate the property that G is prime. Hence, as discussed earlier, we do not actually do so at this stage in the proof. Informally, we may think of the vertices in V * ∪ U as having been "dealt with" and we now concern ourselves with the remainder of the graph i.e. the vertices in C ∪ V 0 1 ∪ · · · ∪ V 0 5 ∪ W 1 ∪ · · · ∪ W 5 . First, we look at the sets W i and the edges between these sets.
Suppose, for contradiction, that x ∈ W i is adjacent to y ∈ W i+1 and non-adjacent to y ∈ W i+1 . By Claim 1, y is non- , y ] is a P 2 + P 4 , a contradiction. By symmetry, this completes the proof of Claim 14.
In fact, we can strengthen Claim 14 as follows.
If W i−1 or W i+1 is empty then the claim follows by Claim 14. Now suppose, for contradiction, that x ∈ W i has a neighbour y ∈ W i−1 and a non- if y is adjacent or non-adjacent to z, respectively. This contradiction completes the proof of Claim 15. If G[W i ∪ W i+2 ] contains a P 4 , say on vertices w, x, y, z then G[v i+3 , v i+4 , w, x, y, z] is a P 2 + P 4 , a contradiction. Therefore G[W i ∪ W i+2 ] is indeed P 4 -free. By Claim 1, W i and W i+2 are independent. Therefore G[W i ∪ W i+2 ] is a P 4 -free bipartite graph, so every component of G[W i ∪ W i+2 ] is a complete bipartite graph. This completes the proof of Claim 16.
Note that W i and W i+2 are independent sets by Claim 1, and Claim 16 implies that every component of G[W i ∪ W i+2 ] is a complete bipartite graph. Suppose X and Y are independent sets such that every component of G[ X ∪ Y ] is a complete bipartite graph. We say that a pair {X, Y } is non-simple or that X is non-simple to Y if the number of non-trivial components (i.e. those containing at least one edge) in G[ X ∪ Y ] is at least two. Otherwise, we will say that the pair {X, Y } is simple or that X is simple to Y . Note that if {X, Y } is simple then all the edges in G[ X ∪ Y ] can be removed by using at most one bipartite complementation. Suppose x ∈ W i , y ∈ W i+2 and z ∈ W i−2 and that W i+2 is anti-complete to W i−2 . Suppose, for contradiction, that x is non-adjacent to y.
respectively. This contradiction implies that x is adjacent to y. We conclude that W i is complete to W i+2 . By symmetry, W i is also complete to W i−2 . Therefore the first part of Claim 17 holds. Now suppose that there is a vertex w ∈ W i+1 . Since W i−2 is anti-complete to W i+2 , Claim 15 implies that W i+2 is anti-complete to W i+1 and so W i+1 is anti-complete to W i . Applying the first part of Claim 17, we find that W i+1 is complete to W i−2 and if W i−1 is non-empty then W i+1 is complete to W i−1 . Claim 17 now follows by symmetry.
Suppose W i , W i+2 and W i−2 are all non-empty and {W i , W i+2 } is non-simple. By Claim 17, W i−2 is not anti-complete to W i+2 , so by Claim 14, W i−2 is complete to W i+2 . Now suppose, for contradiction, that W i+1 contains a vertex x. By Claim 15, since W i−2 is complete to W i+2 , it follows that W i+2 is complete to W i+1 and therefore W i+1 is complete to W i . Since {W i , W i+2 } is not simple, there must be adjacent vertices y ∈ W i and z ∈ W i+2 . Now G[x, y, z] is a K 3 , a contradiction. Claim 18 follows by symmetry.

Claim 19. G contains at most two non-simple pairs, and if it contains two, they must be as described in Claim 18, namely these two
Suppose, for contradiction, that the claim is false. Then for some i ∈ {1, . . . , 5} both {W i , W i+2 } and {W i−1 , W i+1 } must be non-simple pairs. Thus, by Claim 17, W i cannot be anti-complete to W i−1 , so by Claim 14, W i is complete to W i−1 . Thus, by Claim 15, it follows that W i is complete to W i+1 . Since {W i−1 , W i+1 } is non-simple, there must be adjacent vertices x ∈ W i−1 and z ∈ W i+1 . Choosing an arbitrary y ∈ W i , we find that G[x, y, z] is a K 3 , a contradiction. This completes the proof of Claim 19.
If {W i , W i+2 } is a non-simple pair, then let W + i be the set of vertices in W i that have neighbours in W i+2 and let W − i+2 be the set of vertices in W i+2 that have neighbours in W i ; note that in this case and show how we could apply bipartite complementations to remove these sets from the graph.
Indeed, suppose for contradiction that there is a vertex Suppose, for contradiction, that x ∈ V i+2 has a non-neighbour non-adjacent to y, respectively. This contradiction implies that V i+2 is complete to W i+2 . Now suppose, for contradiction, that x ∈ V i+2 has a neighbour y ∈ W + i . Since y ∈ W + i it must have a neighbour z ∈ W i+2 and by the previous paragraph, x must be adjacent to z. Now G[x, y, z] is a K 3 , a contradiction. Therefore V i+2 is anti-complete to W + i . Claim 21 follows by symmetry.
] to y and y ; in this case we replace y or y by y if x is adjacent or non-adjacent to y , respectively. Since y ∈ W + i it must have a neighbour z ∈ W i+2 and then z is non-adjacent to y. Now G[ y , z , y, x, v i+4 , v i+3 ] is a P 2 + P 4 , a contradiction. Claim 22 follows by symmetry.
is adjacent to y. Now G[x, y, z] is a K 3 , a contradiction. Therefore W i−2 is anti-complete to W + i . Claim 23 follows by symmetry.

Claim 24. Every module M in G \ (U ∪ V * ∪ W * ) that is an independent set contains at most 512 vertices.
Recall that G is prime, so it contains no non-trivial modules. Let H = G \ (V * ∪ U ∪ W * ) and suppose, for contradiction, that H contains a module M on at least 513 vertices such that M is an independent set. By Claim 19 all but at most two sets of the form W + Claim 25. We may assume that U ∪ V * ∪ W * = ∅.
By Claim 9, we may apply at most five bipartite complementations to separate G[U ∪ V * ] from the rest of the graph. Now, by Claim 13, we can delete at most five vertices from G[U ∪ V * ] to obtain a graph that is either bipartite (in which case it is curious) or 3-uniform. Suppose that G contains a non-simple pair We may therefore assume that U ∪ V * ∪ W * = ∅. This completes the proof of Claim 25.
From now on, we assume that U = ∅ and {W i , W i+2 } is simple for every i ∈ {1, . . . , 5}. Indeed, recall that if (prior to the assumption of Claim 25) Note that in the proof of Claim 25 we edit the graph G in such a way that it may stop being prime. We may do so at this stage in the proof, as the remaining arguments in the proof do not directly rely on the property that G is prime. Instead, we will rely on a weaker property, which follows from Claim 24 and still holds for the edited graph G, namely that G does not contain any module M that is an independent set on more than 512 vertices. As we shall see, this weaker property will suffice for completing the proof. Let X ⊆ V i with |X| ≥ 513 and note that X is an independent set by Claim 2. By Claim 24, X cannot be a module, so there must be two vertices x, y ∈ X that are distinguished by a vertex z outside X , say z is adjacent to x, but non-adjacent to y. By definition of V i , vertices in the cycle C cannot distinguish two vertices in the same set V i , so z / ∈ C . We will show that {x, y} dominates either V i+1 or V i−1 . Suppose, for contradiction, that x and y are both non-adjacent to a ∈ V i−1 and both non-adjacent to b ∈ V i+1 . By Claim 2 vertices in By symmetry, we may therefore assume that would be a K 3 and by Claim 2, a is non-adjacent to b. It follows that G[ y, v i−1 , a, z, v i+2 , b] is a P 2 + P 4 . This contradiction completes the proof of Claim 26.

Claim 27. By deleting at most 512 vertices from each set V i we may assume that each vertex of V i dominates either V i−1 or V i+1 .
Note that V i−1 is anti-complete to V i+1 by Claim 2. For each x ∈ V i−1 and y ∈ V i+1 , let A x, y denote the set of vertices in V i that are non-adjacent to both x and y. Consider an x ∈ V i−1 and a y ∈ V i+1 such that A x, y is non-empty, say a ∈ A x, y . (Note that if A x, y is empty for all x and y then we are done.) If a vertex b ∈ V i is adjacent to exactly one of x and y, say b is adjacent to x, then G[v i+2 , y, a, v i−1 , b, x] is a P 2 + P 4 , a contradiction. This contradiction shows that if A x, y is non-empty Now choose x and y such that |A x, y | is maximum. Suppose, for contradiction, that there is a vertex b ∈ V i \ A x, y with a non-neighbour x ∈ V i−1 and a non-neighbour y ∈ V i+1 . Note that b must be adjacent to both x and y and b ∈ A x ,y . Furthermore, since |A x, y | is maximum, there must be a vertex a ∈ A x, y \ A x ,y , so a is adjacent to both x and y . Now  G[a, x , x, b, y, v i+2 ] is a P 2 + P 4 , a contradiction. It follows that every vertex in V i \ A x, y dominates either V i−1 or V i+1 . By Claim 26, |A x, y | ≤ 512, so we delete the vertices of A x, y . This completes the proof of Claim 27.
By Claim 27, we may assume that every vertex of V i dominates either V i−1 or V i+1 . Therefore, we can partition each set V i into three (possibly empty) subsets as follows: By definition of this partition, if x ∈ V i is non-adjacent to y ∈ V i+1 , then x ∈ V − i and y ∈ V + i+1 . Moreover, every vertex of V − i has a non-neighbour in V + i+1 and vice versa. Thus, the vertices of V 1 ∪ · · · ∪ V 5 are partitioned into 15 subsets (some or all of which may be empty). Note that for i ∈ {1, . . . , 5} the sets V 0 Next, we will analyse the edges between sets of the form , then x is anti-complete to V i+3 and complete to V − i+2 .
, then x is anti-complete to V i+2 and complete to V + i+3 .
Suppose x ∈ W i has a neighbour y ∈ V 0 i+2 ∪ V + i+2 . If z ∈ V i+3 then y is adjacent to z, so x must be non-adjacent to z, otherwise G[x, y, z] would be a K 3 . Therefore x is anti-complete to V i+3 . If y ∈ V − i+2 then y has a non-neighbour z ∈ V i+3 . Note that z is non-adjacent to x. Now x must be adjacent to y , otherwise G[x, y , z ] would be a 3P 1 , contradicting Claim 28. It follows that x is complete to V − i+2 . Claim 29 follows by symmetry. By Claim 29 we can partition W i into three (possibly empty) subsets as follows: (and are therefore anti-complete to V i+3 and complete i+3 (and are therefore anti-complete to V i+2 and complete to V + i+3 ) and -W 0 Recall that the only sets V j with which W i can have form a non-simple pair are V i+2 and V i+3 . Therefore, by Claim 29, j } then it must be one of the following pairs: An edge is shown between two such sets if it is possible for this pair of sets to be non-simple. If an edge is not shown between two sets, then these sets form a simple pair and therefore all edges between them can be removed by using at most one bipartite complementation.
Recall among pairs of sets of the form  We will show that for every set i and note that u is non-adjacent to z and adjacent to y by Claim 29.
Finally, applying a bipartite complementation between each of the sets in H 2 i and their neighbourhood in the cycle C disconnects H 2 i from the remainder of the graph. This completes the proof of Claim 31.
In the next two claims, we show that graphs of the first kind are curious and graphs of the second kind can be partitioned into two curious induced subgraphs by applying at most two bipartite complementations.
i+3 then it is curious by Claim 28. We may therefore assume that W 3 i−1 and/or W 2 i+1 belong to H 2 i+2 that is adjacent to x. Thus y must be non-adjacent to z by Claim 2.
If z is non-adjacent to u then G[v i , u, y, x, z, v i−2 ] is a P 2 + P 4 , a contradiction. Therefore z is adjacent to u. By definition of W 0 i , it follows that z / ∈ V 0 i+2 and so z ∈ V − i+2 . We conclude that W 3 * i−1 is anti-complete to V 0 i+2 , and by symmetry, W 2 * i+1 is anti-complete to V 0 i+3 . Now suppose that there is a vertex z ∈ V − i+2 such that x is non-adjacent to z . If z is adjacent to u then G[x, v i−1 , u, z , v i+1 , v i+2 ] is a P 2 + P 4 . Therefore z must be non-adjacent to u. We conclude that every vertex in V − i+2 is adjacent to x if and only if it is adjacent to u. Since x was chosen from W 3 * i−1 arbitrarily, this means that every vertex in V − i+2 is either complete or anti-complete to W 3 * i−1 . Therefore, applying at most one bipartite complementation, we can remove all edges from V − i+2 to W 3 * i−1 Recall that V 0 i+2 is anti-complete to W 3 * i−1 . By assumption, W 3 * i−1 is anti-complete to W 0 i , complete to W 2 * i+1 and anti-complete to W 2 i+1 \ W 2 * i+1 . By Claim 2, W 3 * i−1 is anti-complete to V i+3 . Therefore, applying at most one bipartite complementation, we can remove all edges between vertices in W 3 * i−1 and We set that X , Y and Z are independent sets. Now suppose, for contradiction, that H 2 i is not curious with respect to the partition (X , Y , Z ). Then there must be vertices x ∈ X , y ∈ Y and z ∈ Z such that G[x, y, z] is a 3P 1 . Since x and y are non-adjacent, it follows that x ∈ V + i+3 and y ∈ V − i+2 . By Claim 28, z / ∈ W 0 i . By symmetry, we may assume z ∈ W 3 i−1 . Let w be an arbitrary vertex of W 0 i . Then w must be non-adjacent to y, otherwise G[v i−1 , z, w, y, v i+1 , v i+2 ] is a P 2 + P 4 . By Claim 28, w must therefore be adjacent to x. Thus G[v i+1 , y, w, x, v i−1 , z] is a P 2 + P 4 , a contradiction. It follows that H 2 i is indeed a curious graph with respect to the partition (X , Y , Z ). This completes the proof of Claim 33.
Applying Claims 30, 31, 32 and 33, we remove all vertices of V i and W i except maybe for some sets V 0 i . By definition, each set V 0 i is complete to V 0 i−1 ∪ V 0 i+1 and by Claim 2 it is anti-complete to V 0 . We delete the five vertices of the cycle C and then apply a bipartite complementation between any pair of non-empty sets V 0 i and V 0 i+1 . This will yield an independent set, which is a curious (K 3 , P 2 + P 4 )-free graph where two parts of the partition are empty. It remains only to count the number of operations applied and the number of obtained curious and 3-uniform graphs.
As explained in the proof of Claim 25, by Claim 9, we apply at most five bipartite complementations to separate G[U ∪ V * ] from the rest of the graph. We then delete at most five vertices from G[U ∪ V * ] to obtain a graph that is either curious or 3-uniform. Next, as also explained in the proof of Claim 25, we can separate G[W * ] from the rest of G \ (V * ∪ U ) by applying 2 × 2 = 4 bipartite complementations and obtain at most two curious graphs. Next, in Claim 27, for each i ∈ {1, . . . , 5}, we delete at most 512 vertices. Deleting the five vertices of the cycle C yields five more vertex deletions. Recall that for i ∈ {1, . . . , 5}, we partitioned W i into W 0 i , W 2 i and W 3 i and partitioned V i into V 0 i , V − i and V + i , yielding 30 subsets of vertices altogether. In Claims 30 and 31, we apply bipartite complementations between certain pairs of these subsets to separate the graphs of both kinds. Thus, in these claims we apply at most 30 2 = 435 bipartite complementations. For each i ∈ {1, . . . , 5}, Claim 32 says that H 1 i is a curious graph. In Claim 33, for each i ∈ {1, . . . , 5} we apply at most two bipartite complementations and obtain at most two curious graphs. Finally, we apply at most five bipartite complementations between non-empty sets V 0 i and V 0 i+1 , yielding at most one curious graph. This gives a total of 5 + 4 + 435 + (5 × 2) + 5 = 459 bipartite complementations, 5 + (5 × 512) + 5 = 2570 vertex deletions yielding at most 1 + 2 + (5 × 1) + (5 × 2) + 1 = 19 curious graphs and at most one 3-uniform graph. This completes the proof. 2 We can now prove our main result. Recall that it was already known [12] that the class of (K 3 , P 1 + P 5 )-free graphs has bounded clique-width, but that it was not known that this class is well-quasi-ordered.

Theorem 5.
For H ∈ {P 2 + P 4 , P 1 + P 5 } the class of (K 3 , H)-free graphs is well-quasi-ordered by the labelled induced subgraph relation and has bounded clique-width.
Proof. Let H ∈ {P 2 + P 4 , P 1 + P 5 }. By Lemmas 2 and 5, we need only consider prime graphs in the class of (K 3 , H)-free graphs.
First, consider the bipartite (not necessarily prime) (K 3 , H)-free graphs. The class of bipartite (K 3 , H)-free graphs forms a subclass of the class of (P 7 , S 1,2,3 )-free bipartite graphs, since H ⊆ i P 7 , S 1,2,3 . The class of (P 7 , S 1,2,3 )-free bipartite graphs is well-quasi-ordered by the labelled induced subgraph relation by Lemma 6 and has bounded clique-width by Theorem 3.
Therefore the class of bipartite (K 3 , H)-free graphs is well-quasi-ordered by the labelled induced subgraph relation and has bounded clique-width.