# Pfaffian orientation

In graph theory, a Pfaffian orientation of an undirected graph assigns a direction to each edge, so that certain cycles (the "even central cycles") have an odd number of edges in each direction. When a graph has a Pfaffian orientation, the orientation can be used to count the perfect matchings of the graph. This is the main idea behind the FKT algorithm for counting perfect matchings in planar graphs, which always have Pfaffian orientations. More generally, every graph that does not have the utility graph $K_{3,3}$ as a graph minor has a Pfaffian orientation, but $K_{3,3}$ does not, nor do infinitely many other minimal non-Pfaffian graphs.

## Definitions

A Pfaffian orientation of an undirected graph is an orientation in which every even central cycle is oddly oriented. The terms of this definition have the following meanings:
* An orientation is an assignment of a direction to each edge of the graph.
* A cycle $C$ is even if it contains an even number of edges.
* A cycle $C$ is central if the subgraph of $G$ formed by removing all the vertices of $C$ has a perfect matching; central cycles are also sometimes called alternating circuits.
* Cycle $C$ is oddly oriented if each of the two orientations of $C$ is consistent with an odd number of edges in the orientation.

## Application to counting matchings

Pfaffian orientations have been studied in connection with the FKT algorithm for counting the number of perfect matchings in a given graph. In this algorithm, the orientations of the edges are used to assign the values $\pm 1$ to the variables in the Tutte matrix of the graph. Then, the Pfaffian of this matrix (the square root of its determinant) gives the number of perfect matchings. Each perfect matching contributes $\pm 1$ to the Pfaffian regardless of which orientation is used; the choice of a Pfaffian orientation ensures that these contributions all have the same sign as each other, so that none of them cancel. This result stands in contrast to the much higher computational complexity of counting matchings in arbitrary graphs.

## Pfaffian graphs

A graph is said to be Pfaffian if it has a Pfaffian orientation. Every planar graph is Pfaffian. An orientation in which each face of a planar graph has an odd number of clockwise-oriented edges is automatically Pfaffian. Such an orientation can be found by starting with an arbitrary orientation of a spanning tree of the graph. The remaining edges, not in this tree, form a spanning tree of the dual graph, and their orientations can be chosen according to a bottom-up traversal of the dual spanning tree in order to ensure that each face of the original graph has an odd number of clockwise edges.
More generally, every $K_{3,3}$-minor-free graph has a Pfaffian orientation. These are the graphs that do not have the utility graph $K_{3,3}$ (which is not Pfaffian) as a graph minor. By Wagner's theorem, the $K_{3,3}$-minor-free graphs are formed by gluing together copies of planar graphs and the complete graph $K_{5}$ along shared edges. The same gluing structure can be used to obtain a Pfaffian orientation for these graphs.
Along with $K_{3,3}$, there are infinitely many minimal non-Pfaffian graphs. For bipartite graphs, it is possible to determine whether a Pfaffian orientation exists, and if so find one, in polynomial time.