Finding Matching Cuts in H-Free Graphs

The well-known NP-complete problem Matching Cut is to decide if a graph has a matching that is also an edge cut of the graph. We prove new complexity results for Matching Cut restricted to H-free graphs, that is, graphs that do not contain some fixed graph H as an induced subgraph. We also prove new complexity results for two recently studied variants of Matching Cut, on H-free graphs. The first variant requires that the matching cut must be extendable to a perfect matching of the graph. The second variant requires the matching cut to be a perfect matching. In particular, we prove that there exists a small constant r>0\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$r>0$$\end{document} such that the first variant is NP-complete for Pr\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$P_r$$\end{document}-free graphs. This addresses a question of Bouquet and Picouleau (The complexity of the Perfect Matching-Cut problem. CoRR, arXiv:2011.03318, (2020)). For all three problems, we give state-of-the-art summaries of their computational complexity for H-free graphs.


Introduction
Cut sets and connectivity are central topics in algorithmic graph theory.We consider edge cuts in graphs that have some additional structure.The common property of these cuts is that the edges in them must form a matching.Formally, consider a connected graph G = (V, E).A set M ⊆ E is a matching if no two edges in M have a common end-vertex.A set M ⊆ E is an edge cut, if V can be partitioned into sets B and R such that M consists of all the edges with one end-vertex in B and the other one in R. Now, M is a matching cut if M is a matching that is also an edge cut; see also Figure 1.Matching cuts are well studied due to their applications in number theory [16], graph drawing [27], graph homomorphisms [15], edge labelings [1] and ILFI networks [12].The corresponding decision problem, which asks whether a given connected graph has a matching cut, is known as Matching Cut.
We also consider two natural variants of Matching Cut.First, let G be a connected graph that has a perfect matching M , that is, every vertex of G is incident to an edge of M .If M contains a matching cut M of G, then M is a disconnected perfect matching of G; see again Figure 1 for an example.The problem Disconnected Perfect Matching is to decide if a graph has a disconnected perfect matching.Every yes-instance of Disconnected Perfect Matching is a yes-instance of Matching Cut, but the reverse might not be true; for example, the 3-vertex path has a matching cut but no (disconnected) perfect matching.
Suppose now that we search for a matching cut with a maximum number of edges, or for a disconnected perfect matching with a matching cut that is as large as possible.In both settings, the extreme case is when the matching cut is a perfect matching itself.Such a matching cut is called perfect; see Figure 1.By definition, a perfect matching cut is a disconnected perfect matching, but the reverse might not hold: take the cycle on six vertices which has several disconnected perfect matchings but no perfect matching cut.The problem Perfect Matching Cut is to decide if a connected graph has a perfect matching cut.All three problems are known to be NP-complete, as we will explain in more detail below.
Figure 1 The graph P6 with a matching cut that is not contained in a disconnected perfect matching (left), a matching cut that is properly contained in a disconnected perfect matching (middle) and a perfect matching cut (right).In each figure, thick edges denote matching cut edges.
Hence, it is natural to restrict the input to some special graph class to obtain a better understanding of the computational hardness of some problem, or some set of problems.In particular, jumps in complexity can be large and unexpected.To give an extreme example [25], there exist problems that are PSPACE-complete in general but constant-time solvable for every other hereditary graph class, i.e., that is closed under vertex deletion.
It is readily seen that a graph class is hereditary if and only if it can be characterized by a set of forbidden induced subgraphs.A well-known example of a family of hereditary graph classes is obtained when we forbid a single subgraph H.That is, a graph G is H-free if G does not contain H as induced subgraph, or equivalently, if G cannot be modified into H by a sequence of vertex deletions.The class of H-free graphs has proven to be an ideal testbed for a systematic study into the complexity of many classical graph problems and graph parameters, as can not only be seen from surveys for e.g.Colouring [14,28] or clique-width [10], but also from extensive studies for specific H-free graphs, e.g.bull-free graphs [7] or claw-free graphs [8,18].As such, we will also focus on H-free graphs in this paper.Before presenting our results we first discuss relevant known results.

Known Results
Out of the three problems, Matching Cut has been studied most extensively.Already in the eighties, Chvátal [9] proved that Matching Cut is NP-complete.Afterwards a large number of complexity results were proven for special graph classes.Here, we only discuss those results that are relevant for our context, whereas results for non-hereditary graph classes can, for example, be found in [3,21].In particular, we refer to a recent paper of Chen et al. [6] for a comprehensive overview.
On the positive side, Bonsma [2] proved that Matching Cut is polynomial-time solvable for K 1,3 -free graphs and P 4 -free graphs.Recently, Feghali [13] proved the same for P 5 -free graphs, which we extended to P 6 -free graphs in [24].In the latter paper, we also showed that if Matching Cut is polynomial-time solvable for H-free graphs, for some graph H, then it is so for (H + P 3 )-free graphs (see Section 2 for any unexplained notation and terminology).
On the negative side, Matching Cut is NP-complete even for K 1,4 -free graphs.This follows from the construction of Chvátal [9] (see also [2,20]).Bonsma [2] proved that Matching Cut is NP-complete for planar graphs of girth 5, and thus for C r -free graphs with r ∈ {3, 4}.Le and Randerath [22] proved that Matching Cut is NP-complete for K 1,5 -free bipartite graphs.Hence, it is NP-complete for H-free graphs if H has an odd cycle.Via a trick of Moshi [26], NP-completeness for H-free graphs also holds if H has an even cycle (see [24]).Feghali [13] proved the existence of an unspecified constant r such that Matching Cut is NP-complete for P r -free graphs; we will show that r = 27 in his construction.
We now turn to Disconnected Perfect Matching.This problem was introduced by Bouquet and Picouleau [4], under a different name, but to avoid confusion with Perfect Matching Cut, Le and Telle [23] introduced the notion of disconnected perfect matchings, which we adapted.As observed in [4], for cubic graphs, the problem is equivalent to finding a disconnected 2-factor.Hence, it follows from a result of Diwan [11] that every planar cubic bridgeless graph, except the K 4 , has a disconnected perfect matching.Bouquet and Picouleau [4] proved that Disconnected Perfect Matching is, among others, polynomialtime solvable for claw-free graphs and P 5 -free graphs, but NP-complete for bipartite graphs (of diameter 4), for K 1,4 -free planar graphs (each vertex of which has either degree 3 or 4) and for planar graphs with girth 5.
Finally, we discuss Perfect Matching Cut.Heggernes and Telle [17] proved that this problem is NP-complete.Le and Telle [23] proved that for every integer g ≥ 3, Perfect Matching Cut is NP-complete even for K 1,4 -free bipartite graphs of girth g.The same authors showed that the problem is polynomial-time solvable for the classes of S 1,2,2 -free graphs (which contain the classes of K 1,3 -free graphs and P 5 -free graphs) and for chordal graphs.As explained in [23], the latter result generalizes a known result for interval graphs, for which a branch decomposition of constant mim-width can be computed in polynomial time.

New Results
For Matching Cut on H-free graphs, the remaining cases are when H is a P 27 -free forest, each vertex of which has degree at most 3, such that H is not an induced subgraph of P 6 +sP 3 or K 1,3 + sP 3 for some constant s ≥ 0. By modifying the construction of Feghali [13], we prove in Section 3 that Matching Cut is NP-complete for (4P 5 , P 19 )-free graphs.Using the aforementioned trick of Moshi [26], we also observe that Matching Cut is NP-complete for H * -free graphs, where H * is the graph that looks like the letter H.
For Disconnected Perfect Matching on H-free graphs, the remaining cases are when H contains an even cycle of length at least 6, such that every vertex of H has degree at most 3 and H is not an induced subgraph of K 1,3 or P 5 .Bouquet and Picouleau [4] asked about the complexity of the problem for P r -free graphs, with r ≥ 6.We partially answer their question by proving NP-completeness for (4P 7 , P 23 )-free graphs in Section 3 (via modifying our construction for Matching Cut for (4P 5 , P 19 )-free graphs).
For Perfect Matching Cut on H-free graphs, the remaining cases are when H is a forest of maximum degree 3, such that H is not an induced subgraph of S 1,2,2 .In Section 4, we first prove that Perfect Matching Cut is polynomial-time solvable for graphs of radius at most 2, and we use this result to obtain a polynomial-time algorithm for P 6 -free graphs.We also prove that if Perfect Matching Cut is polynomial-time solvable for H-free graphs, for some graph H, then it is so for (H + P 4 )-free graphs.All our results are obtained by combining a number of known propagation rules [21,23] with new rules that we will introduce.After applying these rules exhaustively, we obtain a graph, parts of which have been allocated to the sides B and R of the edge cut that we are looking for.We will prove that the connected components of the remaining subgraph will be placed completely in B or R, and that this property suffices.By doing so, we extend a known approach with our new rules and show that in this way we widen its applicability.
The following three theorems present the state-of-art for H-free graphs; here we write G ⊆ i G to indicate that G is an induced subgraph of G; as mentioned, recall that all undefined notation can be found in Section 2.
Theorem 1.For a graph H, Matching Cut on H-free graphs is polynomial-time solvable if H ⊆ i sP 3 + K 1,3 or sP 3 + P 6 for some s ≥ 0, and NP-complete if H ⊇ i C r for some r ≥ 3, K We state a number of open problems that originate from our systematic study in Section 5.

Preliminaries
We only consider finite undirected graphs without multiple edges and self-loops.Throughout this section, we let is the graph obtained from G after deleting the vertices not in S. We write We say that S is a dominating set of G, and that G[S] dominates G, if every vertex of V \ S has at least one neighbour in S.
The domination number of G is the size of a smallest dominating set of G.
Let u, v ∈ V .The distance between u and v in G is the length (number of edges) of a shortest path between u and v in G.The eccentricity of u is the maximum distance between u and any other vertex of G.The radius of G is the minimum eccentricity over all vertices of G.If G is not a tree, then the girth of G is the length of a shortest cycle in G.
Let H be a graph.
for every i ∈ {1, . . ., n}.The graph P r is the path on r vertices.The graph C r is the cycle on r vertices.A bipartite graph with non-empty partition classes V 1 and V 2 is complete if there is an edge between every vertex of V 1 and every vertex of is the star on + 1 vertices.The graph K 1,3 is also known as the claw.For 1 ≤ h ≤ i ≤ j, the graph S h,i,j is the tree with one vertex of degree 3, whose (three) leaves are at distance h, i and j from the vertex of degree 3. Observe that S 1,1,1 = K 1,3 .We need the following known result (which has been strengthened in [5]).

Theorem 4 ([30]
).A graph G is P 6 -free if and only if each connected induced subgraph of G contains a dominating induced C 6 or a dominating (not necessarily induced) complete bipartite graph.Moreover, such a dominating subgraph of G can be found in polynomial time.
Let G 1 and G 2 be two vertex disjoint graphs.The graph For a graph G, the graph sG is the disjoint union of s copies of G. Let H * be the "H"-graph, which is the graph on six vertices obtained from the 2P 3 by adding an edge joining the middle vertices of the two P 3 s.
A red-blue colouring of G colours every vertex of G either red or blue.If every vertex of a set S ⊆ V has the same colour (red or blue), then S (and also G[S]) are called monochromatic.A red-blue colouring is valid, if every blue vertex has at most one red neighbour; every red vertex has at most one blue neighbour; and both colours red and blue are used at least once.If a red vertex u has a blue vertex neighbour v, then u and v are matched.See also Figure 1.
For a valid red-blue colouring of G, we let R be the red set consisting of all vertices coloured red and B be the blue set consisting of all vertices coloured blue (so V = R ∪ B).Moreover, the red interface is the set R ⊆ R consisting of all vertices in R with a (unique) blue neighbour, and the blue interface is the set B ⊆ B consisting of all vertices in B with a (unique) red neighbour in R. A red-blue colouring of G is perfect, if it is valid and moreover R = R and B = B. A red-blue colouring of a graph G is perfect-extendable, if it is valid and G[R \ R ] and G[B \ B ] both contain a perfect matching.In other words, the matching given The K2,2-replacement applied on edge uv.
by the valid red-blue colouring can be extended to a perfect matching in G or, equivalently, is contained in a perfect matching in G.We can now make the following known observation.

Our NP-Completeness Results
We prove three NP-completeness results in this section.Our first result is a straightforward observation.Let uv be an edge in a graph G. Replacing uv by new vertices w 1 and w 2 and edges uw 1 , uw 2 , vw 1 , vw 2 is a K 2,2 -replacement.Let G uv be the new graph; see also Figure 2. Moshi [26] showed that G has a matching cut if and only if G uv has a matching cut.Applying a K 2,2 -replacement on every edge to ensure that no two degree-3 vertices are adjacent anymore leads to the following: Theorem 6. Matching Cut is NP-complete for H * -free graphs.
For proving our next two NP-completeness results, we reduce from The Exact Positive 1-in-3 SAT.This problem takes as input a pair (X, C), where X is a set of variables and C is a set of clauses, each containing exactly three literals, all three of which are positive.Moreover, each variable of X appears in exactly three clauses of C. The question is whether there exists a truth assignment, such that each clause contains exactly one true literal.
Theorem 8 is our first new result.Its proof follows from Feghali's construction [13] after making some minor modifications to it.For completeness, and since we use the modified construction as a basis for the proof of Theorem 11, we added a detailed proof.Recall that Feghali [13] showed that Matching Cut is NP-complete for P r -free graphs, for some unspecified constant r.We will show that in [13]  Proof.Matching Cut is in NP, since it is possible to check in polynomial time if a given red-blue-colouring is valid or not.To prove NP-hardness, we will use a reduction from Exact Positive 1-in-3 SAT, which is NP-complete by Theorem 7. Let I be an instance of Exact Positive 1-in-3 SAT with variable set X and clause set C. We will build a graph G I (see also Figures 3 and 4): Figure 3 The cliques S1 and S2 together with the variable gadget of xi.
for every  We claim that I admits a truth assignment such that each clause contains exactly one true literal if and only if G I admits a valid red-blue-colouring.
First suppose that G I admits a valid red-blue-colouring.We start with some useful claims.Claim 8.1.For any variable x i ∈ X, i = 1, . . ., |X|, both V xi and U xi are monochromatic.Furthermore, S 1 , S 2 and S 3 are each monochromatic.
Proof.This immediately follows from the fact these sets are cliques of size at least 3.
We say that a monochromatic set has colour red or blue if all its vertices are coloured red or blue, respectively.Claim 8.2.It holds that S 1 and S 2 have different colours.
Proof.Suppose for a contradiction that S 1 and S 2 have the same colour.We may assume, without loss of generality, that S 1 and S 2 are both coloured blue.Since for every variable x i ∈ X, i = 1, . . ., |X|, there exist vertices u s xi and v s xi having each a neighbour in both S 1 and S 2 , it follows that every variable gadget is coloured blue.This implies in particular that every vertex v cj , for j = 1, . . ., |C|, has three blue neighbours and hence, is coloured blue itself.Further, since S 3 is monochromatic by Claim 8.1, all the vertices u 1 cj , u 2 cj , for j = 1, . . ., |C|, are coloured blue.Thus, both neighbours of each auxiliary vertex are blue, which forces the auxiliary vertices to be blue themselves.It follows that all vertices in G I are coloured blue.Hence, the colouring is not valid, a contradiction.

Claim 8.3. For every variable x
Proof.Suppose for a contradiction that for some variable x i ∈ X, i ∈ {1, . . ., |X|}, U xi and V xi have the same colour.We may assume without loss of generality that they are both coloured blue.Since s i 1 and s i 2 are both adjacent to u s xi and to v s xi , it follows that they are both coloured blue.Now it follows from Claim 8.1, that S 1 and S 2 must both be coloured blue, a contradiction to Claim 8.2.Claim 8.4.For every clause c j ∈ C, exactly two neighbours of v cj have the same colour as v cj .
Proof.We may assume without loss of generality that v cj is coloured blue.Let xi 3 be the three neighbours of v cj outside of S 3 and let u 1 xi 1 , u 2 xi 2 and u 3 xi 3 be the neighbours of the auxiliary vertices a k cj , k = 1, . . ., 6.By definition of a valid red-blue-colouring, v cj has at least two neighbours outside of S 3 that are coloured blue.Suppose for a contradiction that the vertices xi 3 are all coloured blue.Then, it follows from Claim 8.1, that V xi 1 , V xi 2 , V xi 3 must be coloured blue.Notice that, since v cj is coloured blue, Claim 8.1 also implies that all vertices in S 3 , and in particular u 1 cj and u 2 cj , are coloured blue.Let A 1 (resp.A 2 ) be the set of auxiliary vertices which are adjacent to u 1 cj (resp.u 2 cj ).Then, at least two vertices in A 1 and two vertices in A 2 are coloured blue.Since u 1 xi 1 , u 2 xi 2 and u 3 xi 3 have each one neighbour in A 1 and one neighbour in A 2 , it follows that one of them has two blue neighbours in A 1 ∪ A 2 , and is therefore coloured blue.We may assume, without loss of generality, that this vertex is u 1 xi 1 .Using Claim 8.1 again, we get that U xi 1 is coloured blue, a contradiction to Claim 8.3.
We continue as follows.By Claim 8.1, we may assume without loss of generality that S 3 is coloured blue.Then, we set every variable x i ∈ X, i ∈ {1, . . ., |X|}, to true for which V xi has been coloured red.We set all other variables to false.By Claim 8.4, we know that for each clause c j ∈ C, j ∈ {1, . . ., |C|}, there exists exactly one red neighbour of v cj .Hence, in every clause, exactly one literal is set to true.Since by Claim 8.1, every V xi , i ∈ {1, . . ., |X|}, is monochromatic, it follows that no variable gets both values true and false.Thus, I admits a truth assignment such that each clause contains exactly one true literal.Now suppose that I admits a truth assignment such that each clause contains exactly one true literal.For every variable x i ∈ X, i ∈ {1, . . ., |X|}, that is set to true, we colour V xi red The given valid red-blue-colouring of the clause gadget for cj. and U xi blue; for every other variable x i ∈ X, we colour V xi blue and U xi red.It follows that every vertex v cj , for c j ∈ C and j ∈ {1, . . ., |C|}, has exactly one red and two blue neighbours outside of S 3 , since the truth assignment is such that each clause contains exactly one true literal.Thus, we colour S 3 blue.If we consider a clause c j = (x i1 ∨ x i2 ∨ x i3 ), we know that exactly one of U xi 1 , U xi 2 , U xi 3 is blue and the other ones are red.Assume, without loss of generality, that U xi 1 is blue and consider a 1 cj , a 4 cj , the neighbours of We then colour a 1 cj , a 4 cj blue, since they have two blue neighbours (u 1 xi 1 and u 1 cj resp.u 2 cj ).To obtain a valid red-blue colouring of G I , we have to colour one of the vertices a 2 cj , a 5 cj blue and the other one red, and similarly, one of the vertices a 3 cj , a 6 cj blue and the other one red.Since u 1 cj , u 2 cj are both coloured blue and each of them can have at most one red neighbour, we colour a 2 cj , a 6 cj blue and a 3 cj , a 5 cj red (see Figure 5).Finally, the only vertices that remain uncoloured are the vertices in S 1 and S 2 .Here, the only restriction is that S 1 and S 2 are coloured differently, hence we colour for instance S 1 blue and S 2 red.This clearly gives us a valid red-blue-colouring of G I .
To complete the proof, it remains to show that G I is (4P 5 , P 19 )-free.Let P be a longest induced path in G I .P can contain at most two vertices from a same clique, since otherwise it would not be induced.Also, if P contains two vertices from a same clique, then these vertices are necessarily consecutive in By construction, every path from a vertex in W 1 to a vertex in W 2 contains at least one vertex from one of the cliques S 1 , S 2 , S 3 .Hence, P can intersect at most 4 cliques belonging to some variable gadgets; further, if it does intersect 4 cliques belonging to some variable gadgets, then it intersects each of the cliques S 1 , S 2 , S 3 as well.Notice that after respectively before intersecting S 3 , P may contain at most one auxiliary vertex (see Figure 6 for an example).Finally, the end-vertices of P may correspond each to an auxiliary vertex.So P contains at most 18 vertices, and thus, G I is indeed P 19 -free.
Let P now be a P 5 in G I .Assume that P does not contain any vertex of the cliques S 1 , S 2 , S 3 .Then, P can only contain vertices from variable gadgets and auxiliary vertices.As mentioned above, P can contain at most two vertices from a same clique, and further every path from a vertex in contains at least one vertex from one of the cliques S 1 , S 2 , S 3 .Hence, P has length at most 3, a contradiction.We conclude that P must intersect at least one of the cliques S 1 , S 2 , S 3 .It follows that there can exist at most 3 pairwise induced paths of length 4, so G I is 4P 5 -free.Remark 9.It can be verified that the graph G I in the proof Theorem 8 is not P 18 -free and not sP 4 -free for any s ≥ 1.
Remark 10.In the graph G I from the proof of Theorem 8, no vertex of U xi is adjacent to a vertex of V xi , for any x i ∈ X.In Feghali's construction [13], there is an edge between any two such cliques.This implies that an induced path can use four consecutive vertices inside the same variable gadget.Via similar arguments as in our proof, one can easily show that Feghali's construction has an induced P 26 , but no induced P 27 (and thus it is P 27 -free).
We now modify the construction in the proof of Theorem 8 to obtain the following result for Disconnected Perfect Matching, which addresses a question of Bouquet and Picouleau [4].
Proof.We first note that Disconnected Perfect Matching belong to NP, as we can verify in polynomial time if a given perfect-extendable red-blue-colouring is valid or not.
In order to prove NP-hardness, we reduce from Exact Positive 1-in-3 SAT, which is NP-complete by Theorem 7. Let I be an instance of Exact Positive 1-in-3 SAT with variable set X and clause set C. We build a graph G I similarly to the graph in Theorem 11 (see also Figures 7 and 8 We claim that I has a truth assignment such that each clause contains exactly one true literal if and only if G I has a perfect-extendable red-blue-colouring.

Figure 7
The cliques S1 and S2, together with the variable gadget of xi.First suppose that G I admits a valid perfect-extendable red-blue-colouring.We start with some useful claims, the first three have the same proof as Claims 8. Proof.We may assume, without loss of generality, that v 1 cj (resp.v 2 cj ) is coloured blue.By symmetry, it is enough to prove the claim for We continue as follows.By Claim 11.1, we may assume without loss of generality that S 3 is coloured blue.We set every variable x i ∈ X, for which V xi has been coloured red, to true.We set all other variables to false.By Claim 11.4, we know that for each clause c j ∈ C, j ∈ {1, . . ., |C|}, there is exactly one red neighbour of v 1 cj (resp.v 2 cj ).Hence, in every clause, exactly one literal is set to true.Since by Claim 11.1, every V xi , i ∈ {1, . . ., |X|}, is monochromatic, it follows that no variable is both true and false.Thus, I admits a truth assignment such that each clause contains exactly one true literal.
Conversely, assume now that I admits a truth assignment such that each clause contains exactly one true literal.For every variable x i ∈ X, i ∈ {1, . . ., |X|}, that is set to true, we colour V xi red and U xi blue; for every other variable x i ∈ X, we colour V xi blue and U xi red.It follows that every vertex v k cj , c j ∈ C and j ∈ {1, . . ., |C|}, k = 1, 2, has exactly one red and two blue neighbours outside of S 3 , since the truth assignment is such that each clause contains exactly one true literal.Thus, we colour S 3 blue.If we consider a clause A perfect-extendable red-blue-colouring of the clause gadget.Notice that vertices v 1 c j , v 2 c j , u 1 c j , . . ., u 4 c j belong to the clique S3, but for the sake of readability, we omitted the edges between vertices v 1 c j , v 2 c j and vertices u 1 c j , . . ., u 4 c j in this figure .vertices in the clause gadget of c j can be matched and the same holds for the vertices in V xi 1 .The auxiliary vertices which are adjacent to vertices in U xi 2 ∪ U xi 3 have exactly one neighbour of the opposite colour and thus, they can be matched with either clause vertices or vertices in U xi 2 ∪ U xi 3 (see Figure 9).The auxiliary vertices a 1 cj , a 4 cj , a 7 cj and a 10 cj , which are neighbours of U xi 1 , are all coloured blue.In this case, we consider the edges a 1 cj a 7 cj and a 4 cj a 10 cj as matching edges.
The only vertices that remain unmatched are vertices in variable gadgets of variables x i ∈ X, i ∈ {1, . . ., |X|}, which are set to false.Since all vertices v s xi and v s ui are already matched, for all x i ∈ X, i ∈ {1, . . ., |X|}, there remains an even number of unmatched vertices in each clique of these variable gadgets, all coloured with the same colour.Hence, we can easily find matching edges inside these cliques.We conclude that our valid red-blue-colouring is indeed perfect-extendable.
To complete the proof, it remains to show that G I is indeed (4P 7 , P 23 )-free.To show that it is P 23 -free, we follow the same arguments as in the proof of Theorem 11, when we showed that the corresponding graph was P 19 -free.Let P be a longest induced path in G I .P can contain at most two vertices from each clique, since otherwise it would not be induced.Also, if P contains two vertices from a same clique, then these vertices are necessarily consecutive in Every path from a vertex in W 1 to a vertex in W 2 contains at least one vertex from one of the cliques S 1 , S 2 , S 3 .Hence, P can intersect at most 4 cliques belonging to some variable gadgets; further, if it does intersect four cliques belonging to some variable gadgets, then it intersects each of the cliques S 1 , S 2 , S 3 as well.Notice that after respectively before intersecting S 3 , P may contain at most two auxiliary vertices (see Figure 10).Also, the first two, respectively the last two, vertices in P may correspond to auxiliary vertices.So P contains at most 22 vertices, and thus, G I is indeed P 23 -free.
Consider now the graph . This graph consists of two types of connected components: (i) every V xi , for x i ∈ X, corresponds to a clique of size 7; (ii) every U xi , for x i ∈ X, together with some auxiliary vertices corresponds to a connected component as shown in Figure 11.Clearly, any induced path contains at most two vertices of a same clique.Furthermore, it is easy to see that any induced path contains at most six vertices from a connected component containing a clique U xi (see Figure 11).Hence, every induced path with length at least 6 has to contain a vertex in one of the cliques S 1 , S 2 , S 3 .It immediately follows that G I is 4P 7 -free.

Our Polynomial Results
We start with two lemmas, whose proofs are similar to the proofs for valid but not necessarily perfect red-blue colourings; see, for example, [13] or [24] for explicit proofs.
Lemma 12.For every integer g, it is possible to find in O(2 g n g+2 ) time a perfect red-blue colouring (if it exists) of a graph with n vertices and with domination number g.

Proof.
Let g ≥ 1 be an integer, and let G be a graph with domination number at most g.Hence, G has a dominating set D of size at most g.We consider all options of colouring the vertices of D red or blue; note that this number is 2 |D| ≤ 2 g .For every red vertex of D with no blue neighbour, we consider all O(n) options of colouring exactly one of its neighbours blue (and thus, all of its other neighbours will be coloured red).Similarly, for every blue vertex of D with no red neighbour, we consider all O(n) options of colouring exactly one of its neighbours red (and thus, all of its other neighbours will be coloured blue).Finally, for every red vertex in D with already one blue neighbour in D, we colour all its yet uncoloured neighbours red.Similarly, for every blue vertex in D with already one red neighbour in D, we colour all its yet uncoloured neighbours blue.
As D is a dominating set, the above means that we guessed a red-blue colouring of the whole graph G.We can check in O(n 2 ) time if a red-blue colouring of a graph with n vertices is perfect.Moreover, the total number of red-blue colourings that we must consider is O(2 g n g ).Lemma 13.Let D be a dominating set of a connected graph G.It is possible to check in polynomial time if G has a perfect red-blue colouring in which D is monochromatic.
Proof.Consider a perfect red-blue colouring c of G, in which D is monochromatic, say every vertex of D is coloured red.Let F 1 , . . ., F r , for some integer r ≥ 1, be the connected components of G − D.
We claim that every F i is monochromatic.This follows from the same argument as the one for valid red-blue colourings that are not necessarily perfect (see [24]) and we give it for completeness.For a contradiction, assume that, say, F 1 is not monochromatic.This means that F 1 contains an edge uv where u is coloured red and v is coloured blue.As D is a dominating set of G, we have that v also has a neighbour in D, which is coloured red.Hence, c is not valid and thus not perfect either, a contradiction.Now suppose that some vertex u in F i is coloured red.By the above claim, every vertex of F i is coloured red.The neighbours of u outside F i are all in D and thus, are coloured red as well.Hence, u has no blue neighbour, meaning that c is not perfect, a contradiction.We conclude that every vertex in G − D must be coloured blue.
Hence, in order to check if G has a perfect red-blue colouring in which D is monochromatic, we can do as follows.Colour every vertex in D red and colour every vertex in G − D blue.Then, check in polynomial time if the resulting red-blue colouring is perfect.
To handle "partial" perfect red-blue colourings, we introduce the following terminology.Let G = (V, E) be a connected graph and S, T, X, Y ⊆ V be four non-empty sets with S ⊆ X, T ⊆ Y and X ∩ Y = ∅.A red-blue (S, T, X, Y )-colouring of G is a red-blue colouring where every vertex of X is coloured red and every vertex of Y is coloured blue; the blue neighbour of every vertex in S belongs to T and vice versa; and the blue neighbour of every vertex in X \ S and the red neighbour of every vertex of Y belong to V \ (X ∪ Y ).
For a connected graph G = (V, E), let S and T be two disjoint subsets of V , such that (i) every vertex of S is adjacent to at most one vertex of T , and vice versa, and (ii) at least one vertex in S is adjacent to a vertex in T .Let S consist of all vertices of S with a (unique) neighbour in T , and let T consist of all vertices of T with a (unique) neighbour in S (so, every vertex in S has a unique neighbour in T , and vice versa).We call (S , T ) the core of starting pair (S , T ); note that We colour every vertex in S red and every vertex in T blue.Propagation rules will try to extend S and T by finding new vertices whose colour must always be either red or blue.We place new red vertices in a set X and new blue vertices in a set Y .If a red and blue vertex are matched to each other, then we add the red one to a set S ⊆ X and the blue one to a set T ⊆ Y .Initially, S := S , T := T , X := S and Y := T , and we let Z := V \ (X ∪ Y ).
We now present seven propagation rules for finding perfect red-blue (S, T, X, Y )-colourings.Rules R1 and R2 hold for finding red-blue colourings in general and correspond to the five rules from [21].Rules R3-R7 are for finding perfect red-blue colourings; some of them are in a slightly different form in [23].

R1.
Return no (i.e., G has no red-blue (S, T, X, Y )-colouring) if a vertex v ∈ Z is (i) adjacent to a vertex in S and to a vertex in T , or (ii) adjacent to a vertex in S and to two vertices in Y \ T , or (iii) adjacent to a vertex in T and to two vertices in X \ S, or (iv) adjacent to two vertices in X \ S and to two vertices in Y \ T .R2.Let v ∈ Z.
(i) If v is adjacent to a vertex in S or to two vertices of X \ S, then move v from Z to X.
If moreover v is also adjacent to a vertex w in Y , then add v to S and w to T .(ii) If v is adjacent to a vertex in T or to two vertices of Y \ T , then move v from Z to Y .
If moreover v is also adjacent to a vertex w in X, then add v to T and w to S. (i) If v is adjacent to a vertex in X and to a vertex in Y , then return no.
(ii) If v is adjacent to a vertex in X but not to a vertex in Y , then put v in X and w in Y , and also add v to S and w to T .(iii) If v is adjacent to a vertex in Y but not to a vertex in X, then put v in Y and w in X, and also add v to T and w to S.
(i) If v is adjacent to a vertex in X but not to a vertex in Y , and F contains a vertex not adjacent to a vertex in X, then move v from Z to X. (ii) If v is adjacent to a vertex in Y but not to a vertex in X, and F contains a vertex not adjacent to a vertex in Y , then move A propagation rule is safe if the input graph has a perfect red-blue (S, T, X, Y )-colouring before the application of the rule if and only if it has so after the application of the rule.Lemma 14. Rules R1-R7 are safe.
Proof.Let G be a connected graph with a perfect red-blue (S, T, X, Y )-colouring.First recall that, by definition, vertices in X will be coloured red by every red-blue (S, T, X, Y )-colouring, whilst vertices of Y will be coloured blue, and moreover that every (red) vertex in S has exactly one (blue) neighbour in T , and vice versa.The colour of the vertices in Z still has to be decided.
Rule R1-(i) is safe.A vertex adjacent to both a red vertex that already has a blue neighbour and to a blue vertex that already has a red neighbour can be coloured neither red nor blue.Rule R1-(ii) is safe, as a vertex that is adjacent to a red vertex that already has a blue neighbour must be coloured red, so it cannot also be adjacent to two blue vertices.For the same reason, R1-(iii) is safe.Finally, R1-(iv) is safe, as a vertex that is adjacent to two red vertices must be coloured red, so it cannot also be adjacent to two blue vertices.
Rule R2-(i) is safe.Any vertex adjacent to a red vertex that already has a blue neighbour or to two red vertices must be coloured red.If such a vertex is adjacent to a vertex coloured blue already, it will have its blue neighbour and thus must be added to S, whilst its blue neighbour must be added to T .For the same reason, R2-(ii) is safe as well.
Rule R3-(i) is safe.Every red vertex must have a (unique) blue neighbour, and vice versa.For the same reason, R3-(ii) is safe.
Rule R4-(i) is safe.In the first case, x will only have red neighbours in G (as x is coloured red, x needs a blue neighbour as well).In the second case, x will have two blue neighbours, while x is coloured red.This is not possible.For the same reason R4-(ii) is safe as well.
Rule R5-(i) is safe.As v will be adjacent to a blue and red neighbour, w cannot be its matching neighbour.As w has degree 1, we find that w cannot be matched.Rule R5-(ii) is safe as well.For a contradiction, suppose that we would put v in Y .Then the matched neighbour of v is the neighbour of v that belongs to x.Hence, again we find that w does not have a matched neighbour.So we must put v in X, and then v and w will be matched to each other.For the same reason, R5-(iii) is safe.
Rule R6-(i) is safe.Suppose that we put v in Y , that is, v will be coloured blue.Consequently, v has its matching neighbour in X.This means that the two neighbours of v in F will be coloured blue.As F is a cycle on four vertices, the fourth vertex will get colour blue as well.By assumption, F contains a vertex that is not adjacent to a vertex in X.This vertex is coloured blue, but will not have a red neighbour.We conclude that v must be put in X.For the same reason, R6-(ii) is safe as well.
Rule R7-(i) is safe.Suppose that we put v in X, so v will be coloured red, just like w .Hence, w is adjacent to two red vertices, and must be coloured red as well.As w is the only neighbour of w in X ∪ Y , we find that every other neighbour of w is in F .As {v} dominates F , this means that such a neighbour of w is adjacent not only to w but also to v, and hence must be coloured red.This means that w will not have any blue neighbour.We conclude that v must be put in Y .For the same reason, R7-(ii) is safe as well.
Assume that exhaustively applying rules R1-R7 on a starting pair (S , T ) did not lead to a no-answer but to a 4-tuple (S, T, X, Y ).Then we call (S, T, X, Y ) an intermediate 4-tuple.The first part of the next lemma follows from Lemma 14.The second part is straightforward.

Lemma 15. Let G be a graph with a starting pair (S , T ) with core (S , T ) and a resulting intermediate 4-tuple (S, T, X, Y ). Then G has a perfect red-blue (S , T , S , T )-colouring if and only if G has a perfect red-blue (S, T, X, Y )-colouring. Moreover, (S, T, X, Y ) can be obtained in polynomial time.
Proof.The first part of the lemma follows from Lemma 14 and our initialisation.To prove the running time statement, we first note that each application of R1-R7 takes polynomial time.For each rule we can also check in polynomial time if it can be applied.Moreover, after each application of a rule we either find a no-answer or reduce the size of at least one of the sets X, Y , Z. Hence, we obtained (S, T, X, Y ) in polynomial time.
We now describe the structure of a graph with a 4-tuple (S, T, X, Y ).

Lemma 16. Let G be a graph with an intermediate 4-tuple (S, T, X, Y ). Then: (i) every vertex in S has exactly one neighbour in Y , which belongs to T ; (ii) every vertex in T has exactly one neighbour in X, which belongs to S; (iii) every vertex in X \ S has no neighbour in Y ; (iv) every vertex in Y \ T has no neighbour in X;
(v) every vertex in V \ (X ∪ Y ) has no neighbour in S ∪ T , at most one neighbour in X \ S and at most one neighbour in Y \ T .
We prove each of the statement below one by one.
Proof of (i).For a contradiction, first assume that some vertex u in S has no neighbour in T .Then u has no neighbour in Y \ T either, else we would have applied R3.However, now we would have applied R4 (and returned a no-answer).Hence, every vertex in S has a neighbour in T ⊆ Y .If a vertex in S has more than one neighbour in Y , then we would have applied R4 as well.
Proof of (ii).Statement (ii) follows by symmetry: we can use the same arguments as in the proof of (i).
Proof of (iii).Let u ∈ X \ S. If u has a neighbour in Y , then we would have applied R3.
Hence, u has no neighbours in Y .
Proof of (iv).Statement (iv) follows by symmetry: we can use the same arguments as in the proof of (iii).
Proof of (v).Let u ∈ Z.If u is adjacent to a vertex in S ∪ T , then we would have applied R2.If u is adjacent to two vertices in X \ S or to two vertices in Y \ T , then we would also have applied R2.
Let (S, T, X, Y ) be an intermediate 4-tuple of a graph G.
Rules R8-R11 preserve this property; some of them were also used in [21,23].
then put every vertex of F in Y and also add every vertex of F to T and every neighbour of every vertex of F in X to S. (ii) If w ∈ Y , then put every vertex of F in X and also add every vertex of F to S and every neighbour of every vertex of F in Y to T .
then put every vertex of F in X, and also add every vertex of F to S and every vertex of every neighbour of F in Y \ T to T .(ii) If v ∈ Y \ T , then put every vertex of F in Y , and also add every vertex of F to T and every vertex of every neighbour of F in X \ S to S.
and v is not adjacent to Y , then put every vertex of F in Y , and also add every vertex of F to T and every vertex of every neighbour of F in X \ S to S. (ii) If v ∈ Y \ T and v is not adjacent to X, then put every vertex of F in X, and also add every vertex of F to S and every vertex of every neighbour of F in Y \ T to T .
A propagation rule is mono-safe if the input graph has a (monochromatic) perfect red-blue (S, T, X, Y )-colouring before the application of the rule if and only if it has so after the application of the rule.The following lemma is not difficult to prove.

Finding Matching Cuts in H-Free Graphs
Proof.Let G be a connected graph with a monochromatic perfect red-blue (S, T, X, Y )colouring.First recall that, by definition, vertices in X will be coloured red by every red-blue (S, T, X, Y )-colouring, whilst vertices of Y will be coloured blue, and moreover that every (red) vertex in S has exactly one (blue) neighbour in T , and vice versa.The colour of the vertices in Z still has to be decided.Rule R8 is mono-safe.Let F be the connected component of G[Z] that contains v. Then all neighbours of v belong to F , which must be monochromatic.Thus the neighbours of v are coloured either all red or all blue.Hence, v will not have the required neighbour with a different colour than itself.
Rule R9-(i) is mono-safe.As all vertices in F will be coloured with the same colour, this means that w must receive a different colour than v. Hence, as w is coloured red, we find that v, and thus all other vertices of F , must be coloured blue.As every vertex of F only has neighbours in F and in X ∪ Y , we find that all neighbours of every vertex in F are coloured.Hence, we can identify the unique red neighbours of the vertices of F , which in turn will be the unique blue neighbours of these vertices.For the same reason Rule R9-(ii) is mono-safe as well.
Rule R10-(i) is mono-safe.All vertices in F will be coloured with the same colour and at least two of them are adjacent to v. Hence, the vertices in F must all get the same colour as the colour of v, which is red.Just as in the previous rule, we can now identify the unique blue neighbours of the vertices of F , which in turn will be the unique red neighbours of these vertices.For the same reason Rule R10-(ii) is safe as well.
Rule R11-(i) is mono-safe.Let w be the neighbour of v in F .Then all other neighbours of v belong to X; else v would have a neighbour in Y and we would have applied R3.As all vertices in X are coloured red, this means that w must be coloured blue.Hence, as every vertex of F will be coloured the same, every vertex of F will be coloured blue.Just as in the previous two rules, we can now identify the unique red neighbours of the vertices of F , which in turn will be the unique blue neighbours of these vertices.For the same reason Rule R11-(ii) is mono-safe.
Suppose exhaustively applying rules R1-R11 on an intermediate 4-tuple (S, T, X, Y ) did not lead to a no-answer but to a 4-tuple (S * , T * , X * , Y * ).We call (S * , T * , X * , Y * ) the final 4-tuple.The first part of Lemma 18 follows from Lemma 17.The second part is straightforward.

Lemma 18.
Let G be a graph with an intermediate 4-tuple (S, T, X, Y ) and a resulting final 4-tuple (S * , T * , X * , Y * ).Then G has a monochromatic perfect red-blue (S, T, X, Y )-colouring if and only if G has a monochromatic perfect red-blue (S * , T * , X * , Y * )-colouring.Moreover, (S * , T * , X * , Y * ) can be obtained in polynomial time.
Proof.The first part of the lemma follows from Lemma 17 and the fact that (S * , T * , X * , Y * ) results from (S, T, X, Y ).To prove the running time statement, we first note that each application of R1-R11 takes polynomial time.For each rule we can also check in polynomial time if it can be applied.Moreover, after each application of a rule we either find a no-answer or reduce the size of at least one of the sets X, Y , Z. Hence, we obtained (S, T, X, Y ) in polynomial time.
We now describe the structure of a graph with a final 4-tuple (S, T, X, Y ); see also Figure 12. (iii) every vertex in X \ S has no neighbour in Y , at least two neighbours in and exactly one neighbour in Y \ T .
We prove each of the statement below one by one.
Proof of (i).For a contradiction, first assume that some vertex u in S has no neighbour in T .Then u has no neighbour in Y \ T either, else we would have applied R3.However, now we would have applied R4 (and returned a no-answer).Hence, every vertex in S has a neighbour in T ⊆ Y .If a vertex in S has more than one neighbour in Y , then we would have applied R4 as well.
Proof of (ii).Statement (ii) follows by symmetry: we can use the same arguments as in the proof of (i).
Proof of (iii).Let u ∈ X \ S. If u has a neighbour in Y , then we would have applied R3.
Hence, u has no neighbours in Y .If u has no neighbours in V \ (X ∪ Y ), then u would only have neighbours in X.In that case we would have applied R4 (and returned a no-answer).
If u only has one neighbour in Z, then we would have applied R11.Hence, u has at least two neighbours in Z.If two neighbours of u in Z belong to the same connected component of Z, then we would have applied R10.
Proof of (iv).Statement (iv) follows by symmetry: we can use the same arguments as in the proof of (iii).
Proof of (v).Let u ∈ Z.If u is adjacent to a vertex in S ∪ T , then we would have applied R2.Hence, we find that u is not adjacent to a vertex in S ∪ T .If u is adjacent to two vertices in X \ S or to two vertices in Y \ T , then we would also have applied R2.If u has exactly one neighbour in X ∪ Y , then we would have applied R9.If u has no neighbour in X \ S and no neighbour in Y \ T , then u has no neighbour in X ∪ Y , as we already deduced that u has no neighbour in S ∪ T .However, then we would have applied R8 (and returned a no-answer).
We can now prove a lemma that is the cornerstone for our polynomial-time results.

Lemma 20.
Let G be a graph with a final 4-tuple (S, T, X, Y ).Then it is possible to find in polynomial time a monochromatic perfect red-blue (S, T, X, Y )-colouring of G or conclude that such a colouring does not exist.We claim that G has a monochromatic perfect red-blue (S, T, X, Y )-colouring if and only if φ has a satisfying truth assignment.It is readily seen and well known that 2-SAT is polynomial-time solvable, meaning we are done once we have proven this claim.
First suppose that G has a monochromatic perfect red-blue (S, T, X, Y )-colouring c.By definition, the vertices in each connected component C of G[Z] are coloured alike.We define a truth assignment τ as follows.We let x C be true if and only if the vertices of C are coloured red.We let y C be true if and only if the vertices of C are coloured blue.As exactly one of these options holds, the clause We also colour all vertices of X red and all vertices of Y blue.We let c be the resulting colouring.By construction, it is monochromatic.Hence, it remains to show that c is a perfect red-blue (S, T, X, Y )-colouring.We will do this below.
First, it follows from the definition of a core (S , T ) that S and T are non-empty.Moreover, before applying the reduction rules, we first do an initiation, from which it follows that S ⊆ S and T ⊆ T .Hence, at least one vertex of G is coloured red and at least one vertex of G is coloured blue.By Lemma 19-(i), every vertex in S has exactly one neighbour in Y .By Lemma 19-(ii), every vertex in T has exactly one neighbour in X.By , no vertex of S ∪ T is adjacent to a vertex of Z. Hence, the vertices in S ∪ T have exactly one neighbour of opposite colour.By , every vertex z ∈ Z has exactly one neighbour in X \ S, which is coloured red, and exactly one neighbour in Y \ T , which is coloured blue; moreover, z is not adjacent to any vertex in S ∪ T .Let C be the connected component of G[Z] that contains z.As c is monochromatic, all vertices of C receive the same colour.Hence, the vertices in Z have each exactly one neighbour of opposite colour.
Finally, we must verify the vertices in (X ∪ Y ) \ (S ∪ T ).Let u ∈ (X ∪ Y ) \ (S ∪ T ).First assume that u ∈ X \ S, so u is coloured red.We recall that u has exactly two neighbours v and w in Z. From the above we conclude that c is monochromatic and perfect.
We apply Lemma 20 in the next result.Its proof is similar but more involved than the one for Matching Cut on graphs of radius 2 [24].
Theorem 21.Perfect Matching Cut is polynomial-time solvable for graphs of radius at most 2.
Proof.Let G be a graph of radius r at most 2. If r = 1, then G has a vertex that is adjacent to all other vertices.In this case G has a perfect matching cut if and only if G consists of two vertices with an edge between them.From now on, assume that r = 2. Then G has a dominating star H, say H has centre u and leaves v 1 , . . ., v s for some s ≥ 1.By Observation 5 it suffices to check if G has a perfect red-blue colouring.
We first check if G has a perfect red-blue colouring in which V (H) is monochromatic.By Lemma 13 this can be done in polynomial time.Suppose we find no such red-blue colouring.Then we may assume without loss of generality that a perfect red-blue colouring of G (if it exists) colours u red and exactly one of v 1 , . . ., v s blue.That is, G has a perfect red-blue colouring if and only if G has a perfect red-blue ({u}, {v i }, {u}, {v i })-colouring for some i ∈ {1, . . ., s}.We consider all O(n) options of choosing which v i is coloured blue.
For each option we do as follows.Let v i be the vertex of v 1 , . . ., v s that we coloured blue.We define the starting pair (S , T ) with core (S , T ), where S = {u} and T = {v i }.We now apply rules R1-R7 exhaustively.The latter takes polynomial time by Lemma 15.If this exhaustive application leads to a no-answer, then by Lemma 15 we may discard the option.Suppose we obtain an intermediate 4-tuple (S, T, X, Y ).By again applying Lemma 15, we find that G has a perfect red-blue ({u}, {v i }, {u}, {v i })-colouring if and only if G has a perfect red-blue (S, T, X, Y )-colouring.By R2-(i) and the fact that u ∈ S ⊆ S we find that {v 1 , . . ., v s } \ {v i } belongs to X.
Suppose that G has a perfect red-blue (S, T, X, Y )-colouring c such that G[V (G)\(X ∪Y )] has a connected component D that is not monochromatic.Then D must contain an edge uv, where u is coloured red and v is coloured blue.Note that v cannot be adjacent to v i , as otherwise v would have been in Y by R3 (since v i ∈ T ⊆ T ).As H is dominating, this means that v must be adjacent to a vertex w ∈ V (H) \ {v i } = {u, v 1 , . . ., v s } \ {v i }.As options is a constant, namely 2 |V (H)| .Now, for every red (blue) vertex of G with no blue (red) neighbour, we consider all O(n) options of colouring exactly one of its neighbours blue (red).Hence, afterwards each vertex of V (G ) ∪ N (V (G )) is either coloured red or blue.This leads to O(m2 |V (H)| n |V (H)| ) options (branches), which we handle one by one.
Consider an option as described above.Let S consist of u and all red vertices of V (G ) ∪ N (V (G )), and let T consist of v and all blue vertices of V (G ) ∪ N (V (G )).In this way we obtain a starting pair (S , T ) with core (S , T ).We apply rules R1-R7 exhaustively.If we find a no-answer, then we can discard the option by Lemma 15.Else we found in polynomial time an intermediate 4-tuple (S, T, X, Y ), such that G has a perfect red-blue (S , T , S , T )-colouring if and only if G has a perfect red-blue (S, T, X, Y )-colouring.
Consider a connected component F of G − (X ∪ Y ), for which the following holds: 1. F contains two distinct vertices u and v, each with no neighbours in X ∪ Y and moreover, v is dominating F ; and 2. every vertex in F − {u, v} has a neighbour in both X and Y .
As G is connected, the fact that u and v have no neighbours in X ∪ Y implies that F − {u, v} is non-empty.Every vertex in F − {u, v} has a neighbour in both X and Y and thus their matching neighbour is not in F .Hence, all vertices of F − {u} are coloured alike in every perfect red-blue (S, T, X, Y )-colouring of G. Hence, we can safely remove u and v.Then, after finding a monochromatic perfect red-blue (S, T, X, Y )-colouring of G − {u, v} we give v the same colour as the vertices of F − {u, v} and u the opposite colour.
We also perform this operation for all other connected components of G − (X ∪ Y ) that have the above two properties.This yields, in polynomial time, a new but equivalent problem instance, which we denote by G again.
Claim.Every perfect red-blue (S, T, X, Y )-colouring of G is monochromatic.
Proof.In order to see this claim, let F be a connected component of G−(X∪Y ).If |V (F )| = 1, then F will be monochromatic.Assume |V (F )| ≥ 2. As V (G ) ∪ N (V (G )) ⊆ S ∪ T and S ⊆ X and T ⊆ Y , we find that V (F ) belongs to G * .Since G * is P 4 -free, F is P 4 -free.It is well-known (see e.g.Lemma 2 in [19]) that every connected P 4 -free graph has a spanning complete bipartite subgraph K. Say, K is isomorphic to K k, for some integers 1 ≤ k ≤ .
If k ≥ 2 and ≥ 3, then F must be monochromatic.Now suppose that k = = 2, so F contains a C 4 as spanning subgraph.If K contains a vertex u that has a neighbour in both X and Y , then the matching neighbour of u is in X ∪ Y , so not in F .Hence, the neighbours of u in F must receive the same colour as u, which means that the fourth vertex of F must also receive the same colour as u (if that vertex is not adjacent to u, then it will be adjacent to the two neighbours of u in F , as F contains a spanning C 4 ).So F is monochromatic.
We conclude that every vertex of F is adjacent to at most one vertex of X ∪ Y .As G is connected, F has at least one vertex v with a neighbour w in X ∪ Y , say w ∈ X.Then the other three vertices of F must also have a neighbour in X (and thus no neighbour in Y ), else we would have applied R6.The only way we can extend the red-blue (S, T, X, Y )-colouring to a perfect red-blue colouring of G is by colouring each vertex of F blue, so F is monochromatic.
It remains to consider the case where k = 1 and ≥ 1.In this case F contains a vertex v such that {v} dominates F .Then, every vertex in F − v has either no neighbours in X ∪ Y or a neighbour in both X and Y ; else we would have applied R7.Let U be the set of vertices in F − v with no neighbour in X ∪ Y .As {v} dominates F , every connected component of F − v is monochromatic.So, v is the matching neighbour of every vertex of U .If |U | ≥ 2, then G has no perfect red-blue (S, T, X, Y )-colouring so the claim is true.If |U | = 0, then the vertices in F − v all have a neighbour both in X and Y .So, they do not have their matching neighbour in F and thus will receive the same colour as v. Hence, F is monochromatic.Assume U = {u}.
If v is adjacent to a vertex in X and to a vertex in Y , then its matching neighbour is in X ∪ Y , so not in F .As {v} dominates F , this means that F must be monochromatic.Hence, v is adjacent to at most one vertex of X ∪ Y .
Note that by construction, v is adjacent to exactly one vertex w of X ∪ Y .Then u has at least one neighbour in F − v; else we would have applied R5.Let u be an arbitrary neighbour of u in F − v.As both u and u are adjacent to v, it follows that u, u , v are coloured alike.Hence, u has no matching neighbour.This means that G has no perfect red-blue (S, T, X, Y )-colouring and the claim is true.
We now apply rules R1-R11 exhaustively.This takes polynomial time by Lemma 18.If this leads to a no-answer, then by Lemma 18 we may discard the option.Suppose we obtain a final 4-tuple (S * , T * , X * , Y * ).By Lemma 18, G has a monochromatic perfect red-blue (S, T, X, Y )-colouring if and only if G has a monochromatic perfect red-blue (S * , T * , X * , Y * )colouring.We apply Lemma 20 to find in polynomial time if the latter holds.If so, we are done by the Claim, else we discard the option.
The correctness of our algorithm follows from its description.As the total number of branches is O(m2 |V (H)| n |V (H)| ) and we can process each branch in polynomial time, the total running time of our algorithm is polynomial.Hence, we have proven the theorem.

Conclusions
We found new results on H-free graphs for three closely related edge cut problems: the classical Matching Cut problem and its variants, Disconnected Perfect Matching and Perfect Matching Cut.We summarized all known and new results for H-free graphs in Theorems 1-3.Due to our systematic study we are now able to identify some interesting open questions.First, is there a graph H for which the problems behave differently on H-free graphs?The graph H = 4P 5 is a potential candidate if one can generalize Theorem 23.Also, does there exist, just as for the other two problems, a constant r such that Perfect Matching Cut is NP-complete for P r -free graphs?Moreover, are Matching Cut and Disconnected Perfect Matching, just like Perfect Matching Cut, NP-complete for graphs of girth g, also if g ≥ 6 (cf.[21] and [4], respectively)?In particular, if this holds for Disconnected Perfect Matching, then Disconnected Perfect Matching would be NP-complete for H-free graphs whenever H has a cycle, just like the other two problems.
First, as can be noticed from Theorems 1-3, our knowledge on the complexity of the three problems is different.In particular, does there exist a constant r such that Perfect Matching Cut is NP-complete for P r -free graphs?For the other two problems such a constant exists.For Matching Cut we improved the previous value r = 27 [13] to r = 19 and for Disconnected Perfect Matching we showed that we can take r = 23, addressing a question in [4].We expect that these values of r might not be tight, but it does not seem straightforward to improve our current hardness constructions.
Finally, let Maximum Matching Cut be the problem of finding a matching cut with a maximum number of edges.Recall that Perfect Matching Cut is the "extreme" variant of this problem, namely when we search for a matching cut with a maximum number of edges.Does there exist a graph H such that Maximum Matching Cut and Perfect Matching

u 1 cj u 2 cjFigure 6
Figure 6 A path intersecting a clause gadget and containing two auxiliary vertices.

Figure 10 A
Figure 10 A path intersecting a clause gadget and containing four auxiliary vertices.

Figure 11 A
Figure 11 A connected component of type (ii) obtained from the removal of S1, S2 and S3.A longest path in this connected component is shown in red.

Lemma 19 .Figure 12 A
Figure 12 A red-blue (S, T, X, Y )-colouring of a graph with a final 4-tuple (S, T, X, Y ).
be the set of edges consisting of all edges with one end-vertex in (X ∪ Y ) \ (S ∪ T ) and the other end-vertex in Z. By, we find that |E * | = 2|Z|.By and (iv), we find that|E * | ≥ 2|(X ∪ Y ) \ (S ∪ T )|.Hence, |Z| ≥ |(X ∪ Y ) \ (S ∪ T )|, and |Z| = |(X ∪ Y ) \ (S ∪ T )| if and only if each vertex in (X ∪ Y ) \ (S ∪ T ) has exactly two neighbours in Z.Every vertex u ∈ Z still needs their matching neighbour v.In order for G to have a monochromatic perfect red-blue (S, T, X, Y )-colouring, v must be outside S ∪ T , so v belongs to X ∪ Y .By, we find that v ∈ (X ∪ Y ) \ (S ∪ T ).As matching neighbours are "private",|Z| ≤ |(X ∪ Y ) \ (S ∪ T )|.We conclude that |(X ∪ Y ) \ (S ∪ T )| = |Z|.Our algorithm checks this in polynomial time and returns a no-answer if |(X ∪ Y ) \ (S ∪ T )| = |Z|.From now on, assume |(X ∪ Y ) \ (S ∪ T )| = |Z|.Hence, each vertex in (X ∪ Y ) \ (S ∪ T ) has exactly two neighbours in Z.Just like[21], we now construct an instance φ of the 2-Satisfiability problem (2-SAT).Our 2-SAT formula differs from the one in[21] due to the perfectness requirement.For each connected component C of G[Z], we do as follows.We define two variables x C and y C , and we add the clause (x C ∨ y C ) ∧ (¬x C ∨ ¬y C ) to φ.For each u ∈ (X ∪ Y ) \ (S ∪ T ), we do as follows.From the above we known that u has exactly two neighbours v and w in Z.Let C be the connected component of G[Z] that contains v and D be the connected component of G[Z] that contains w.We add the clause (x C ∨ x D ) ∧ (y C ∨ y D ) to φ.This finishes the construction of φ.
(x C ∨ y C ) ∧ (¬x C ∨ ¬y C ) is satisfied.Now consider a clause (x C ∨x D )∧(y C ∨y D ) corresponding to a vertex u ∈ (X ∪Y )\(S ∪T ) that has a neighbour in each of the connected components C and D of G[Z].Then, by Lemma 19-(iii) and (iv), C and D are different connected components of G[Z].First assume that u ∈ X \ S. By Lemma 19-(iii), we find that u has no neighbour in Y and thus its blue neighbour must either be in C or in D. If it is in C, then the neighbour of u in D is coloured blue, and vice versa.As c is monochromatic, this means that either all vertices of C are coloured red and all vertices of D are coloured blue, or the other way around.Hence, the clause (x C ∨ x D ) ∧ (y C ∨ y D ) is satisfied.If u ∈ Y \ T , we can use exactly the same arguments.We conclude that τ is a satisfying truth assignment.Now suppose that φ has a satisfying truth assignment τ .For every connected component C of G[Z], we colour the vertices of C red if x C is true and we colour the vertices of C blue if y C is true.As τ satisfies (x C ∨ y C ) ∧ (¬x C ∨ ¬y C ), exactly one of x C or y C is true.Hence, the colouring of the vertices of Z is well defined.
Let C be the connected component of G[Z] that contains u, and let D be the connected component of G[Z] that contains w.Hence, τ contains the clause (x C ∨ x D ) ∧ (y C ∨ y D ).By Lemma 19-(iii), we find that C and D are two distinct connected components of G[Z].As τ satisfies (x C ∨ x D ) ∧ (y C ∨ y D ), the vertices of one of C, D are coloured red, while the vertices of the other one are coloured blue.By Lemma 19-(iii), we find that u has no (blue) neighbour in Y .Hence, u has exactly one blue neighbour.If u ∈ Y \ T , we can apply the same arguments.We conclude that also the vertices in (X ∪ Y ) \ (S ∪ T ) have exactly one neighbour of the opposite colour.
1,4 , P 19 , 4P 5 or H * .For a graph H, Disconnected Perfect Matching on H-free graphs is polynomial-time solvable if H ⊆ i K 1,3 or P 5 , and NP-complete if H ⊇ i C r for some odd r ≥ 3, C 4 , K 1,4 , P 23 or 4P 7 .For a graph H, Perfect Matching Cut on H-free graphs is polynomial-time solvable if H ⊆ i sP 4 + S 1,2,2 or sP 4 + P 6 , for some s ≥ 0, and NP r = 27; see Remark 10 below.

Claim 11.1. For
1, 8.2, 8.3 in the proof of Theorem 8. any variable x i ∈ X, i = 1, . . ., |X|, both V xi and U xi are monochromatic.Furthermore, S 1 , S 2 and S 3 are also monochromatic.It holds that S 1 and S 2 have different colours.For every variable x i ∈ X, i ∈ {1, . . ., |X|}, the cliques U xi and V xi have different colours.For every clause c j ∈ C, j ∈ {1, . . ., |C|}, exactly two neighbours of v 1 3 xi 3 be the three neighbours of v 1 cj outside of S 3 and let u 1 xi 1 , u 2 xi 2 and u 3 xi 3 be the neighbours of the auxiliary vertices a k Suppose for a contradiction that the vertices v 1 xi 1 , v 2 xi 2 , v 3 xi 3 are all coloured blue.Then, it follows from Claim 11.1 that V xi 1 , V xi 2 , V xi 3 must be coloured blue.Notice that since v 1 cj is coloured blue, Claim 11.1 also implies that all vertices in S 3 , in particular u 1 cj and u 2 cj are coloured blue.Let A 1 (resp.A 2 ) be the set of auxiliary vertices which are a neighbour of u 1 cj (resp.u 2 cj ).Then, at least two vertices in A 1 and two vertices in A 2 are coloured blue.Since u 1 xi 1 , u 2 xi 2 and u 3 xi 3 have each one neighbour in A 1 and one neighbour in A 2 , it follows that one of them has two blue neighbours in A 1 ∪ A 2 , and is thus coloured blue.We may assume, without loss of generality, that this vertex is u 1 xi 1 .Using Claim 11.1 again, we get that U xi 1 is coloured blue, a contradiction to Claim 11.3.Since v 1 cj and v 2 cj are both in S 3 , using Claim 11.1 we get that they are both blue.For each neighbour of v 1 cj there is a neighbour of v 2 cj in the same clique and vice versa.Hence, they have the same number of blue neighbours.
cj , k = 1, . . ., 6.By definition of a perfect-extendable red-blue-colouring, v 1 cj has at least two neighbours outside of S 3 that are coloured blue.
we know that exactly one of U xi 1 , U xi 2 , U xi 3 is blue and the other ones are red.Assume, without loss of generality, that U xi 1 is blue and consider a 1 cj , a 4 cj , the neighbours of u 1 xi 1 ∈ U xi 1 and a 7 cj , a 10 cj , the neighbours of u 4 xi 1 ∈ U xi 1 .To obtain a perfect-extendable red-blue colouring of G I , we have to colour one of the vertices a 2 cj , a 5 cj blue and the other one red, and similarly, one of the vertices a 3 cj , a 6 cj blue and the other one red.Since u 1 cj , u 2 cj are both coloured blue and each of them can have at most one red neighbour, we colour a 2 cj , a 6 cj blue and a 3 cj , a 5 cj red.With the same arguments we colour a 8 cj , a 12 cj blue and a 9 cj , a 11 cj red.Finally, the only vertices that remain uncoloured are the vertices in S 1 and S 2 .Here, the only restriction is that S 1 and S 2 are coloured differently, hence we colour for instance S 1 blue and S 2 red.This clearly gives us a valid red-blue-colouring of G I .It still remains to verify that this valid red-blue-colouring is perfect-extendable.First, consider the cliques S 1 and S 2 .We know that each vertex s i j , for j = 1, 2, i ∈ {1, . . ., |X|} has two neighbours v s xi and u s xi outside of S 1 ∪ S 2 .Since the red-blue-colouring is valid, it follows that exactly one of s i 1 , s i 2 and exactly one of v s xi and u s xi is blue.So every vertex in S 1 and S 2 has a neighbour of the opposite colour and hence, can be matched with it.The same holds for the vertices v s xi , u s xi , for all x i ∈ X. Next, consider a clause c j ∈ C, such that c j = x i1 ∨ x i2 ∨ x i3 .It follows from the construction of our valid red-blue-colouring that we may assume, without loss of generality, that V xi 1 , U xi 2 , U xi 3 are coloured red and V xi 2 , V xi 3 , U xi 1 are coloured blue.Since every clause vertex is coloured blue and has exactly one red neighbour, it follows that all clause and v is adjacent to a vertex w in Y , then add v to S and w to T .(ii) If v ∈ Y \ T and v is adjacent to a vertex w in X, then add v to T and w to S. R4.Return no if (i) a vertex x ∈ X has no neighbours outside X or is adjacent to two vertices of Y , or (ii) a vertex y ∈ Y has no neighbours outside Y , or is adjacent to two vertices of X. R5.Let v ∈ Z.Let w ∈ Z be a vertex with N G (w) = {v}.