arXiv:2610.29817cs.CCOct 2026

Manuscript Offprint

arXiv:2610.29817

Pfaffian Recognition is in coRP

Priyanshu Pant, Ranveer Singh

Abstract

A graph is called Pfaffian if it admits a Pfaffian orientation. The Pfaffian recognition problem asks whether a given graph is Pfaffian. In 1989, Vazirani and Yannakakis showed that this problem is polynomial time equivalent to testing whether a prescribed orientation is Pfaffian, and that the problem belongs to coNP. The complexity of the problem for general graphs has remained open since then. For bipartite graphs, polynomial time recognition algorithms were obtained by Robertson, Seymour, and Thomas in 1999, and independently by McCuaig in 2004. We show that testing whether a given orientation is Pfaffian can be reduced to polynomial identity testing. This gives a randomized polynomial time algorithm for Pfaffian recognition on general graphs, placing the problem in coRP.

1 Introduction

Counting perfect matchings is a central problem in combinatorics and the theory of counting problems [6, 8]. A perfect matching of a graph is a set of pairwise disjoint edges that covers every vertex exactly once. Although the existence of a perfect matching can be decided in polynomial time [3], counting the number of perfect matchings is much harder. Valiant proved that the problem is #P-complete, even for bipartite graphs [17].

All graphs considered in this paper are finite and simple. For a graph GG, we write V(G)V(G) and E(G)E(G) for its vertex and edge sets, and M(G)\mathcal{M}(G) for its set of perfect matchings. Let GG have 2n2n vertices, and assign a variable xex_e to each edge e∈E(G)e \in E(G). The perfect matching polynomial of GG is

PerfMatch(G)=∑M∈M(G)∏e∈Mxe.\mathrm{PerfMatch}(G)=\sum_{M\in\mathcal{M}(G)}\prod_{e\in M}x_{e}.

Setting all variables xe=1x_{e}=1 gives the number of perfect matchings of G.

A classical algebraic approach to counting perfect matchings uses Pfaffian orientations. An orientation DD of GG is a choice of direction for each edge. Fix an ordering 1,2,…,2n1,2,\ldots,2n of the vertices of GG. If e=ij∈E(G)e = ij \in E(G), we write xex_e and xijx_{ij} interchangeably for the corresponding edge variable. The weighted skew adjacency matrix of GG with respect to DD, denoted by ADA_D, is the 2n×2n2n \times 2n matrix whose (i,j)(i,j)-entry is

(AD)ij={xij,ifij∈E(G)isorientedfromitoj,−xij,ifij∈E(G)isorientedfromjtoi,0,ifij∉E(G).(A_{D})_{ij}=\begin{cases}x_{ij},&if ij\in E(G)is oriented from i to j,\\-x_{ij},&if ij\in E(G)is oriented from j to i,\\0,&if ij\notin E(G).\end{cases}

Let M={e1,e2,…,en}M = \{e_1, e_2, \ldots, e_n\} be a perfect matching of GG, and suppose that in the orientation DD, the tail and the head of eie_i are uiu_i and viv_i, respectively. The permutation of MM in DD, denoted by πD(M)\pi_D(M), is

πD(M)=(1234⋯2n−12nu1v1u2v2⋯unvn).\pi_{D}(M)=\begin{pmatrix}{{{1}}}&{{{2}}}&{{{3}}}&{{{4}}}&{{{\cdots}}}&{{{2n-1}}}&{{{2n}}} \\{{{u_{1}}}}&{{{v_{1}}}}&{{{u_{2}}}}&{{{v_{2}}}}&{{{\cdots}}}&{{{u_{n}}}}&{{{v_{n}}}}\end{pmatrix}.

The sign of M with respect to D, denoted by signD(M)\text{sign}_D(M), is the sign of πD(M)\pi_D(M). This value is independent of the order in which the edges of M are enumerated. The Pfaffian of ADA_D is

Pf(AD)=∑M∈M(G)signD(M)∏e∈Mxe.\mathrm{Pf}(A_{D})=\sum_{M\in\mathcal{M}(G)}\mathrm{sign}_{D}(M)\prod_{e\in M}x_{e}.

It contains exactly the same monomials as PerfMatch(G), with signs determined by the orientation. If all perfect matchings have the same sign with respect to D, then

Pf(AD)=±PerfMatch(G).\mathrm{Pf}(A_{D})=\pm\mathrm{PerfMatch}(G).

Such an orientation is called a Pfaffian orientation, and a graph admitting one is called Pfaffian. Once a Pfaffian orientation is known, the number of perfect matchings can be computed in polynomial time using Cayley's identity [1],

det⁡(A)=Pf(A)2,\det(A)=\mathrm{Pf}(A)^{2},

which holds for every skew symmetric matrix A of even order.

Pfaffian orientations originate in Kasteleyn's work on the dimer problem. In 1967, Kasteleyn showed that every planar graph admits a Pfaffian orientation and gave a polynomial time algorithm for finding one, yielding a polynomial time algorithm for counting perfect matchings in planar graphs [6]. In 1975, Little [7] proved that a bipartite graph with a perfect matching is Pfaffian if and only if it contains no even subdivision of K3,3K_{3,3} whose deletion leaves a graph with a perfect matching. In 1999, Robertson, Seymour, and Thomas [14], and independently McCuaig in 2004 [10], obtained structural characterizations which lead to polynomial time algorithms for deciding whether a bipartite graph is Pfaffian.

Considerable progress has also been made for some nonbipartite graph classes. Fischer and Little [4] characterized Pfaffian near-bipartite graphs, which are nonbipartite matching-covered graphs that become bipartite and remain matching covered after deleting two specific edges. Miranda and Lucchesi [11] later gave a polynomial time Pfaffian recognition algorithm for weakly near-bipartite graphs, a larger class that includes near-bipartite graphs. Carvalho, Lucchesi, and Murty [2] extended Little's characterization to solid matching-covered graphs, a class that includes bipartite matching-covered graphs.

For general graphs, however, the problem has proved much more difficult. Norine and Thomas [13] constructed an infinite family of minimal non-Pfaffian graphs with respect to matching minors, showing that the forbidden obstruction characterization for bipartite graphs does not extend directly to general graphs. Despite the progress on special graph classes, the existence of a polynomial time algorithm for recognizing general Pfaffian graphs remained open; see [16, 9].

A major insight into the Pfaffian recognition problem came from Vazirani and Yannakakis in 1989 [18]. Given a graph G, they construct in polynomial time an orientation D∗D^* such that G admits a Pfaffian orientation if and only if D∗D^* is Pfaffian. Thus, the recognition problem reduces to testing whether this one prescribed orientation D∗D^* is Pfaffian. Using this reduction, they also showed that Pfaffian graph recognition belongs to coNP. Recall that a decision problem is in coNP if every no instance has a polynomial-size certificate that can be verified in polynomial time. If two perfect matchings have different signs with respect to a given orientation, they certify that the orientation is not Pfaffian. Such a pair can be checked in polynomial time. Hence, when G is not Pfaffian, two perfect matchings of different signs in D∗D^* give such a certificate.

However, testing whether a given orientation is Pfaffian is not straightforward, since a graph may have exponentially many perfect matchings. In this paper, we give a randomized polynomial time algorithm for this problem using an algebraic approach, establishing the following result.

Theorem 1.1. Pfaffian graph recognition is in coRP.

Recall that a decision problem belongs to coRP if there is a randomized polynomial time algorithm that always accepts yes instances and rejects no instances with probability at least 1/2. For Pfaffian recognition, given a graph G, we first use the reduction of Vazirani and Yannakakis to construct the orientation D∗D^*. We then run our randomized test on D∗D^*. If G is Pfaffian, then D∗D^* is Pfaffian and our test always accepts. If G is not Pfaffian, then D∗D^* is non-Pfaffian and our test rejects with probability at least 1/2. Repeating the test independently reduces the probability of error exponentially.

The proof reduces testing a prescribed orientation to polynomial identity testing. Given G and an orientation D, we define a polynomial PD(x)P_D(\mathbf{x}) such that

DisPfaffian⟺PD(x)≡0.D is Pfaffian\quad\Longleftrightarrow\quad P_{D}(\mathbf{x})\equiv0.

The polynomial PDP_D records the perfect matchings whose sign is opposite to that of a fixed perfect matching. We show how to evaluate PDP_D in polynomial time using determinants of principal submatrices of the Tutte matrix. We further show that one randomized trial for testing a given orientation can be implemented using O(∣V(G)∣3)O(|V(G)|^3) field operations.

The rest of the paper is organized as follows. In Section 2 we study the signs of perfect matchings and define the polynomial used in the algorithm. In Section 3 we use this polynomial to test whether an orientation is Pfaffian and thus obtain the recognition algorithm. In Section 4 we give a faster way to evaluate the polynomial and obtain a randomized test for a given orientation using O(∣V(G)∣3)O(|V(G)|^3) field operations.

References (17)