\documentclass[11pt]{article} \usepackage[margin=0.95in]{geometry} \usepackage{amsmath,amssymb,amsthm} \usepackage{booktabs} \usepackage{enumitem} \usepackage{tikz} \usetikzlibrary{arrows.meta,decorations.markings} \usepackage[hidelinks]{hyperref} \DeclareMathOperator{\Pf}{Pf} \DeclareMathOperator{\Arf}{Arf} \DeclareMathOperator{\sgn}{sgn} \DeclareMathOperator{\Perm}{Perm} \theoremstyle{remark} \newtheorem*{remark}{Remark} % TikZ style for a centered arrow on an edge \tikzset{ midarrow/.style={ postaction={decorate}, decoration={ markings, mark=at position 0.56 with {\arrow[scale=1.15]{Stealth}} } }, vnode/.style={ circle, draw=black, fill=white, inner sep=1.3pt, font=\scriptsize\bfseries }, ghostv/.style={ circle, draw=black!50, fill=white, inner sep=1.3pt, font=\scriptsize, text=black!55 } } \title{Comment on ``Counting over non-planar graphs'':\\ A Counterexample and Corrections to the Generalized Pfaffian Algorithm} \author{Alex Fischer, with Gemini 4 Neon} \date{} \begin{document} \maketitle \begin{abstract} In ``Counting over non-planar graphs'' (\emph{Physica A} \textbf{302} (2001) 100--109), R.~Zecchina describes a six-step generalized Pfaffian algorithm for counting perfect matchings (and evaluating Ising partition functions and permanents) on graphs embedded on an orientable surface of genus~$g$ in $O(4^g \operatorname{poly}(N))$ time. While the underlying Pfaffian-sum method is mathematically sound, the algorithm \emph{as stated} in that paper is incomplete and produces incorrect answers. We exhibit a minimal $4$-vertex counterexample on the torus ($g=1$) that can be checked entirely by hand, identify the exact errors and omissions in the paper, state the minimal corrected algorithm, and walk through the counterexample with the fixed algorithm to recover the exact count of $8$ perfect matchings. \end{abstract} %====================================================================== \section{Introduction} %====================================================================== Kasteleyn's Pfaffian method~\cite{kasteleyn1961,kasteleyn1963} counts perfect matchings in planar graphs in polynomial time using a single Pfaffian. Kasteleyn~\cite{kasteleyn1967} observed that for a graph cellularly embedded on a closed orientable surface $\Sigma$ of genus~$g$, the count extends to a signed linear combination of $2^{2g}$ Pfaffians; rigorous proofs and complete algorithms were later given by Galluccio and Loebl~\cite{galluccio1999}, Tesler~\cite{tesler2000}, and Cimasoni and Reshetikhin~\cite{cimasoni2007} (see also Regge and Zecchina~\cite{regge1996,regge2000} for the Ising model on regular lattices). In Section~2.2 of~\cite{zecchina2001}, Zecchina summarizes a six-step algorithm intended to apply directly to both the Ising model and general perfect-matching (dimer) counting on graphs of genus~$g$, and applies it in Section~3 to permanents of $0$--$1$ matrices. Unfortunately, several essential sign conditions are omitted or misstated in~\cite{zecchina2001}. As a result, following Steps~1--6 of~\cite{zecchina2001} literally yields the wrong number of perfect matchings even on the simplest possible genus-$1$ graph. Below, we give a $4$-vertex torus counterexample (Section~\ref{sec:counterexample}), concisely explain the errors in~\cite{zecchina2001} (Section~\ref{sec:errors}), state the corrected algorithm (Section~\ref{sec:fix}), and verify the corrected algorithm step-by-step on the counterexample (Section~\ref{sec:walkthrough}). %====================================================================== \section{A Minimal Counterexample} \label{sec:counterexample} %====================================================================== Consider the $2 \times 2$ periodic square grid $\Gamma$ embedded on the torus $\Sigma = [0,2]^2 / {\sim}$ (genus $g = 1$), shown in Figure~\ref{fig:torus}. It has $N = 4$ vertices labeled $\{0,1,2,3\}$, $N_e = 8$ edges (two parallel horizontal edges between $0$ and $1$, two between $2$ and $3$, and two parallel vertical edges between $1$ and $2$, two between $0$ and $3$), and $N_f = 4$ square faces, satisfying Euler's formula $N - N_e + N_f = 4 - 8 + 4 = 0 = 2(1-g)$. \begin{figure}[t] \centering \begin{tabular}{@{}c@{\hspace{2.2em}}c@{}} \begin{tikzpicture}[scale=0.80, baseline=(current bounding box.center)] % 3D torus projection: R=1.95, r=0.78, elevation alpha=54 deg \def\R{1.95} \def\r{0.78} \def\sa{0.80902} \def\ca{0.58779} \def\tana{1.37638} \def\thOne{116} % upper longitude loop (vertices 1 and 0) \def\thTwo{68} % lower longitude loop (vertices 2 and 3) \def\phL{-116} % left meridian (vertices 1 and 2) \def\phR{-64} % right meridian (vertices 0 and 3) \def\thBot{-33.15} \def\thTop{146.85} % Subtle torus surface shading (even-odd fill between outer and inner silhouettes) \fill[black!5, even odd rule] plot[domain=0:360, samples=90, smooth cycle] ({(\R + \r*cos(atan(sin(\x)/\tana)))*cos(\x)}, {(\R + \r*cos(atan(sin(\x)/\tana)))*sin(\x)*\sa + \r*sin(atan(sin(\x)/\tana))*\ca}) plot[domain=0:360, samples=90, smooth cycle] ({(\R - \r*cos(atan(sin(\x)/\tana)))*cos(\x)}, {(\R - \r*cos(atan(sin(\x)/\tana)))*sin(\x)*\sa - \r*sin(atan(sin(\x)/\tana))*\ca}); % Torus outer and inner silhouettes \draw[black!55, line width=0.7pt] plot[domain=0:360, samples=90, smooth cycle] ({(\R + \r*cos(atan(sin(\x)/\tana)))*cos(\x)}, {(\R + \r*cos(atan(sin(\x)/\tana)))*sin(\x)*\sa + \r*sin(atan(sin(\x)/\tana))*\ca}); \draw[black!55, line width=0.7pt] plot[domain=0:360, samples=90, smooth cycle] ({(\R - \r*cos(atan(sin(\x)/\tana)))*cos(\x)}, {(\R - \r*cos(atan(sin(\x)/\tana)))*sin(\x)*\sa - \r*sin(atan(sin(\x)/\tana))*\ca}); % Back (occluded) arcs of the two meridian loops (dashed) \draw[thick, dashed, black!55] plot[domain=\thTop:{360+\thBot}, samples=40, smooth] ({(\R + \r*cos(\x))*cos(\phL)}, {(\R + \r*cos(\x))*sin(\phL)*\sa + \r*sin(\x)*\ca}); \draw[thick, dashed, black!55] plot[domain=\thTop:{360+\thBot}, samples=40, smooth] ({(\R + \r*cos(\x))*cos(\phR)}, {(\R + \r*cos(\x))*sin(\phR)*\sa + \r*sin(\x)*\ca}); % Wrap-around longitude edges h01_out and h23_out (solid black) \draw[thick] plot[domain=\phR:{360+\phL}, samples=80, smooth] ({(\R + \r*cos(\thOne))*cos(\x)}, {(\R + \r*cos(\thOne))*sin(\x)*\sa + \r*sin(\thOne)*\ca}); \draw[thick] plot[domain=\phR:{360+\phL}, samples=80, smooth] ({(\R + \r*cos(\thTwo))*cos(\x)}, {(\R + \r*cos(\thTwo))*sin(\x)*\sa + \r*sin(\thTwo)*\ca}); % Front visible portions of wrap-around meridian edges v12_out and v03_out \draw[thick] plot[domain=\thBot:\thTwo, samples=25, smooth] ({(\R + \r*cos(\x))*cos(\phL)}, {(\R + \r*cos(\x))*sin(\phL)*\sa + \r*sin(\x)*\ca}); \draw[thick] plot[domain=\thOne:\thTop, samples=25, smooth] ({(\R + \r*cos(\x))*cos(\phL)}, {(\R + \r*cos(\x))*sin(\phL)*\sa + \r*sin(\x)*\ca}); \draw[thick] plot[domain=\thBot:\thTwo, samples=25, smooth] ({(\R + \r*cos(\x))*cos(\phR)}, {(\R + \r*cos(\x))*sin(\phR)*\sa + \r*sin(\x)*\ca}); \draw[thick] plot[domain=\thOne:\thTop, samples=25, smooth] ({(\R + \r*cos(\x))*cos(\phR)}, {(\R + \r*cos(\x))*sin(\phR)*\sa + \r*sin(\x)*\ca}); % Front edge v03_in (solid black, not in spanning tree) \draw[thick] plot[domain=\thTwo:\thOne, samples=25, smooth] ({(\R + \r*cos(\x))*cos(\phR)}, {(\R + \r*cos(\x))*sin(\phR)*\sa + \r*sin(\x)*\ca}); % Spanning tree edges (thick blue): h01_in, v12_in, h23_in \draw[very thick, blue!70!black] plot[domain=\phL:\phR, samples=25, smooth] ({(\R + \r*cos(\thOne))*cos(\x)}, {(\R + \r*cos(\thOne))*sin(\x)*\sa + \r*sin(\thOne)*\ca}); \draw[very thick, blue!70!black] plot[domain=\phL:\phR, samples=25, smooth] ({(\R + \r*cos(\thTwo))*cos(\x)}, {(\R + \r*cos(\thTwo))*sin(\x)*\sa + \r*sin(\thTwo)*\ca}); \draw[very thick, blue!70!black] plot[domain=\thTwo:\thOne, samples=25, smooth] ({(\R + \r*cos(\x))*cos(\phL)}, {(\R + \r*cos(\x))*sin(\phL)*\sa + \r*sin(\x)*\ca}); % Vertices 0, 1, 2, 3 \node[vnode] at ({(\R + \r*cos(\thOne))*cos(\phL)}, {(\R + \r*cos(\thOne))*sin(\phL)*\sa + \r*sin(\thOne)*\ca}) {1}; \node[vnode] at ({(\R + \r*cos(\thOne))*cos(\phR)}, {(\R + \r*cos(\thOne))*sin(\phR)*\sa + \r*sin(\thOne)*\ca}) {0}; \node[vnode] at ({(\R + \r*cos(\thTwo))*cos(\phL)}, {(\R + \r*cos(\thTwo))*sin(\phL)*\sa + \r*sin(\thTwo)*\ca}) {2}; \node[vnode] at ({(\R + \r*cos(\thTwo))*cos(\phR)}, {(\R + \r*cos(\thTwo))*sin(\phR)*\sa + \r*sin(\thTwo)*\ca}) {3}; \end{tikzpicture} & \begin{tikzpicture}[scale=1.75, baseline=(current bounding box.center)] % Fundamental domain [0,2]x[0,2] % Vertices: 2=(0,0), 3=(1,0), 1=(0,1), 0=(1,1) % Periodic copies: (2,0)=2, (2,1)=1, (0,2)=2, (1,2)=3, (2,2)=2 % Shaded front face \fill[black!5] (0,0) rectangle (1,1); % Interior and left/bottom edges (the 8 distinct edges) % Horizontal bottom: h23_in (0,0)-(1,0), h23_out (1,0)-(2,0) \draw[very thick, blue!70!black] (0,0) -- node[below=2pt, font=\footnotesize] {$h_{23}^{\text{in}}$} (1,0); \draw[thick] (1,0) -- node[below=2pt, font=\footnotesize] {$h_{23}^{\text{out}}$} (2,0); % Horizontal middle: h01_in (0,1)-(1,1), h01_out (1,1)-(2,1) \draw[very thick, blue!70!black] (0,1) -- node[below=2pt, font=\footnotesize] {$h_{01}^{\text{in}}$} (1,1); \draw[thick] (1,1) -- node[below=2pt, font=\footnotesize] {$h_{01}^{\text{out}}$} (2,1); % Vertical left: v12_in (0,0)-(0,1), v12_out (0,1)-(0,2) \draw[very thick, blue!70!black] (0,0) -- node[left=2pt, font=\footnotesize] {$v_{12}^{\text{in}}$} (0,1); \draw[thick] (0,1) -- node[left=2pt, font=\footnotesize] {$v_{12}^{\text{out}}$} (0,2); % Vertical middle: v03_in (1,0)-(1,1), v03_out (1,1)-(1,2) \draw[thick] (1,0) -- node[right=2pt, font=\footnotesize] {$v_{03}^{\text{in}}$} (1,1); \draw[thick] (1,1) -- node[right=2pt, font=\footnotesize] {$v_{03}^{\text{out}}$} (1,2); % Identified top and right boundary edges (dashed) \draw[dashed, black!50] (0,2) -- (1,2) -- (2,2); \draw[dashed, black!50] (2,0) -- (2,1) -- (2,2); % Face labels cleanly centered away from edge labels \node[font=\footnotesize, black!55] at (0.58,0.42) {$F_0$}; \node[font=\footnotesize, black!55] at (0.62,1.62) {$F_1$}; \node[font=\footnotesize, black!55] at (1.62,0.42) {$F_2$}; \node[font=\footnotesize, black!55] at (1.62,1.62) {$F_3$}; % Homology cycle indicators (cleanly offset from edges) \draw[red!75!black, thick, -{Stealth}] (0.14,1.15) -- (1.86,1.15) node[pos=0.80, above=1pt, font=\footnotesize] {$C_0$}; \draw[teal!75!black, thick, -{Stealth}] (0.15,0.14) -- (0.15,1.86) node[pos=0.84, right=1pt, font=\footnotesize] {$C_1$}; % Vertices \node[vnode] at (0,0) {2}; \node[vnode] at (1,0) {3}; \node[vnode] at (0,1) {1}; \node[vnode] at (1,1) {0}; \node[ghostv] at (2,0) {2}; \node[ghostv] at (2,1) {1}; \node[ghostv] at (0,2) {2}; \node[ghostv] at (1,2) {3}; \node[ghostv] at (2,2) {2}; \end{tikzpicture} \\[6pt] {\small (a) Embedding on the torus} & {\small (b) Fundamental domain $[0,2]^2$} \end{tabular} \caption{The $2 \times 2$ periodic square grid $\Gamma$ on the torus: (a)~embedded directly on the torus surface (dashed arcs pass behind the tube), and (b)~unfolded onto the fundamental domain $[0,2]^2$ (opposite dashed edges are identified). Thick blue edges form the spanning tree $T$ fixed in Step~2. The curves $C_0$ (horizontal, through $1$ and $0$) and $C_1$ (vertical, through $2$ and $1$) form the standard homology basis.} \label{fig:torus} \end{figure} \paragraph{Exact number of perfect matchings.} Every perfect matching of $\Gamma$ either pairs $\{0,1\}$ and $\{2,3\}$ ($2 \times 2 = 4$ choices of parallel edges) or pairs $\{0,3\}$ and $\{1,2\}$ ($2 \times 2 = 4$ choices). Thus the exact number of perfect matchings is \[ Z = 4 + 4 = 8. \] \paragraph{Applying Zecchina's algorithm (Steps~1--6 of~\cite{zecchina2001}).} We now follow Section~2.2 of~\cite{zecchina2001} step by step: \begin{enumerate}[leftmargin=1.8em] \item[\textbf{1--2.}] \textbf{Orientation and gauge fixing.} Assign a binary orientation to each of the $8$ edges. Using the gauge group, arbitrarily fix the $N-1 = 3$ edges of the spanning tree $T = \{h_{01}^{\text{in}},\, v_{12}^{\text{in}},\, h_{23}^{\text{in}}\}$ as \[ h_{01}^{\text{in}}: 0 \to 1 \text{ (left)}, \qquad v_{12}^{\text{in}}: 1 \to 2 \text{ (down)}, \qquad h_{23}^{\text{in}}: 2 \to 3 \text{ (right)}. \] \item[\textbf{3.}] \textbf{Kasteleyn's conditions.} Every face must have an odd number of clockwise-oriented edges (equivalently, since all faces are $4$-cycles, an odd number of counter-clockwise edges). On face $F_0$, three edges are already oriented counter-clockwise ($0\to 1$, $1\to 2$, $2\to 3$), so $v_{03}^{\text{in}}$ is forced to point $0 \to 3$ (down). Imposing Kasteleyn's condition on the remaining faces $F_1, F_2, F_3$ leaves $2g = 2$ binary degrees of freedom and yields exactly $2^{2g} = 4$ Kasteleyn orientations $\Phi_0, \Phi_1, \Phi_2, \Phi_3$, shown in Figure~\ref{fig:orientations}. \begin{figure}[t] \centering \newcommand{\drawsol}[5]{% #1=label, #2=h_out dir (L/R), #3=v_out dir (D/U), #4=h23_out dir (R/L), #5=v03_out dir (D/U) \begin{tikzpicture}[scale=0.92] % Spanning tree (always fixed): h01_in L (1,1)->(0,1), v12_in D (0,1)->(0,0), h23_in R (0,0)->(1,0) \draw[thick, blue!70!black, midarrow] (1,1) -- (0,1); \draw[thick, blue!70!black, midarrow] (0,1) -- (0,0); \draw[thick, blue!70!black, midarrow] (0,0) -- (1,0); % Forced v03_in: D (1,1)->(1,0) \draw[thick, midarrow] (1,1) -- (1,0); % h01_out between (1,1) and (2,1) \ifx#2L \draw[thick, midarrow] (2,1) -- (1,1); \else \draw[thick, midarrow] (1,1) -- (2,1); \fi % h23_out between (1,0) and (2,0) \ifx#4R \draw[thick, midarrow] (1,0) -- (2,0); \else \draw[thick, midarrow] (2,0) -- (1,0); \fi % v12_out between (0,1) and (0,2) \ifx#3D \draw[thick, midarrow] (0,2) -- (0,1); \else \draw[thick, midarrow] (0,1) -- (0,2); \fi % v03_out between (1,1) and (1,2) \ifx#5D \draw[thick, midarrow] (1,2) -- (1,1); \else \draw[thick, midarrow] (1,1) -- (1,2); \fi % Identified top & right boundary copies (dashed with matching arrows) \draw[dashed, black!45, midarrow] (0,2) -- (1,2); \ifx#4R \draw[dashed, black!45, midarrow] (1,2) -- (2,2); \else \draw[dashed, black!45, midarrow] (2,2) -- (1,2); \fi \draw[dashed, black!45, midarrow] (2,1) -- (2,0); \ifx#3D \draw[dashed, black!45, midarrow] (2,2) -- (2,1); \else \draw[dashed, black!45, midarrow] (2,1) -- (2,2); \fi \node[vnode] at (0,0) {2}; \node[vnode] at (1,0) {3}; \node[vnode] at (0,1) {1}; \node[vnode] at (1,1) {0}; \node[ghostv] at (2,0) {2}; \node[ghostv] at (2,1) {1}; \node[ghostv] at (0,2) {2}; \node[ghostv] at (1,2) {3}; \node[ghostv] at (2,2) {2}; \node[font=\small] at (1,-0.55) {#1}; \end{tikzpicture}% } \drawsol{$\Phi_0$ (symmetric)}{L}{D}{R}{D}\hfill \drawsol{$\Phi_1$}{R}{D}{L}{D}\hfill \drawsol{$\Phi_2$}{L}{U}{R}{U}\hfill \drawsol{$\Phi_3$}{R}{U}{L}{U} \caption{The four Kasteleyn orientations of $\Gamma$ compatible with the spanning tree $T$ (blue). Every square face has an odd number ($1$ or $3$) of clockwise arrows. Note that $\Phi_0$ is the translation-invariant (``most symmetric'') orientation.} \label{fig:orientations} \end{figure} For each orientation $\Phi_k$, let $A^{(k)}$ be the $4 \times 4$ skew-symmetric adjacency matrix where an edge oriented from $i$ to $j$ contributes $+1$ to $A^{(k)}_{ij}$ and $-1$ to $A^{(k)}_{ji}$ (parallel edges sum). Recall that for a $4 \times 4$ skew-symmetric matrix, $\Pf(A) = A_{01}A_{23} - A_{02}A_{13} + A_{03}A_{12}$. The four matrices and their Pfaffians are: \begin{align*} A^{(0)} &= \begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{pmatrix}, & \Pf(A^{(0)}) &= 0, & A^{(1)} &= \begin{pmatrix} 0 & 2 & 0 & 0 \\ -2 & 0 & 0 & 0 \\ 0 & 0 & 0 & 2 \\ 0 & 0 & -2 & 0 \end{pmatrix}, & \Pf(A^{(1)}) &= +4, \\[4pt] A^{(2)} &= \begin{pmatrix} 0 & 0 & 0 & 2 \\ 0 & 0 & 2 & 0 \\ 0 & -2 & 0 & 0 \\ -2 & 0 & 0 & 0 \end{pmatrix}, & \Pf(A^{(2)}) &= +4, & A^{(3)} &= \begin{pmatrix} 0 & 2 & 0 & 2 \\ -2 & 0 & 2 & 0 \\ 0 & -2 & 0 & 2 \\ -2 & 0 & -2 & 0 \end{pmatrix}, & \Pf(A^{(3)}) &= +8. \end{align*} \item[\textbf{4.}] \textbf{Intersection matrix.} Choose the standard homology basis $C_0$ (horizontal cycle through $1,0$) and $C_1$ (vertical cycle through $2,1$), shown in Figure~\ref{fig:torus}. They intersect transversely once (at vertex~$1$), so the $\bmod\,2$ intersection matrix is \[ I = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}. \] \item[\textbf{5--6.}] \textbf{Sign function and Pfaffian expansion.} Step~5 of~\cite{zecchina2001} instructs us to fix a reference orientation $\Phi_0$ (``typically, the most symmetric one''). Here $\Phi_0$ is literally the unique translation-invariant orientation: every vertical arrow points down, top-row arrows point left, and bottom-row arrows point right. Comparing orientations along $C_0$ and $C_1$ against $\Phi_0$ assigns: \[ \Phi_0 \mapsto (0,0), \qquad \Phi_1 \mapsto (1,0), \qquad \Phi_2 \mapsto (0,1), \qquad \Phi_3 \mapsto (1,1). \] Evaluating $Sp(E_\Phi) = \sum_{i 1$}, J. Math. Phys. \textbf{37} (1996) 2796--2814. \bibitem{regge2000} T.~Regge and R.~Zecchina, \emph{Combinatorial and topological approach to the 3D Ising model}, J. Phys. A: Math. Gen. \textbf{33} (2000) 741--761. \bibitem{galluccio1999} A.~Galluccio and M.~Loebl, \emph{On the theory of Pfaffian orientations. I. Perfect matchings and permanents}, Electron. J. Combin. \textbf{6} (1999) \#R6. \bibitem{tesler2000} G.~Tesler, \emph{Matchings in graphs on non-orientable surfaces}, J. Combin. Theory Ser. B \textbf{78} (2000) 198--231. \bibitem{cimasoni2007} D.~Cimasoni and N.~Reshetikhin, \emph{Dimers on surface graphs and spin structures. I}, Commun. Math. Phys. \textbf{275} (2007) 187--208. \end{thebibliography} \end{document}