 # A complexity dichotomy for Matching Cut in (bipartite) graphs of fixed diameter

In a graph, a matching cut is an edge cut that is a matching. Matching Cut is the problem of deciding whether or not a given graph has a matching cut, which is known to be NP-complete even when restricted to bipartite graphs. It has been proved that Matching Cut is polynomially solvable for graphs of diameter two. In this paper, we show that, for any fixed integer d> 3, Matching Cut is NP-complete in the class of graphs of diameter d. This resolves an open problem posed by Borowiecki and Jesse-Józefczyk in [Matching cutsets in graphs of diameter 2, Theoretical Computer Science 407 (2008) 574-582]. We then show that, for any fixed integer d> 4, Matching Cut is NP-complete even when restricted to the class of bipartite graphs of diameter d. Complementing the hardness results, we show that Matching Cut is polynomial-time solvable in the class of bipartite graphs of diameter at most three, and point out a new and simple polynomial-time algorithm solving Matching Cut in graphs of diameter 2.

## Authors

##### This week in AI

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

## 1 Introduction

In a graph , a cut is a partition of the vertex set into disjoint, non-empty sets and , written . The set of all edges in having an endvertex in and the other endvertex in , also written , is called the edge cut of the cut . A matching cut is an edge cut that is a (possibly empty) matching. Note that, by our definition, a matching whose removal disconnects the graph need not be a matching cut (but such a matching always contains some matching cut). Note also that a graph has an empty matching cut if and only if it is disconnected.

Another way to define matching cuts is as follows (Graham ; Chvatal84 ). A partition of the vertex set of the graph into disjoint, non-empty sets and , is a matching cut if and only if each vertex in has at most one neighbor in and each vertex in has at most one neighbor in .

Graham Graham studied matching cuts in graphs in connection to a number theory problem called cube-numbering. In FarleyP82 , Farley and Proskurowski studied matching cuts in the context of network applications. Patrignani and Pizzonia PatrignaniP01 pointed out an application of matching cuts in graph drawing. Matching cuts have been used by Araújo et al. ACGH in studying good edge-labellings in the context of WDM (Wavelength Division Multiplexing) networks.

Not every graph has a matching cut; the Matching Cut problem is the problem of deciding whether or not a given graph has a matching cut:

Matching Cut Instance: A graph . Question: Does have a matching cut?

This paper considers the computational complexity of the Matching Cut problem in graphs of fixed diameter.

### 1.1 Previous results

Graphs admitting a matching cut were first discussed by Graham in Graham under the name decomposable graphs. The first complexity and algorithmic results for Matching Cut have been obtained by Chvátal, who proved in Chvatal84 that Matching Cut is -complete, even when restricted to graphs of maximum degree four and polynomially solvable for graphs of maximum degree at most three. These results triggered a lot of research on the computational complexity of Matching Cut in graphs with additional structural assumptions; see Bonsma09 ; BorowieckiJ08 ; KratschL16 ; LeR03 ; Moshi89 ; PatrignaniP01 . In particular, the -hardness of Matching Cut has been further strengthened for planar graphs of maximum degree four (Bonsma09 ) and bipartite graphs of maximum degree four (LeR03 ). Moreover, it follows from Bonsma’s result Bonsma09 and a simple reduction observed by Moshi Moshi89 that Matching Cut remains NP-complete on bipartite planar graphs of maximum degree eight.

On the positive side, among others, an important polynomially solvable case has been established by Borowiecki and Jesse-Józefczyk, who proved in BorowieckiJ08 in 2008 that Matching Cut is polynomial-time solvable for graphs of diameter . They also posed the problem of determining the largest integer such that Matching Cut is solvable in polynomial time for graphs of diameter . This open problem was the main motivation of the present paper.

### 1.2 Our contributions

We prove that Matching Cut is -complete, even when restricted to graphs of diameter , for any fixed integer . Thus, unless , Matching Cut cannot be solved in polynomial time for graphs of diameter , for any fixed . This resolves the open problem posed by Borowiecki and Jesse-Józefczyk mentioned above. Actually, we show a little more: Matching Cut is -complete in graphs of diameter and remains -complete in bipartite graphs of fixed diameter . An alternative proof (reduction from 1-IN-3 3SAT) for the case of graphs with diameter and the case of bipartite graphs of diameter is given in the conference paper LeL16 . Complementing our hardness results, we show that Matching Cut can be solved in polynomial time in bipartite graphs of diameter at most . We also point out a new and simple approach solving Matching Cut in diameter-2 graphs in polynomial time. In summary, our main results are the following complexity dichotomy theorems:

• Matching Cut is -complete for graphs of fixed diameter and (we provide an alternative proof that the problem is) polynomially solvable for graphs of diameter .

• Matching Cut is -complete for bipartite graphs of fixed diameter and polynomially solvable for bipartite graphs of diameter .

### 1.3 Notation and terminology

Let be a graph with vertex set and edge set . An independent set (a clique) in is a set of pairwise non-adjacent (adjacent) vertices. A biclique is a complete bipartite graph; we sometimes write for a biclique with color classes and . The neighborhood of a vertex in , denoted by , is the set of all vertices in adjacent to ; if the context is clear, we simply write . Set , the degree of the vertex . For a subset , is the subgraph of induced by , and stands for . The complete graph and the path on vertices is denoted by and , respectively; is also called a triangle. The complete bipartite graph with one color class of size and the other of size is denoted by . Observe that, for any matching cut of , any with , and any with , in is contained in or else in .

Given a graph and a partition , it can be decided in linear time if is a matching cut of . This is because is a matching cut of if and only if the bipartite subgraph of with the color classes and and edge set is -free. That is, is a matching cut of if and only if the non-trivial connected components of the bipartite graph are edges. A path in , if any, is called a bad .

A bridge in a graph is an edge whose deletion increases the number of the connected components. Since disconnected graphs and graphs having a bridge have a matching cut, we may assume that all graphs considered are connected and -edge connected. The distance between two vertices in a (connected) graph , denoted , is the length of a shortest path connecting and . The diameter of , denoted , is the maximum distance between all pairs of vertices in .

The paper is organized as follows. In Section 2 we show that Matching Cut is -complete when restricted to graphs of diameter , for any fixed integer . In Section 3 we show that Matching Cut remains -complete even when restricted to bipartite graphs of diameter , for any fixed integer . In section 4 we point out a new and simple polynomial time algorithm solving Matching Cut in diameter- graphs, and show that Matching Cut can be solved in polynomial time for bipartite graphs of diameter at most . We conclude the paper with Section 5.

## 2 Matching Cut in graphs of fixed diameter d≥3

In this section, we first reduce Matching Cut to Matching Cut restricted to graphs of diameter .

Given an instance of Matching Cut, construct a new graph as follows. First, let , and for each , let be a complete graph on vertex set . Then, is obtained from and , by adding edges between and all vertices in (thus, for each , induces a clique in ) and edges between the vertex and the vertex for any pair . Formally,

 V′ =V∪⋃1≤i≤nV(Qi), \vskip3.0ptplus1.0ptminus1.0ptE′ =E∪⋃1≤i≤n{viq∣q∈V(Qi)}∪⋃1≤i≤nE(Qi)∪{qjiqij∣1≤i,j≤n,i≠j}.

Observe that from the construction of we have

• for every vertex of , and

• each vertex in has at most one neighbor outside . Namely, , and for , .

###### Lemma 1

has diameter .

Proof.  Let be two non-adjacent vertices of . Then and for some , . Then is a path in of length at most three connecting and . (See also Figure 1.) Thus, for all . Note that, for , , hence has diameter . ∎

###### Lemma 2

has a matching cut if and only if has a matching cut.

Proof.  Let be a matching cut in . Set

 X′:=X∪⋃vi∈XQi and Y′:=Y∪⋃vi∈YQi.

Then, by (p1) and (p2), clearly is a matching cut in .

Conversely, if is a matching cut in , then for any , the clique is contained in or else in . Hence and are both non-empty, and therefore is a matching cut in . ∎

By Lemmas 2 and 1, we conclude

###### Lemma 3

Matching Cut is -complete in graphs of diameter .

Now, let be a fixed integer, and let be a bipartite chain of complete bipartite graphs as depicted in Figure 2.

Let be obtained from in Lemma 1 and by joining the two vertices and to all vertices in of .

Clearly, for all . Hence for all vertices of , and . Thus, has diameter . Observe that each vertex of is contained, in , in a , hence in any matching cut of , is contained in or else in . Thus, has a matching cut if and only if has a matching cut. Hence, Lemma 3 implies

###### Theorem 1

For any fixed , Matching Cut is -complete in graphs of diameter .

## 3 Matching Cut in bipartite graphs of fixed diameter d≥4

In this section, we first modify the restriction of Matching Cut on diameter- graphs in the previous section to obtain a similar reduction to Matching Cut on bipartite graphs of diameter .

Given a bipartite graph with two color classes and , construct a new bipartite graph as follows. First, let , and, for each , let be a complete bipartite graph with color classes and . For write

 Eij={{qjirij,rjiqij},if vi,vj∈V1 or vi,vj∈V2,\vskip3.0ptplus1.0ptminus1.0pt{qjiqij,rjirij},otherwise.

Then, is obtained from and , by adding edges between and all vertices in (thus, for each , is a biclique in ) and edge set between and for any pair . Formally,

 V′ =V∪⋃1≤i≤nQi∪⋃1≤i≤nRi, \vskip3.0ptplus1.0ptminus1.0ptE′ =E∪⋃1≤i≤n{viq1i,…,viqni}∪⋃1≤i≤nEi∪⋃1≤i,j≤n,i≠jEij.

See also Figures 3 and 4. Clearly, can be constructed from in steps.

Observe that from the construction of we have

• for every vertex of , and

• each vertex in has at most one neighbor outside . Namely, and have no neighbor outside , and for , , where if and belong to the same color class of , and otherwise. , where if and belong to the same color class of , and otherwise.

###### Lemma 4

is bipartite and has diameter .

Proof.  By construction,

 V′1:=V1∪⋃vi∈V1Ri∪⋃vj∈V2Qj and V′2:=V2∪⋃vi∈V1Qi∪⋃vj∈V2Rj

are disjoint independent sets in with , hence is bipartite.

We now show that has diameter . Let be two non-adjacent vertices of . Recall that, for every , is a biclique in . Hence we may assume that and for some . (If for some , then they will have distance .)

Suppose that and belong to the same color class of . Then, if then , where is a path of length at most two in connecting and , is a path of length at most connecting and . If then , where is a path of length at most two in connecting and , is a path of length at most connecting and . Similarly, it can be seen that in case and belong to different color classes of that there is a path of length at most connecting and , too.

Thus, for all vertices and in . Note that for such that in the same color class of , for any , hence has diameter . ∎

###### Lemma 5

has a matching cut if and only if has a matching cut.

Proof.  Let be a matching cut in . Set

 X′:=X∪⋃vi∈XV(Si) and Y′:=Y∪⋃vi∈YV(Si).

Then, by (p3) and (p4), clearly is a matching cut in .

Conversely, if is a matching cut in , then for any , the biclique is contained in or else in . Hence and are both non-empty, and therefore is a matching cut in . ∎

By Lemmas 5 and 4, we conclude

###### Lemma 6

Matching Cut is -complete in bipartite graphs of diameter .

Now, for any fixed , let be obtained from in Lemma 4 and (see Section 2, Figure 2) by joining the two vertices and to all vertices in of .

Clearly, is bipartite. Moreover, for all . Hence for all vertices of , and for all vertices not in the color class of . Thus, has diameter . Again, observe that each vertex of is contained, in , in a , hence in any matching cut of , is contained in or else in . Thus, has a matching cut if and only if has a matching cut. Hence, Lemma 6 implies

###### Theorem 2

For any fixed , Matching Cut is -complete in bipartite graphs of diameter .

## 4 Matching Cut in bipartite graphs of diameter at most 3

In this section we prove that Matching Cut can be solved in polynomial time when restricted to bipartite graphs of diameter at most . Our strategy is to decide in polynomial time, given two disjoint vertex subsets and of the input graph , if admits a matching cut such that is contained in one part and is in the other part of the matching cut. To do this, we first prove a lemma (Lemma 7) that will be useful in many cases. This useful lemma roughly says that, if after certain forcing rules are no longer applicable the connected components of the remaining part of the graph induced by the remaining unforced vertices are ‘monochromatic’, we will be able to reduce the problem to 2-SAT. As a by-product, we will derive from this lemma a new and simple polynomial-time algorithm solving Matching Cut in graphs of diameter 2.

### 4.1 A useful lemma

Given a connected graph and two disjoint, non-empty vertex sets such that each vertex in is adjacent to exactly one vertex of and each vertex in is adjacent to exactly one vertex of . We say a matching cut of is an --matching cut if is contained in one side and is contained in the other side of the matching cut. Observe that if has a matching cut, then has an --matching with, for example, and for some edge of . Thus, in general, unless NP P, we cannot decide in polynomial time if admits an --matching cut for a given pair . However, there are some rules that force certain vertices some of which together with must belong to one side and the other together with must belong to the other side of such an --matching cut (if any). We are going to describe such forcing rules.

Now assume that and are two disjoint, non-empty subsets of such that each vertex in is adjacent to exactly one vertex of and each vertex in is adjacent to exactly one vertex of . Initially, set , and write . The sets will be extended, if possible, by adding vertices from according to the forcing rules such that the following properties hold before and after each update:

• , and ;

• each vertex in is adjacent to exactly one vertex of and each vertex in is adjacent to exactly one vertex of ;

• no vertex in is adjacent to a vertex in and no vertex in is adjacent to a vertex in ;

• any --matching cut of must contain in one side and in the other side.

These properties imply that after each update, is an --matching cut of . The first three rules will detect certain vertices that ensure that cannot have an --matching cut.

(R1)

Let be adjacent to a vertex in . If is

• adjacent to a vertex in , or

• adjacent to (at least) two vertices in ,

then has no --matching cut.

(R2)

Let be adjacent to a vertex in . If is

• adjacent to a vertex in , or

• adjacent to (at least) two vertices in ,

then has no --matching cut.

(R3)

If is adjacent to (at least) two vertices in and to (at least) two vertices in , then has no --matching cut.

The correctness of (R1), (R2) and (R3) is quite obvious. We assume that, before each application of the forcing rules (R4) and (R5) below, none of (R1), (R2) and (R3) is applicable.

(R4)

Let be adjacent to a vertex in or to (at least) two vertices in . Then , . If, moreover, has a unique neighbor then , .

(R5)

Let be adjacent to a vertex in or to (at least) two vertices in . Then , . If, moreover, has a unique neighbor then , .

To see that (R4) is correct, let, by induction hypothesis, , , and fulfill the properties (f1) – (f4). We have to argue that after a next application of (R4), , , and still fulfill (f1) – (f4). Consider an arbitrary --matching cut of , and let, by (f4), and , say. In particular, by (f1), and . Let be adjacent to a vertex or to (at least) two vertices in . (Then, since none of (R1), (R2), (R3) is applicable, and .) If is adjacent to a vertex , then, by (f2), has a neighbor in . Hence must belong to (as is a matching cut of ), and (R4) correctly extends to . If is adjacent to two vertices in , then clearly must belong to (as is a matching cut of ), and (R4) again correctly extends to . Moreover, in case has a unique neighbor , (R4) correctly extends to and to . Hence after updating , , and , is still an --matching cut of with . Thus, properties (f1)– (f4) hold after an application of (R4). The correctness of (R5) can be seen similarly.

If none of (R1), (R2) and (R3) is applicable, then each vertex has no neighbor in or has no neighbor in , and has at most one neighbor in or has at most one neighbor in . If (R4) is not applicable, then each vertex has no neighbor in and at most one neighbor in . If (R5) is not applicable, then each vertex has no neighbor in and at most one neighbor in . Thus, together with (f1) – (f4), the following fact holds:

###### Fact 0

Suppose none of (R1) – (R5) is applicable. Then

• is an --matching cut of , and any --matching cut of must contain in one side and in the other side;

• for any vertex , and .

We now bound the running time for the application of the rules. Observe first that the applicability of the rules can be tested in time . Each of the rules (R1), (R2) and (R3) can be applied in constant time and applies at most once. Each of the rules (R4) and (R5) can be applied in time and applies at most many times because it removes one vertex from . So, the total running time for applying the rules (R1) – (R5) until they are no longer applicable is bounded by .

We say that a subset is monochromatic if, in any --matching cut of , all vertices of belong to the same side of this matching cut.

###### Lemma 7

Suppose none of the forcing rules (R1) – (R5) is applicable. Assuming each connected component of is monochromatic, it can be decided in time if admits an --matching cut.

Proof.  Let be a connected component of , and let be an --matching cut of with and . Note, by Fact 1, that and . Since is monochromatic, we have

• whenever some vertex in has at least two neighbors in .

• Similarly, whenever some vertex in has at least two neighbors in .

• If a vertex in has neighbors in two connected components of , then at least one of these components is contained in .

• Similarly, if a vertex in has neighbors in two connected components of , then at least one of these components is contained in .

Thus, we can decide if admits a matching cut such that , by solving the following instance of the 2-SAT problem.

• For each connected component of , create two Boolean variables and . The intention is that is set to if must go to and is set to if must go to . Then and are two clauses of the formula .

• For each connected component of with for some , is a clause of the formula . This clause ensures that in this case, must go to .

• For each connected component of with for some , is a clause of the formula . This clause ensures that in this case, must go to .

• For each two connected components of having a common neighbor in , is a clause of the formula . This clause ensures that in this case, at least one of and must go to .

• For each two connected components of having a common neighbor in , is a clause of the formula . This clause ensures that in this case, at least one of and must go to .

###### Claim 0

admits a matching cut such that if and only if the -CNF formula is satisfiable.

Proof of the Claim:  First, suppose is a matching cut of with . For each connected component of , set and if , and and if . Since each connected component is contained in or else in , the assignment is well-defined. Moreover, is a satisfying truth assignment for :

• For each connected component , the two corresponding clauses and are obviously satisfied by .

• For each connected component such that for some , because is a matching cut and is monochromatic. Hence the corresponding clause is satisfied by .

• Similarly, for each connected component such that for some , . Hence the corresponding clause is satisfied by .

• For each two connected components having a common neighbor in , or because is a matching cut and and are monochromatic. Hence the corresponding clause is satisfied by .

• Similarly, for each two connected components having a common neighbor in , or . Hence the corresponding clause is satisfied by .

Thus, is satisfied by .

Second, suppose is satisfied, and let be a satisfying truth assignment for . Then let consist of and all connected components of with and let consist of and all connected components of with . Since for each connected component of , the two corresponding clauses and are satisfied by , is a partition of . Moreover is a matching cut of : Assume, for a contradiction, some has two neighbors in .

If , then, by Fact 1, and . Let and be the connected components containing and , respectively. If , then is a clause of and therefore , hence , contradicting . If , then is a clause of , hence or , contradicting again.

If , then let be the connected component containing . Then, by Fact 1 again, at most one of is in , say . Thus, , hence and . This contradicts the definition of .

Thus, each vertex in has at most one neighbor in , and, similarly, each vertex in has at most one neighbor in . That is, is a matching cut of with .

The proof of the Claim is complete.

Note that has variables and