The FKT algorithm, named after
Fisher,
Kasteleyn, and
Temperley, counts the number of
perfect matching
In graph theory, a perfect matching in a graph is a matching that covers every vertex of the graph. More formally, given a graph , a perfect matching in is a subset of edge set , such that every vertex in the vertex set is adjacent to exactly ...
s in a
planar graph in polynomial time. This same task is
#P-complete for general graphs. For
matchings that are not required to be perfect, counting them remains #P-complete even for planar graphs. The key idea of the FKT algorithm is to convert the problem into a
Pfaffian computation of a
skew-symmetric matrix derived from a planar embedding of the graph. The Pfaffian of this matrix is then computed efficiently using standard
determinant algorithms.
History
The problem of counting planar perfect matchings has its roots in
statistical mechanics and
chemistry, where the original question was: If
diatomic molecule
Diatomic molecules () are molecules composed of only two atoms, of the same or different chemical elements. If a diatomic molecule consists of two atoms of the same element, such as hydrogen () or oxygen (), then it is said to be homonuclear. Ot ...
s are adsorbed on a surface, forming a single layer, how many ways can they be arranged? The
partition function is an important quantity that encodes the statistical properties of a system at equilibrium and can be used to answer the previous question. However, trying to compute the partition function from its definition is not practical. Thus to exactly solve a physical system is to find an alternate form of the partition function for that particular physical system that is sufficiently simple to calculate exactly. In the early 1960s, the definition of ''exactly solvable'' was not rigorous.
Computer science provided a rigorous definition with the introduction of
polynomial time
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
, which dates to 1965. Similarly, the notation of not ''exactly solvable'', for a
counting problem such as this one, should correspond to
#P-hardness, which was defined in 1979.
Another type of physical system to consider is composed of
dimers, which is a polymer with two atoms. The dimer model counts the number of dimer coverings of a graph. Another physical system to consider is the bonding of
H2O molecules in the form of ice. This can be modelled as a directed, 3-
regular
The term regular can mean normal or in accordance with rules. It may refer to:
People
* Moses Regular (born 1971), America football player
Arts, entertainment, and media Music
* "Regular" (Badfinger song)
* Regular tunings of stringed instrum ...
graph where the orientation of the edges at each vertex cannot all be the same. How many edge orientations does this model have?
Motivated by physical systems involving dimers, in 1961, Kasteleyn and Temperley and Fisher independently found the number of
domino tilings for the ''m''-by-''n'' rectangle. This is equivalent to counting the number of perfect matchings for the ''m''-by-''n''
lattice graph. By 1967, Kasteleyn had generalized this result to all planar graphs.
Algorithm
Explanation
The main insight is that every non-zero term in the
Pfaffian of the
adjacency matrix
In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
In the special case of a finite simple ...
of a graph ''G'' corresponds to a perfect matching. Thus, if one can find an
orientation
Orientation may refer to:
Positioning in physical space
* Map orientation, the relationship between directions on a map and compass directions
* Orientation (housing), the position of a building with respect to the sun, a concept in building desi ...
of ''G'' to align all signs of the terms in
Pfaffian (no matter ''+'' or ''-'' ), then the absolute value of the
Pfaffian is just the number of perfect matchings in ''G''. The FKT algorithm does such a task for a planar graph ''G''. The orientation it finds is called a
Pfaffian orientation.
Let ''G'' = (''V'', ''E'') be an undirected graph with
adjacency matrix
In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
In the special case of a finite simple ...
''A''. Define ''PM''(''n'') to be the set of partitions of ''n'' elements into pairs, then the number of perfecting matchings in ''G'' is
:
Closely related to this is the
Pfaffian for an ''n'' by ''n'' matrix ''A''
:
where sgn(''M'') is the
sign of the permutation ''M''. A Pfaffian orientation of ''G'' is a directed graph ''H'' with
adjacency matrix
In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
In the special case of a finite simple ...
''B'' such that pf(''B'') = PerfMatch(''G''). In 1967, Kasteleyn proved that planar graphs have an efficiently computable Pfaffian orientation. Specifically, for a planar graph ''G'', let ''H'' be a directed version of ''G'' where an odd number of edges are oriented clockwise for every face in a planar embedding of ''G''. Then ''H'' is a Pfaffian orientation of ''G''.
Finally, for any
skew-symmetric matrix ''A'',
:
where det(''A'') is the
determinant
In mathematics, the determinant is a scalar value that is a function of the entries of a square matrix. It characterizes some properties of the matrix and the linear map represented by the matrix. In particular, the determinant is nonzero if ...
of ''A''. This result is due to
Cayley. Since
determinants are efficiently computable, so is PerfMatch(''G'').
High-level description

# Compute a planar
embedding
In mathematics, an embedding (or imbedding) is one instance of some mathematical structure contained within another instance, such as a group that is a subgroup.
When some object X is said to be embedded in another object Y, the embedding is giv ...
of ''G''.
# Compute a
spanning tree
In the mathematical field of graph theory, a spanning tree ''T'' of an undirected graph ''G'' is a subgraph that is a tree which includes all of the vertices of ''G''. In general, a graph may have several spanning trees, but a graph that is no ...
''T''
1 of the input graph ''G''.
# Give an arbitrary orientation to each edge in ''G'' that is also in ''T''
1.
# Use the planar embedding to create an (undirected) graph ''T''
2 with the same vertex set as the
dual graph of ''G''.
# Create an edge in ''T''
2 between two vertices if their corresponding faces in ''G'' share an edge in ''G'' that is not in ''T''
1. (Note that ''T''
2 is a tree.)
# For each leaf ''v'' in ''T''
2 (that is not also the root):
## Let ''e'' be the lone edge of ''G'' in the face corresponding to ''v'' that does not yet have an orientation.
## Give ''e'' an orientation such that the number of edges oriented clock-wise is odd.
## Remove ''v'' from ''T''
2.
# Return the absolute value of the
Pfaffian of the
adjacency matrix
In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
In the special case of a finite simple ...
of ''G'', which is the square root of the determinant.
Generalizations
The sum of weighted perfect matchings can also be computed by using the
Tutte matrix In graph theory, the Tutte matrix ''A'' of a graph ''G'' = (''V'', ''E'') is a matrix used to determine the existence of a perfect matching: that is, a set of edges which is incident with each vertex exactly once.
If the set of ...
for the adjacency matrix in the last step.
Kuratowski's theorem states that
: a
finite graph is planar
if and only if
In logic and related fields such as mathematics and philosophy, "if and only if" (shortened as "iff") is a biconditional logical connective between statements, where either both statements are true or both are false.
The connective is bi ...
it contains no
subgraph homeomorphic to ''K''
5 (
complete graph
In the mathematical field of graph theory, a complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge. A complete digraph is a directed graph in which every pair of distinct vertices ...
on five vertices) or ''K''
3,3 (
complete bipartite graph
In the mathematical field of graph theory, a complete bipartite graph or biclique is a special kind of bipartite graph where every vertex of the first set is connected to every vertex of the second set..Electronic edition page 17.
Graph theory ...
on two partitions of size three).
Vijay Vazirani generalized the FKT algorithm to graphs that do not contain a subgraph homeomorphic to ''K''
3,3. Since counting the number of perfect matchings in a general graph is
#P-complete, some restriction on the input graph is required unless
FP, the function version of
P, is equal to
#P. Counting matchings, which is known as the
Hosoya index, is also #P-complete even for planar graphs.
Applications
The FKT algorithm has seen extensive use in
holographic algorithms on planar graphs via
matchgates.
[ For example, consider the planar version of the ice model mentioned above, which has the technical name # PL-3-NAE- SAT (where NAE stands for "not all equal"). Valiant found a polynomial time algorithm for this problem which uses matchgates.]
References
{{reflist
External links
*More history, information, and examples can be found in chapter 2 and section 5.3.2 of Dmitry Kamenetsky'
PhD thesis
Graph algorithms
Planar graphs