Matching Cuts on Plane Graphs

Abstract
A perfect matching cut of a graph is a perfect matching that is also an edge cut, and a maximum matching cut is a matching cut with the most edges. We study pmc and mmc on subgraphs of the square grid. We show that pmc is NP-complete on induced grid graphs, even with all degrees in $\{2,3\}$ and large girth, and thus show that the problem of domino tiling studied by Biedl and others is also NP-complete, answering a question of Biedl (2005). Adapting an algorithm of Worman and Yang, we solve pmc on grid graphs without holes in $O(n)$ time and in FPT time in the number of holes. We also give a sub-exponential algorithm for this problem using the recently claimed refutation of the Exponential-Time Hypothesis. As our main technical contribution we reduce mmc to finding Maximum Weight Independent Set in outerstring graphs. This reduction achieves a large variety of results, including an $O(n^3)$-time algorithm for hole-free graphs, an $O(1.7624^pn^3)$-time algorithm when the holes have total perimeter $p$, a linear-time $\frac{21}{41}$-approximation, and an $O(n^2)$-time algorithm for disconnected perfect matching. The reduction also extends to quadrangulated disks, such as polycubes. Using curvature of the faces we characterize the graphs for which both problems are solvable in $O(n^3)$.

All figures are interactive and computed live. The grid figures of §§2–5 share one working graph; the figures of §6 share one quadrangulated disk. Statement numbers and references labelled “Paper Fig.” follow the revised paper; the figures below use their own supplement numbering.

1Introduction

In a graph $G=(V,E)$, the edge cut of a partition $V=X\cup Y$ into nonempty sets is the set of edges with one endpoint in $X$ and one in $Y$. A matching cut is an edge cut that is a matching, and a perfect matching cut is one that is a perfect matching. Deciding whether a graph has a matching cut (mc) or a perfect matching cut (pmc) is NP-complete in general, as is Maximum Matching Cut (mmc). Disconnected Perfect Matching asks for a perfect matching containing a matching cut. The property is expressible in monadic second-order logic and is decidable in linear time on graphs of bounded treewidth, but grid graphs have unbounded treewidth. The paper studies these problems on grid and quadrangulated graphs.

One motivation is Biedl’s (2005) domino-tiling problem: tile a polygonal layout with colored $2\times1$ dominoes so that adjacent cells of different dominoes have the same color. The three-color case was known to be NP-complete; the two-color case was left open. With two colors and bichromatic dominoes, these tilings are exactly the perfect matching cuts of the layout graph (Proposition 11), giving NP-completeness for the two-color case (Corollary 12).

On hole-free grid subgraphs, the main reduction represents matching cuts by vertex-disjoint strips and reduces optimization to maximum weight independent set in outerstring graphs. The leaf–corner method also gives an FPT algorithm in the number of holes, and the linear-size SAT encoding transfers any subexponential 3-SAT algorithm to pmc (Corollary 15). The extension to quadrangulated disks is controlled by curvature and by whether matching strips close.

Figure 1. Structure of the paper; an arrow means “is used in”.

2Preliminaries

All graphs are finite and simple. Write $n=|V(G)|$, $m=|E(G)|$, and $\mathbb F_2=\{0,1\}$.

2.1Cuts, colorings, and parity

For $s\colon V(G)\to\mathbb F_2$ write $\delta(s)=\{uv\in E(G): s(u)\ne s(v)\}$.

Definition 1. A perfect matching cut of $G$ is a perfect matching $M$ with $M=\delta(s)$ for some $s$, a side coloring of $M$.
Definition 2. For connected $G$, a matching cut is a nonempty matching $M=\delta(s)$; given positive edge weights $w:E(G)\to\mathbb R_{>0}$, a maximum weight matching cut maximizes $w(M)=\sum_{e\in M}w(e)$. A perfect matching is disconnected if it contains a matching cut.
Observation 3. $\delta(s)$ is a perfect matching cut if and only if every vertex $v$ has exactly one neighbor $u$ with $s(u)\ne s(v)$.
Lemma 4. Let $G$ be connected and $F\subseteq E(G)$. Then $F=\delta(s)$ for some $s$ if and only if $|F\cap E(C)|$ is even for every cycle $C$; the only such colorings are $s$ and $s\oplus1$.

2.2Plane graphs

The boundary $\partial f$ contains edges with $f$ on one side and a different face on the other. Edges having the same face on both sides, such as bridges, are excluded.

Lemma 5 (face parity). Let $G$ be a connected plane graph and $F\subseteq E(G)$. Then $F=\delta(s)$ for some $s$ if and only if $|F\cap\partial f|$ is even for every bounded face $f$.

2.3Grid graphs

A grid subgraph is a finite subgraph of the lattice $\mathbb L$ on $\mathbb Z^2$; an induced grid graph is $\mathbb L[W]$. The unit square $Q_{x,y}$ is a square face if all four of its sides are edges.

Definition 6. A hole is a bounded face that is not a square face. $G$ is hole-free if it is connected and has no hole; equivalently, it has exactly $m-n+1$ square faces. The hole perimeter $p(G)$ is the number of distinct edges incident to at least one hole.
Lemma 7 (square rule). Let $G$ be a connected grid subgraph and $M$ a matching. If $M=\delta(s)$, then for every square face $Q$, $M\cap\partial Q$ is empty or a pair of opposite sides. Conversely, if this holds for every square face and $|M\cap\partial h|$ is even for every hole $h$, then $M=\delta(s)$ for some $s$.
Figure 2. The square rule (Lemma 7).
Figure 3. Observation 3 and Lemmas 4, 5, 7 on the working graph. Odd faces are shaded; the search of Lemma 4 can be animated.

3Hardness and two-color domino tiling

The reduction starts from Barnette graphs: 3-connected cubic bipartite planar graphs. Subdivision and grid realization preserve perfect matching cuts while producing induced grid graphs of large girth.

3.1Subdivisions

Lemma 8. Let $H$ be obtained from $G$ by replacing every edge $uv$ by a path of length $\ell_{uv}\equiv1\pmod 4$ with internal vertices of degree 2. Side colorings of perfect matching cuts of $H$ restrict to those of $G$, and those of $G$ extend uniquely to $H$.
Figure 4. The two candidate colorings of a subdivided edge; $q_i=s(v_{i-1})\oplus s(v_i)$.

3.2Realization in the grid

Lemma 9 (grid realization). For a bipartite graph $G$ of maximum degree $\le4$ given by an orthogonal drawing of polynomial size, and $\ell_0\in\mathbb N$, one can compute in polynomial time $W\subseteq\mathbb Z^2$ such that (i) $\mathbb L[W]$ is obtained from $G$ as in Lemma 8 with all $\ell_{uv}\ge\ell_0$, and (ii) any two points of $W$ differing by $(\pm1,\pm1)$ have a common neighbor in $W$.
Theorem 10. pmc is NP-complete on induced grid graphs, even for 2-connected ones with all degrees in $\{2,3\}$ and girth at least $g$, for every fixed $g$.
Figure 5. Lemma 9 applied to the cube $Q_3$ ($R=5$).

3.3Two-color domino tiling

A layout is a polygon with horizontal and vertical sides and integer corners. Its layout graph has one vertex per unit cell and edges between cells sharing a side. Dominoes form a perfect matching. A colored tiling uses each entry in the domino multiset at most once in the partial version and exactly once in the exact version; adjacent cells on different dominoes must have the same color.

Proposition 11. With colors $\{0,1\}$ and $n/2$ copies of the domino $\{0,1\}$, a pair $(M,c)$ is a tiling of the layout $L$, in either the partial or exact version, if and only if $M$ is a perfect matching cut of $G_L$ with side coloring $c$.
Corollary 12. Two-color domino tiling is NP-complete in both the partial and exact versions, even if all dominoes are copies of $\{0,1\}$.
Figure 6. A perfect matching cut as a tiling with dominoes $\{0,1\}$.

4Perfect matching cuts

The Worman–Yang leaf–corner method is adapted to all grid subgraphs: they need not be induced, may touch diagonally, and may have holes.

4.1Leaves and corners

Let $R$ be obtained from $G$ by deleting vertices. A vertex $v$ is forced if $d_R(v)\le1$, or $d_R(v)=2$ and $v$ is a corner of a square face $Q_v$ of $R$. If $d_R(v)\ge1$, its forced set $X_v$ is the leaf $\{u,v\}$ or the corner $V(Q_v)$; it must be matched internally by every perfect matching cut of $R$. An isolated forced vertex instead rejects the instance.

4.2The algorithm

Theorem 13. Let $G$ be a connected grid subgraph with $h$ holes. Algorithm 1 computes a perfect matching cut of $G$ and a side coloring, or decides that none exists, in $O(n)$ time if $h=0$ and in $O(2^hh^2n)$ time if $h\ge1$.
Algorithm 1. The leaf–corner decomposition, with branching when stuck and a linear system over $\mathbb F_2$ at each terminal node.

4.3Linear-size SAT encoding

Theorem 14. For a connected grid subgraph $G$ with $h\ge1$ holes, one can compute in polynomial time a 3-CNF formula $\varphi$ with $O(h)$ variables and clauses that is satisfiable if and only if $G$ has a perfect matching cut. A satisfying assignment yields a perfect matching cut and a side coloring in polynomial time.
Corollary 15. Suppose that 3-SAT on $N$ variables and $O(N)$ clauses can be solved in time $T(N)N^{O(1)}$, for a nondecreasing $T$. Then pmc on grid subgraphs with $h\ge1$ holes can be solved in time $T(O(h))n^{O(1)}$. In particular, a $2^{o(N)}$-time algorithm for 3-SAT gives a $2^{o(h)}n^{O(1)}$-time algorithm for pmc; an algorithm with $T(N)=2^{O(N/\sqrt{\log N})}$ gives time $2^{O(h/\sqrt{\log h})}n^{O(1)}$.

The subexponential conclusion is conditional on the corresponding 3-SAT algorithm; the revised paper relates it to a recently claimed refutation of the Exponential-Time Hypothesis.

Figure 7. The formula $\varphi$ of Theorem 14: stuck graph with exceptional vertices (labelled by type) and pieces, the clauses, and a CDCL solution decoded to a perfect matching cut.

5Strips and maximum matching cuts

Throughout this section, the grid subgraph is connected and need not be induced. The interactive examples use unit edge weights, so the weight of a cut is its number of edges.

Corollary 16. Maximum matching cut is NP-hard on induced grid graphs.

5.1Strips

Definition 17. The strips of $G$ are the classes of the equivalence relation on $E(G)$ generated by $h_{x,y}\sim h_{x,y+1}$ and $v_{x,y}\sim v_{x+1,y}$ for every square face $Q_{x,y}$. For a strip $S$, $V(S)$ is the set of endpoints of its edges. The conflict graph $K$ joins two strips that share a vertex, and its strip weight is $w(S)=\sum_{e\in S}w(e)$. Each end face of a strip is either a hole or the outer face.
Lemma 18. $M$ is a matching with $M=\delta(s)$ if and only if (i) $M=\bigcup I$ for an independent set $I$ of $K$, and (ii) $|M\cap\partial h|$ is even for every hole $h$. In a hole-free graph, nonempty independent sets correspond exactly to matching cuts, and every strip is a matching cut.
Figure 8. Strips and the conflict graph $K$ with weights $|S|$.

5.2An outerstring representation of the conflict graph

Definition 19. An outerstring representation consists of a region $D$ bounded by a simple polygon and, for each graph vertex, a polygonal path contained in $D$ meeting $\partial D$ only in one endpoint. Two curves meet if and only if their vertices are adjacent. Its size is the total number of segments in the polygon and the curves.

Let $\mathcal S^\circ$ be the strips with no edge incident to a hole.

Fact 20 (Keil, Mitchell, Pradhan, Vatshelle). A maximum-weight independent set of a graph given by an outerstring representation of size $N$ can be computed in $O(N^3)$ time.
Lemma 21. $K[\mathcal S^\circ]$ has an outerstring representation of size $O(n)$, computable in $O(n)$ time.
Figure 9. Zigzag curves $\gamma_S$, tails, and the collar $D$.

5.3Hole-free grid subgraphs

Theorem 22. Given a hole-free grid subgraph $G$ with $n\ge2$ and positive edge weights $w:E(G)\to\mathbb R_{>0}$, a maximum weight matching cut and a side coloring can be computed in $O(n^3)$ time.

5.4Grid subgraphs with holes

Lemma 50. A graph on $t$ vertices with all degrees in $\{1,2,3,4\}$ has at most $17^{t/5}<1.7624^t$ independent sets.
Theorem 23. Given a connected grid subgraph $G$ and positive edge weights, a maximum weight matching cut can be computed, or shown not to exist, in $O(17^{t/5}n^3)=O(1.7624^tn^3)$ time, where $t=|\mathcal S\setminus\mathcal S^\circ|\le p(G)$ is the number of strips with an edge incident to a hole.
Figure 10. Strips classified by end faces; the guessing algorithm of Theorem 23.

5.5Approximation

Theorem 24. On connected grid subgraphs with $m\ge1$, a matching cut with at least $\frac{21}{41}\,\mathrm{opt}$ edges can be computed in $O(n)$ time.
Figure 11. Stripe cuts (Lemma 51), 2-core and tree dynamic program (Lemma 52), and the two ratio bounds.

5.6Disconnected perfect matchings

Theorem 25. Disconnected Perfect Matching is solvable in $O(n^2)$ time on hole-free grid subgraphs, and a disconnected perfect matching can be found in the same time.
Figure 12. For each strip $S$, a perfect matching of $G-V(S)$.

6Beyond the grid: quadrangulated disks

Definition 26. A quadrangulated disk is a connected plane graph $G$ with $n\ge2$ in which the facial walk of every bounded face is a simple 4-cycle. Its bounded faces are the quads. Then $\sum_v(4-2d(v)+q(v))=4$.  (1)

6.1Strips of a quadrangulated disk

Definition 27. The strips are the classes of the relation generated by being opposite sides of a quad.
Lemma 28. Every strip is a ladder $e_0,Q_1,e_1,\dots,Q_k,e_k$ that is either open (both ends on the outer face) or closed ($e_k=e_0$).
Lemma 30. $M$ is a matching cut if and only if it is a nonempty union of matching strips with pairwise disjoint vertex sets.
Corollary 31. Disconnected Perfect Matching is solvable in $O(n^2)$ time on quadrangulated disks.
Figure 13. Strips and ladders. The disk is editable: Extend glues a square to a boundary edge, Quad adds a 4-cycle, Move and Delete act on vertices and squares.

6.2Outer strings for open strips

Lemma 35. For distinct open matching strips $Z,Z'$: $\gamma'_Z\cap\gamma'_{Z'}\ne\emptyset$ if and only if $V(Z)\cap V(Z')\ne\emptyset$.
Theorem 37. Given an embedded quadrangulated disk with positive edge weights in which every matching strip is open, a maximum weight matching cut can be computed, or shown not to exist, in $O(n^3)$ time. In the same time, pmc can be decided and a side coloring found.
Figure 14. Interior diagonals (×), zigzag curves $\gamma'_Z=u_0w_0\,c_{Q_1}\,w_1u_1\,c_{Q_2}\cdots$, and the collar.

6.3A curvature obstruction to closed matching strips

For an interior vertex, $\kappa(v)=4-d(v)$; $\kappa^+(G)=\sum_{v\text{ interior}}\max(\kappa(v),0)$.

Lemma 38. The endpoints of a closed matching strip form two vertex-disjoint cycles. One bounds a closed disk $R$ containing no point of the outer face, and $\sum_{v\in V(G)\cap R}\kappa(v)=4$. All vertices in $R$ are interior vertices of $G$.
Corollary 39. If every interior vertex has degree at least 4 (a squaregraph), or if $\kappa^+(G)<4$, every matching strip is open and Theorem 37 applies. In particular, it applies to every polycube patch with at most three interior vertices of degree 3.
Proposition 40. Every strip of a stepped patch is an open matching strip, so Theorem 37 applies to all stepped patches.
Figure 15. Curvature, closed strips with their enclosed disks, and stepped surfaces.

6.4Closed strips

Theorem 41. With $t$ closed matching strips, maximum weight matching cut and pmc are solvable in $O(2^tn^3)$ time.
Figure 16. All guesses $J$ of closed matching strips, each completed by open strips.

7Open problems

  1. Are there efficient randomized algorithms with bounded error for these problems? Can property testers distinguish, with high probability, graphs with a perfect matching cut from graphs far from having one?
  2. How should the related board game Kingdomino be modeled, and what is its complexity? The paper contrasts the domino-tiling condition with a rule requiring each cell to have at least one neighbor of the same color.
  3. Can the results for quadrangulated graphs be extended to specific applications in computer graphics?

AQuadrangulated images

Quadrilateral meshes are standard in computer graphics, and the strips of §6 are their dual chords (also called polychords or edge rings). A matching cut is a union of vertex-disjoint matching chords; it splits the mesh into two sides, and every vertex has at most one neighbor across the cut. The figure meshes the foreground of an image and computes a maximum matching cut by Lemma 30, as an exact maximum independent set of the conflict graph of matching strips.

The default construction follows Paper Figure 28: threshold the image (Otsu, or the alpha channel), keep the largest foreground region with holes filled, extract a smooth boundary, and triangulate with Delaunator. Split each triangle into three quads through its centroid and edge midpoints, then smooth interior vertices. This construction creates many closed strips, illustrating the curvature result of Lemma 38 and the closed-strip algorithm of Theorem 41. The optional triangle-pairing mode first joins adjacent triangles into well-shaped quads, following the approach of Blossom-Quad (Remacle et al., 2012).

Figure 17. A quadrangulated image and a maximum matching cut, following Paper Figure 28. The default mesh splits every triangle into three quads. Sides are tinted; the cut edges are black and their dual chords gold. The stages show the mask, the Delaunay triangulation, and the optional triangle pairing.

Notes

In Edit mode, click a lattice point to add or remove a vertex, click between two vertices to toggle an edge, and drag to paint. Ctrl/⌘ Z undoes. Copy link stores the graph in the URL.

Maximum-weight independent sets are computed by exact branch and bound rather than by the algorithm of Fact 20. Satisfiability is decided by a small CDCL solver. Formulas are typeset with KaTeX.