 # Eliminating Odd Cycles by Removing a Matching

We study the problem of determining whether a given graph G=(V, E) admits a matching M whose removal destroys all odd cycles of G (or equivalently whether G-M is bipartite). This problem is also equivalent to determine whether G admits a (1,1)-coloring, which is a 2-coloring of V(G) in which each color class induces a graph of maximum degree at most 1. We show that such a decision problem is NP-complete even for planar graphs of maximum degree 4, but can be solved in linear-time in graphs of maximum degree 3. We also present polynomial time algorithms for (claw, paw)-free graphs, graphs containing only triangles as odd cycles, graphs with bounded dominating sets, P_5-free graphs, and chordal graphs. In addition, we show that the problem is fixed-parameter tractable when parameterized by clique-width, which implies polynomial time solvability for many interesting graph classes of such as distance-hereditary graphs and outerplanar graphs. Finally, a 2^vc(G)· n algorithm, and a kernel having at most 2· nd(G) vertices are presented, where vc(G) and nd(G) are the vertex cover number and the neighborhood diversity of the input graph, respectively.

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

Given a graph  and a graph property , the edge-deletion problem consists in determining the minimum number of edges required to be removed in order to obtain a graph satisfying  . Given an integer , the  edge-deletion decision problem asks for a set  with , such that the obtained graph by the removal of  satisfies . Both versions have received widely attention on the study of their complexity, where we can cite [38, 37, 12, 33, 2, 23, 26, 29] and references therein for applications. When the obtained graph is required to be bipartite, the corresponding edge- (vertex-) deletion problem is called edge (vertex) bipartization [14, 1, 22] or edge (vertex) frustration . Choi, Nakajima, and Rim  showed that the edge bipartization decision problem is -complete even for cubic graphs.

Furmańczyk, Kubale, and Radziszowski  considered vertex bipartization of cubic graphs by the removal of an independent set. In this paper we study the analogous edge deletion decision problem, that is, the problem of determining whether a finite, simple, and undirected graph  admits a removal of a set of edges that is a matching in  in order to obtain a bipartite graph. Formally, for a set  of edges of a graph , let  be the graph with vertex set  and edge set . For a matching , we say that  is an odd decycling matching of  if  is bipartite. Let  denote the set of all graphs admitting an odd decycling matching. We deal with the complexity of the following decision problem.

Odd Decycling Matching Input: A finite, simple, and undirected graph . Question: Does ?

A more restricted version of this problem is considered by Schaefer . He deals with the problem of determining whether a given graph  admits a -coloring of the vertices so that each vertex has exactly one neighbor with same color as itself. We can see that the removal of the set of edges whose endvertices have same color, which is a perfect matching of , generates a bipartite graph. Schaefer proved that such a problem is -complete even for planar cubic graphs.

With respect to the minimization version, the edge-deletion decision problem in order to obtain a bipartite graph is analogous to Simple Max Cut, which was proved to be -complete by Garey, Johnson and Stockmeyer . Yannakakis  proved its -completeness even for cubic graphs.

Cowen et al.  studied the -colorings, called defective, that are -coloring of the vertices such that each color class has maximum degree . They proved that it is -complete to determine whether a given graph is -colorable even for graphs with maximum degree 4 and even for planar graphs with maximum degree 5. Angelini et al.  determined that Odd Decycling Matching can be solved in linear-time for partial -trees, where it is known that -tree graphs have treewidth at most , for any .

Odd Decycling Matching can also be seen as another problem. A graph  is -colorable if  can be partitioned into , such that the induced subgraph  has maximum degree at most , for all . This is a generalization of the classical proper -coloring, when every , and the -improper -coloring, when every . It is clear to see that  if and only if  is -colorable. Lovász  proved that if a graph  satisfies  then  is -colorable, where  denotes the maximum degree of . This result shows that every subcubic graph is -colorable and thus belongs to . Borodin, Kostochka, and Yancey  studied the -colorable graphs with respect to the sparseness parameter . They proved that every graph  with  is -colorable, where this bound is sharp. Moreover, they defined the parameter , such that . They showed that  is -colorable if . Finally, they also proved that every planar graph with girth (the size of the smallest cycle of ) at least  is -colorable. This is the best result concerning -coloring of planar graphs.

In this work we summarize our results as follows. We prove that Odd Decycling Matching is -complete even for -colorable planar graphs with maximum degree , which improves the previous result by Cowen et al. . As positive results, we show polynomial time algorithms for (claw, paw)-free graphs, graphs that have only triangles as odd cycles, and graphs that have a small dominating set. We also show that graphs in  can be expressed in monadic second order logic. Hence, using Courcelle’s meta-theorems [15, 19, 16] we prove that Odd Decycling Matching is fixed-parameter tractable when parameterized by clique-width, which improves the previous result by Angelini et al. . We also show an exact  algorithm, where  is the vertex cover number of . Finally, for a generalization of Odd Decycling Matching, we show a kernel with at most  vertices when such a more general problem is parameterized by neighborhood diversity number, .

### 1.1 Preliminaries

Let  be a graph with  vertices and  edges. Given a subgraph  of , we denote by  the induced subgraph of  by . Let be the neighborhood of  in . Moreover, let  be the closed neighborhood of  in . The degree of a vertex , , is denoted by , and let  be the maximum degree of .

Let  and  be a path and a cycle of length , respectively. Furthermore, we denote by  and  the complete graphs of order  and the complete bipartite graphs with parts of order  and , respectively.

A diamond is the graph obtained by removing one edge from the . Let  be the wheel graph of order , that is, the graph containing a vertex , called central, and a cycle  of order , such that  is adjacent to all vertices of .

We say that a graph is a -pool if it is formed by  triangles edge-disjoint whose bases induce a . Formally, a -pool is obtained from a cycle  , such that the odd-indexed vertices induce a cycle , called internal cycle of the -pool, where , . The even-indexed vertex  is the -th-border of the -pool, where  and  is taken modulo . Fig. 0(c) and Fig. 0(d) represent the -pool and -pool, respectively.

The claw () and the paw (a triangle plus an edge) graphs are the unique ones with degree sequences and , respectively.

Clearly, every graph  admits a proper -coloring. Hence every graph in  is -free. More precisely, every graph in  is -free, which is depicted in Fig 0(a). Hence some proper -colorable graphs do not admit an odd decycling matching. Fig. 1 shows some others examples of forbidden subgraphs. Lemma 1 collects some properties of graphs in .

###### Lemma 1.

For a graph  and an odd decycling matching  of , the following assertions are true.

• If  has a diamond  as a subgraph, then  contains no edge  incident to only one vertex of degree three of .

• cannot contain two disjoint , for every .

• cannot contain a  as a subgraph, for all .

• cannot contain a -pool as a subgraph, for all odd .

###### Proof.

(i) Let  be a graph that contains a diamond  as a subgraph, such that and . We can see that  equals to exactly one of the following sets: , , . For each of such sets, both  and  are matched by . Hence  cannot contain any edge  incident to only  or .

(ii) Let  such that  contains two disjoint , and . It follows that  and  are diamonds that share a vertex of degree at least three. By (i) the statement holds.

(iii) Suppose for a contradiction that  contains a subgraph  isomorphic to a wheel graph , . Let , such that  is adjacent to all vertices of the cycle . If , then  contains two disjoint  in its neighborhood, and thus it follows by (ii) that . In this case, it can be easily verified that  and  are forbidden subgraphs.

(iv) Suppose, for a contradiction, that  contains a subgraph  isomorphic to a -pool, for some odd . Let  be its internal cycle and let  be the vertices of the border of , such that , for all  modulo . Clearly  must contain some edge of  and one edge of every triangle . W.l.o.g., consider . This implies that  contains no edge in . Therefore, and  must be in , which forbids two more edges from the triangles  and . Continuing this process, it follows that , which is at the same distance of  and  in , must contain two incident edges in , a contradiction. ∎

### 1.2 A linear Time Algorithm for Subcubic Graphs

Bondy and Locke  presented the following lemma, which was also obtained by Erdős  by induction on .

###### Lemma 2.

(Bondy and Locke ) Let  be a graph and let  be a largest bipartite subgraph of . Then , for every .

Lemma 2 shows that every subcubic graph  admits an odd decycling matching, since every vertex has at most one incident edge not in a largest bipartite subgraph of . This result was also obtained by Lovász  with respect to -improper -coloring of graphs with maximum degree at most .

Consider a bipartition of  into sets  and . For every vertex , we say that  is of type  if  and , where  is the part (either  or ) which contains . We present a linear algorithm to find an odd decycling matching of subcubic graphs, Algorithm 1.

###### Theorem 3.

Algorithm 1 returns in linear-time an odd decycling matching for subcubic graphs.

###### Proof.

Let  be a maximal independent set of . Let . In this case, every vertex of  is of type  and there is no vertex in  of type , . Therefore, if there exists a vertex  of type  with , then it must be in  and be of type . In order to prove the correctness of Algorithm 1, it is sufficient to show that the operations on lines 7–8 and 10–11 do not generate vertices of type  with .

Let . If  is of type , then  is moved from  to  by lines 7–8. In this case, it follows that both  and  are vertices of type  after the line 8. If  is not of type , then the lines 10–11 modify the types of  and .

• If  is of type , then  and  are modified to type  and , respectively;

• If  is of type , then  and  are modified to type  and , respectively;

• If  is of type , then  and  are modified to type  and , respectively;

• If  is of type , then  and  are modified to type  and , respectively.

We can see that each neighbor  of  in the same part  of  loses exactly one neighbor (that is ) in . Moreover, receives at most one new neighbor (that is ) in . The same occurs for every neighbor of  in . Therefore, in any case it is not obtained vertices of type  with , which implies that the Algorithm 1 finishes. ∎

Despite the simplicity of Algorithm 1, determining the size of a minimum odd decycling matching of subcubic graphs is -hard, since this problem becomes analogous to MAX CUT  for such a class.

## 2 NP-Completeness for Odd Decycling Matching

In this section we prove that Odd Decycling Matching is -complete even for planar graphs of maximum degree at most . We organize the proof in three parts. In the first one we show some polynomial time reductions from Not-All-Equal 3-SAT (NAE-3SAT)  and Positive Planar 1-In-3-SAT . In the second part we prove that Odd Decycling Matching is -complete for graphs with maximum degree at most . This proof is a more intuitive and easier to understand the gadgets and construction of the next part. The third part presents a proof that Odd Decycling Matching is -complete even for planar graphs with maximum degree at most . Finally, the proof finishes as a corollary from the previous results by just slightly modifying the used gadgets.

### 2.1 Preliminaries

Let  be a Boolean formula in CNF with set of variables and set of clauses . The associated graph of , , is the bipartite graph such that there exists a vertex for every variable and clause of , where  is a bipartition of  into independent sets. Furthermore, there exists an edge  if and only if  contains either  or . We say that  is planar if its associated graph is planar. In order to obtain a polynomial reduction, we consider the following decision problems, which are -complete.

Not-All-Equal 3-SAT (NAE-3SAT)  Input: A Boolean formula in -CNF, . Question: Is there a truth assignment to the variables of , in which each clause has one literal assigned true and one literal assigned false?

Positive Planar 1-In-3-SAT  Input: A planar Boolean formula in -CNF, , with no negated literals. Question: Is there a truth assignment to the variables of , in which each clause has exactly one literal assigned true?

In order to prove the -completeness of Odd Decycling Matching, we first present a polynomial time reduction from NAE-3SAT and Positive Planar 1-In-3-SAT to the following decision problems, respectively:

NAE-3SAT Input: A Boolean formula in CNF, , where each clause has either  or  literals, each variable occurs at most  times, and each literal occurs at most twice. Question: Is there a truth assignment to the variables of  in which each clause has at least one literal assigned true and at least one literal assigned false?

Planar 1-In-3-SAT Input: A planar Boolean formula in CNF, , where each clause has either  or  literals and each variable occurs at most  times. Moreover, each positive literal occurs at most twice, while every negative literal occurs at most once in . Question: Is there a truth assignment to the variables of  in which each clause has exactly one true literal?

###### Theorem 4.
• NAE-3SAT is -complete.

• Planar 1-In-3-SAT is -complete.

###### Proof.

Since verifying whether a graph is planar can be done in linear-time , as well as whether a formula in -CNF has a truth assignment, both problems are in .

Let  be a Boolean formula in -CNF such that  denotes the set of variables and  is the set of clauses of . We construct a formula  from  as follows. For a vertex , let  be the degree of  in . For such a variable  with , we create  new clauses  of size , and  new variables  as follows:

In addition, we replace the () occurrence of the variable by an occurrence of a variable , where a literal (resp. ) is replaced by a literal .

Let  be the set of all vertices  with . For such a vertex , let  and .

Note that, the associated graph  can be obtained from  by replacing the corresponding vertex of  by a cycle of length  induced by the corresponding vertices of the new clauses in  and the new variables in . In addition, for each  and  an edge  is added in , such that every corresponding vertex  has exactly one neighbor . Fig. 2 shows an example of the transformation for a Boolean formula.

As we can see, every variable  occurs at most  times in the clauses of , since every variable  with  is replaced by  new variables that are in exactly  clauses of . By the construction, each literal occurs at most twice. Moreover, if  has no negative literals, then only the new variables have a negated literal and each one occurs exactly once in . Figure 2: The associated graph GF′ obtained from F=(x1∨x2∨x3)∧(x1∨x3∨x4)∧(x1∨x4∨x5)∧(x2∨x3∨x5). The black vertices correspond to clauses.

Now, it remains to show that if  is planar then we can construct as a planar formula. Consider a planar embedding  of , we construct  replacing each corresponding vertex  by a cycle of length , as described above. After that, in order to preserve the planarity, we can follow the planar embedding  to add a matching between vertices corresponding to variables in such a cycle and vertices corresponding to clauses  and that . Such a matching indicates in which clause of  a given new variable will replace  in . Thus, without loss of generality, if  is planar then we can assume that  is planar as well.

Let  be an instance of NAE-3SAT (resp. Positive Planar 1-In-3-SAT) such that  denotes its set of variables and  its set of clauses. Let  be the formula obtained from  by the above construction. As we can observe, for any truth assignment of , all  (for a given variable  of ) have the same value. Therefore, any clause of  containing exactly two literals has true and false values. At this point, it is easy to see that  has a not-all-equal (resp. 1-in-3) truth assignment if and only if  has a not-all-equal (resp. 1-in-3) truth assignment. ∎

Now we show the -completeness of Odd Decycling Matching. Let us call the graph depicted in Fig 2(a) by head. Vertex  is the neck of the head. Given a graph , the next lemma shows that such a structure is very useful to ensure that some edges cannot be in any odd decycling matching of . The next simple lemma is used in the correctness of our reductions.

###### Lemma 5.

Let  be a graph that contains an induced subgraph  isomorphic to a head graph, whose neck is . Then all edges not in  incident to  cannot be in any odd decycling matching of . Moreover  admits only one odd decycling matching.

###### Proof.

Let  be an odd decycling matching of . Suppose for a contradiction that there exists an edge  incident to , such that  contains an endvertex not in . In this case, we get that  and  does not belong to , which implies that . By the triangle , it follows that  must be in . Hence the cycle  remains in , a contradiction.

Now suppose that . In this case, the edge  cannot be in , otherwise the cycle  survives in . In the same way, the edge , otherwise the cycle  is not destroyed by . Therefore we get that  must be in , which implies that . Hence the cycle  belongs to . Since the triangle  has no edge in , it is not destroyed by , a contradiction.

Finally, we get that  must be in , which implies that  as well. Therefore, it follows that  must be in . Hence  also must be in , which turns the graph bipartite. Since all choices of the edges of  are necessary, we get that there is only one possible odd decycling matching of , which is perfect. Fig. 2(b) shows such a matching. This concludes the proof. ∎

### 2.2 Np-Completeness for Graphs with Maximum Degree at Most 4

With Lemma 5 we can establish the -completeness of Odd Decycling Matching. Remember that graphs in  are all -colorable. The next results show that the -completeness is also obtained even for -colorable bounded degree graphs. First we present a more intuitive proof by a reduction from NAE-3SAT, next we present a more complex proof that also preserves the planarity. The circles with an  in the figures represent an induced subgraph isomorphic to the head graph, whose neck is the vertex touching the circle. By simplicity, this pattern will be used in the remaining figures whenever possible.

###### Theorem 6.

Odd Decycling Matching is -complete even for -colorable graphs with maximum degree at most .

###### Proof.

We prove that Odd Decycling Matching is -complete by a reduction from NAE-3SAT Let  be an instance of NAE-3SAT, with  and  be the sets of variables and clauses of , respectively. We construct a graph  as follows:

• For each variable , we construct a variable gadget . Such a gadget consists on a diamond  with a head, whose neck is the vertex  of degree two in . The vertices of degree three in , and , represent the literal , while the last one, , of degree two represents the negative literal . Fig. 4 shows the variable gadget .

• For each clause , we associate a clause gadget . If  contains three literals, then  is a triangle with vertices , , and . Moreover, each vertex  is adjacent to a linking vertex , , which is a neck of a head . Such clause gadget is showed in Fig. 4(b). In a similar way, if  has size two, then  is as depicted in Fig. 4(a), where  and  are the vertices that connect  to the gadgets of the variables contained in .

• We link a clause gadget  to a variable gadget , such that , as follows. If  contains the positive literal , then add one edge between a linking vertex  to either  or , otherwise we add the edge , for some .

Since the Head graph is -colorable, clearly the above construction generates also a -colorable graph. Next we prove that  has a truth assignment if and only if the graph  obtained form the above construction has an odd decycling matching. If  has a truth assignment , then each clause  contains at least one true literal and at least one false literal. For such a clause, we associate true to  if and only if its corresponding literal is true in . In the same way, for every variable gadget , we associate true to  and  if and only if the positive literal  is true in . Therefore, we can construct a bipartition of  into sets  and , that represent the literal assigned true and false, respectively, as follows.

• For each clause gadget  of literals, remove the edge  if , ;

• For each clause gadget  of literals, remove either the edge  or ;

• For every variable gadget , remove the edge ;

• For each induced head , remove edges as in Fig. 2(b).

It is not hard to see that the obtained graph is bipartite, since each linking vertex  is in the opposite set of  and of , such that . Moreover, and  are in opposite sets, for every clause of length . Since the removed edges are clearly a matching in , it follows that .

Now we consider that . By Lemma 5, it follows that  must be in any odd decycling matching of , for every variable gadget . Analogously, either  or  and exactly one edge  must be included in any odd decycling matching of , for every clause gadget  of  and  literals, respectively. Therefore, for an odd decycling matching of , we can associate to the parts of the bipartition of  as true and false. Thus, it follows that:

• and  are in the same part, while  is in the opposite one, for every variable gadget ;

• and  are in different parts, for every clause gadget  of length ;

• All the vertices  are not in the same part, for every clause gadget  of length ;

Hence, every clause has at least one true and one false literal, which implies that  is satisfiable. ∎

Since NAE-3SAT is polynomial time solvable for planar graphs , the previous construction cannot be planar. Moreover planar graphs are classical -colorable graphs. Hence it is interesting to know what happens in such a class. The next Subsection deals with this problem.

### 2.3 Np-Completeness for Planar Graphs

Now we will show that Odd Decycling Matching remains -complete even for -colorable planar graphs with maximum degree . We prove the -completeness by a reduction from Planar 1-In-3-SAT. In order to prove this result, next we give a useful lemma.

###### Lemma 7.

Let  be a border of an odd -pool graph , such that  and  are its neighbors in . It follows that every odd decycling matching of  must contain exactly one edge of the internal cycle, which is different from . Moreover, there is only one odd decycling matching for such an edge.

###### Proof.

Let  be the internal cycle of  and let  be the -th-border of , such that , . Since  has odd length, it follows that every odd decycling matching of  contains at least one edge of .

Suppose for a contradiction that  has an odd decycling matching  containing . In this case, we get that the edges in  cannot be in . Therefore  must contain the edges  and . In the same way, we can see that the edges  are not in . Hence, it can be seen that all edges indent to  are forbidden to be in , which implies that the triangles  and  have no edge in , a contradiction by the choice of .

Let  be an edge of  contained in an odd decycling matching  of . In a same fashion, the edges in cannot be in . Following this pattern, we can see that every edge  must be in , for every . Furthermore, it follows that , for every . Since  contains one edge of every triangle of , it follows that  is unique, for every edge . Finally, such an odd decycling matching contains only one edge of . ∎ (a) For clauses of size two. Figure 7: Variable gadget Gxi in Theorem 8. Each pair of edges with one no endvertex connects Gxi to one clause gadget Gca, Gcb, or Gcc, where xi∈(ca∩cb∩cc).
###### Theorem 8.

Odd Decycling Matching is -complete even for -colorable planar graphs with maximum degree at most .

###### Proof.

Let  be an instance of Planar 1-In-3-SAT, with  and  be the sets of variables and clauses of , respectively. We construct a planar graph  of maximum degree  as follows:

• For each clause , we construct a gadget  as depicted in Fig. 6. Such gadgets are just a -pool and a -pool less a border for clauses of size  and , respectively. Moreover, for the alternate edges of the internal cycle we subdivide them twice and append a head graph to each such a new vertex. Finally, we add two vertices  and  , such that  and , for . For such new vertices, we append a head graph to each one.

• For each variable , we construct a gadget  as depicted in Fig. 7. Such a gadget is a -pool less a border, where we subdivide the edges , , , and  twice, where every such a new vertex has a pendant head. We rename each border vertex  () as  and  as , for . Moreover we add a new vertex  adjacent to , which has a pendant head graph.

• The connection between clause and variable gadgets are as in Fig. 6 and Fig. 7, where each pair of arrow head edges in a variable gadget  corresponds to a pair of such edges in a clause gadget , such that . More precisely, if , then we add the edges  and , for some  and for some . On the other hand, if , then we add the edges  and , for some .

• If a variable occurs only twice in , then just consider those connections corresponding to the literals of  in the clauses of , such that  and  represent .

Let  be the graph obtained from  by the above construction. We can see that  has maximum degree , where the only vertices with degree  are those , for each variable gadget . Furthermore, it is clear that  is -colorable.

It remains to show that if  is planar (that is, if  is planar), then  is planar. Consider a planar embedding  of . We replace each variable vertex  of  by a variable gadget , as well as every clause vertex  of  by a clause gadget . The clause gadgets correspond to clauses of length two or three, which depends on the degree of  in . Since the clause and variable gadgets are planar, we just need to show that the connections among them keep the planarity. Given an edge , we connect  and  by duplicating such an edge as parallel edges  and , for some  and for some  or  and , for some , as previously discussed.

In order to prove that  is satisfiable if and only if , we discuss some considerations related to odd decycling matchings of the clause and variable gadgets. By Lemma 7, we know that an odd -pool graph less a border admits one odd decycling matching for each edge of the internal cycle, except that whose both endvertices are adjacent to the removed border. Furthermore, by Lemma 5 it follows that each external edge incident to the neck of an induced head cannot be in any odd decycling matching. In this way, Fig. 8 shows the possible odd decycling matchings , given by the stressed edges for the clause gadget  of clauses of length three. The black and white vertex assignment represents the bipartition of . Notice that exactly one pair of vertices  and  () is such that they have the same color, while the other such pairs have opposite colors. More precisely, we can see that  has the same color for each pair with opposite color vertices as well as , for each odd decycling matching of . In this way, we can associate one literal , , and  to each pair of vertices  and , . A similar analysis can be done for clause gadgets of clauses of length two.