In graph theory, a Pfaffian orientation of an undirected graph is an orientation (an assignment of a direction to each edge of the graph) in which every even central cycle is oddly oriented. In this definition, a cycle is even if it contains an even number of edges. is central if the subgraph of formed by removing all the vertices of has a perfect matching; central cycles are also sometimes called alternating circuits. And is oddly oriented if each of the two orientations of is consistent with an odd number of edges in the orientation.
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 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 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.
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 -minor-free graph has a Pfaffian orientation. These are the graphs that do not have the utility graph (which is not Pfaffian) as a graph minor. By Wagner's theorem, the -minor-free graphs are formed by gluing together copies of planar graphs and the complete graph along shared edges. The same gluing structure can be used to obtain a Pfaffian orientation for these graphs.
Along with , 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.