<<

Journal of Combinatorial Theory, Series B 78, 198{231 2000

doi:10.1006/jctb.1999.1941,available online at http://www.idealibrary.com on IDEAL.

Matchings in Graphs on Non-orientable Surfaces

Glenn Tesler

Department of Mathematics, University of California, San Diego

E-mail: [email protected]

Received Decemb er 10, 1998

P.W. Kasteleyn stated that the numb er of p erfect matchings in a graph

g

emb edding on a surface of genus g is given by a linear combination of 4 Pfaf-

ans of mo di ed adjacency matrices of the graph, but didn't actually give the

matrices or the linear combination. We generalize this to enumerating the

p erfect matchings of a graph emb edding on an arbitrary compact b oundary-

2 S 

less 2-manifold S with a linear combination of 2 Pfaans. Our explicit

construction proves Kasteleyn's assertion, and additionally treats graphs em-

b edding on non-orientable surfaces. If a graph emb eds on the connected sum

of a genus g surface with a pro jective plane resp ectively, Klein b ottle, the

2g +1

numb er of p erfect matchings can b e computed as a linear combination of 2

2g+2

resp ectively,2  Pfaans. We also intro duce \crossing orientations," the

analogue of Kasteleyn's \admissible orientations" in our context, describing

how the Pfaan of a signed of a graph gives the sign of each

p erfect according to the numb er of edge-crossings in the matching.

Finally,we count the p erfect matchings of an m  n grid on a Mobius strip.

Key Words : Kasteleyn, p erfect matching, dimer, graph, Pfaan.

1. INTRODUCTION

In [4] and [5], Kasteleyn counts the numb er of p erfect matchings in an

undirected planar graph by orienting its edges in a certain fashion and

showing that the Pfaan of a \signed" adjacency matrix of this orientation

~

equals the numb er of p erfect matchings. If G is an orientation of the

graph G, the Pfaan of the antisymmetric matrix with comp onents a =

uv

~

a = 1 when u; v  2 V  G, 0 otherwise, has one term equalling 1

vu

for each p erfect matching of G, but the signs mayvary. For a sp eci c

planar emb edding of a graph, Kasteleyn gives an algorithm for constructing

an \admissible orientation" for which all the signs are the same, thereby

giving the prop er enumeration. He gives a graph-theoretic characterization

of admissible orientations, indep endent of the emb edding. He also counts

the p erfect matchings in an m  n grid emb edding on a torus by computing a 1

2 GLENN TESLER

linear combination of four Pfaans of signed adjacency matrices of various

orientations of the graph. In [6], he sketches how this could b e extended to

a large class of graphs emb edding on a surface of genus g and states that the

numb er of p erfect matchings could b e computed with a linear combination

g 2g

of 4 =2 Pfaans, but do es not explicitly showhow to construct the

orientations or the co ecients of the linear combination.

We present an explicit construction of formulas to compute the number

of p erfect matchings in nite graphs emb edding in non-planar surfaces.

Our construction also leads to a further result ab out graphs emb edding on

non-orientable compact surfaces. If a graph emb eds on the connected sum

of genus g surface with a pro jective plane resp ectively, Klein b ottle, the

numb er of p erfect matchings can b e computed as a linear combination of

2g +1 2g+2

2 resp ectively,2  Pfaans. Together with orientable surfaces of

genus g , these comprise all the compact b oundaryless 2-manifolds.

In Section 2, we review Kasteleyn's metho d of enumerating p erfect match-

ings in planar graphs, and the characterization of admissible orientations.

In Section 3, we describ e the complications that arise in a non-planar graph,

and describ e crossing orientations: for an arbitrary graph drawn in the

plane with crossing edges, the terms of the Pfaan are still in one-to-one

corresp ondence with the p erfect matchings, but there is generally no edge-

orientation for which they have the same sign; however, an orientation can

b e constructed in which the sign dep ends on the numb er of pairs of crossing

edges in a matching. In Section 4, we describ e how to take a graph that

emb eds without edge-crossings on a 2-dimensional compact b oundaryless

manifold S , and then draw it in the plane with edge-crossings organized

according to the structure of S .We also state the rule for constructing a

crossing orientation of such a drawing, but we leave the detailed pro of of

the construction as well as a general construction applicable to non-planar

graphs drawn in some other fashion to Section 6. In Section 5, we give

explicit formulas to enumerate the p erfect matchings in a graph emb ed-

ding on a surface S . In Section 7, we apply these techniques to compute

the numb er of p erfect matchings in a grid on a Mobius strip, in analogy

to Kasteleyn's grids in the plane and the torus. Finally, in the App endix,

we give an algorithm for computing Pfaans; for replacing Pfaans by

determinants when using bipartite graphs; and an alternate formula for

enumerating p erfect matchings, in which the linear combination of a num-

b er of Pfaans of numeric matrices is replaced by a single Pfaan of a

matrix with symb olic entries.

Following submission of this pap er, the article [2] app eared in which

Galluccio and Lo ebl also solve the problem of enumerating p erfect match-

ings in graphs emb edding on orientable compact surfaces. The results here

were discovered indep endently; a comparison has b een added to the end of Section 5.

MATCHINGS IN NON-PLANAR GRAPHS 3

2. ENUMERATING WEIGHTED PERFECT MATCHINGS

ON PLANAR GRAPHS

Let G b e an undirected graph on the vertex set f1;:::;2pg, with a nite

numb er of edges. We allow each edge fu; v g to haveaweight W , such

fu;v g

as a complex number or a variable; to work in the context of unweighted

graphs, set these weights to 1 for all edges, and 0 for vertex pairs that are

not edges.

~

Let G b e an orientation of G. Let a = a = 0 when fu; v g is not

uv vu

an edge, or a = a = W b e the weight of the directed edge

uv vu

fu;v g

~

u; v . A =[a ] is the signed adjacency matrix of G, and is related to the

uv

t

~

ordinary directed weighted adjacency matrix B of G via A = B B . A is

an antisymmetric 2p  2p matrix.

We review the Pfaan of a matrix. See [7, p. 317] for further details

in this context. Let A bea2p2pantisymmetric matrix. Let m =

ffu ;v g;:::;fu ;v gg range over the partitions of f1;:::;2pg into p sets

1 1 p p

of size 2, and de ne the signed weight of m as

1 2  2p 1 2p

w = sign  a a 1

m u ;v u ;v

1 1 p p

u v  u v

1 1 p p

where the sign is of a p ermutation expressed in 2-line notation. Note that

reversing the order of elements in a pair to v ;u do es not a ect the value

k k

of w b ecause it negates the p ermutation sign and also negates a matrix

m

element, while p ermuting the order of the pairs do es not change the sign of

p

the p ermutation or of w ;any of the 2 p! representations of m will give

m

an equivalent result. The Pfaan of A is de ned as

X

Pf A = w : 2

m

m

Up to sign, the Pfaan may b e computed by the formula

2

Pf A = det A 3

and since determinants are eciently computable byrow reduction, Pfaf-

ans are as well; see App endix A.1.

A perfect matching of G is a partition m of its 2p vertices into p edges

~

of G. Take A to b e the signed adjacency matrix of G. When m is a

partition that is not a p erfect matching, w = 0, so the nonzero terms

m

of 2 corresp ond to the p erfect matchings of G.We call w the signed

m

weight of the p erfect matching m.Wemay write w =  W , where the

m m m

unsigned weight of m is

Y

W = W ; 4

m

fu;v g

fu;v g2m

4 GLENN TESLER

and the sign of m is

~

1 2  2p 1 2p

 edges oriented v ;u inG

k k

 = sign  1 :

m

u v  u v

1 1 p p

5

Relab eling the vertices causes the rows and columns of A to b e simultane-

ously p ermuted, and changes the sign of all p erfect matchings by the sign

of that p ermutation.

There is a combinatorial interpretation of 3 in the context of p erfect

matchings. Consider the expansion

X

det A = sign   a a :::a a a :::a  6

j ;j j ;j j ;j k ;k k ;k k ;k

1 2 2 3 s 1 1 2 2 3 t 1



where we use the cycle notation  =j;j ;:::;j k ;k ;:::;k  as

1 2 s 1 2 t

 runs over p ermutations in S .To b e canonical, we assume j ;k ;:::

2p 1 1

are the largest numb ers in their resp ective cycles, and j

1 1

0

If any cycles of  have of o dd length, let  b e the p ermutation ob-

0

tained on reversing the rst such cycle. The  and  terms cancel b e-

cause the p ermutations have the same sign, but an o dd numberofthe

factors a have b een negated, so overall these two terms have opp osite

uv

signs. Now supp ose all cycles of  haveeven length. Then the p er-

fect matchings m = ffj ;j g;fj ;j g;:::;fj ;j g;fk ;k g;:::g and

1 2 3 4 s1 s 1 2

0

0

m = ffj ;j g;fj ;j g;:::;fj ;j g;fk ;k g;:::g have w w equal to

2 3 4 5 s 1 2 3 m m

the  term of 6. This is reversible, so pairs of partitions of f1;:::;2pg

into p sets of size 2 are in bijective corresp ondence with p ermutations hav-

0

ing only even length cycles. The p ermutation  =  m; m  corresp onding

0

to m; m consists of superposition cycles, so named b ecause its cycles are

formed by sup erimp osing the two p erfect matchings. If we only count terms

of nonzero weight, this corresp ondence is a bijection b etween pairs of p er-

fect matchings and p ermutations consisting only of sup erp osition cycles.

Note that \sup erp osition cycles" refers b oth to the p ermutation cycles

j ;j ;:::;j ;::: and to the graph cycles along the edges through these

1 2 s

vertices.

Kasteleyn formulated an algorithm to orient the edges of an undirected

planar graph G so that all p erfect matchings have w = W or they all

m m

have w = W . Since p erfect matchings are all counted with the same

m m

sign, the total unsigned weight of all p erfect matchings in G equals j Pf Aj.

First he characterizes all orientations that have this prop erty.

R1 An admissible orientation [6, p. 92] or Pfaan orientation [7, p.

319] of a graph is any orientation of its edges such that in all sup erp osition

cycles, the numb er of edges p ointing in each direction is o dd.

MATCHINGS IN NON-PLANAR GRAPHS 5

It is not always p ossible to construct such an orientation, but when it is

p ossible, Kasteleyn proved the following.

~

Theorem 2.1. If G is an admissible orientation of G, then al l perfect

matchings have the same sign. Conversely, if al l perfect matchings have

~

the same sign in some orientation G, it is an admissible orientation.

Kasteleyn found a rule to construct an admissible orientation of a planar

graph. It is easier to use than R1 and implies R1.

R2 [6, p. 93] A planar graph can b e oriented so that around each face,

the numb er of edges p ointing clo ckwise is o dd.

Note that R1 dep ends only on the top ology of the graph, while R2

dep ends on the sp eci c emb edding of it in the plane.

~

An orientation R2 G of the undirected graph G may b e constructed in

p olynomial time by the following algorithm. Orient the edges of a spanning

subgraph of G arbitrarily.Traverse the remaining edges of G in an order

that forms at most one face at a time not counting the in nite face. As

a face is formed, orient the new edges so that the face has an o dd number

of edges p ointing clo ckwise around it. This construction has the following

prop erty that immediately implies R1.

Lemma 2.1. [6, p. 93] Let G be a planar graph oriented by R2. In

every closed cycle, the number of edges oriented clockwise along the cycle

is opposite in parity to the number of vertices enclosed in the region of the

plane inside the cycle.

This implies R1 b ecause any sup erp osition cycle must enclose an even

numberofvertices, since they cannot b e matched with vertices in the region

outside the cycle.

3. NON-PLANAR GRAPHS

Nowwe consider the problem of enumerating p erfect matchings in an

arbitrary nite graph. Fix once and for all a drawing of the graph G in

the plane. Edges may cross each other at non-vertex p oints. For any

cycle C in the graph, and vertex v not along the cycle, the question of

whether v is inside or outside C may b e complicated by C having crossing

edges. Wesay that v is inside C if the winding number of C around v is

o dd, and is outside if the winding number is even. Note that it do es not

matter in which direction we traverse C since traversing it the other way

negates the winding numb er but do es not a ect its parity.Every vertex

is inside, outside, or along C , and the total numberofvertices inside C is

denoted C . See Figure 1. Here we view the plane as the complex plane

6 GLENN TESLER

  4    6 2         1   3

5

FIG. 1. Since the cycle C =1;:::;6 crosses itself, it divides the plane into several

regions; the dark ones are \inside" and the white ones are \outside." The cycle has

6vertices on it, C  = 3 inside, and 4 outside. There are  C  = 4 mono chromatic

e

edge-crossings, and r C  = 2 edges routed the wrong way.

and co ordinatize the drawing of the graph accordingly; if C is drawn as a

piecewise-di erentiable curve, the winding number is

I

1 dz

7

2i z v

C

and more generally, it is determined by the element that C represents

in the fundamental group of the punctured complex plane C z see [8,

p. 3476a].

In our xed drawing of G, let m b e a p erfect matching, and mbe

the numb er of times edges in it cross. If edges are drawn so as to cross

themselves or to cross each other multiple times, m should include this

multiplicity.Ifkedges pass through the same non-vertex p oint, the sep-



k

arate pairs form crossings. Now consider any sup erp osition cycle C

2

0

formed by sup erimp osing two p erfect matchings m and m . Color the

0

edges of C from m black, and the edges from m white. Let  C  de-

e

note the number of monochromatic crossings among edges of C , that is,

crossings b etween edges an even distance apart along the cycle. Again,

this should b e counted with multiplicity if appropriate. Edges not in C

0

are not included in this count. If C has length 2 b ecause m and m b oth

share a common edge, it is traversed once as a black edge fu; v g and then

once as a white edge fv; ug,soevery crossing is actually counted twice in

 C , giving  C  0 mo d 2. Also in this case, no vertices are inside

e e

C ,so C = 0. See Section 6.2 for further discussion of complications in

counting crossings.

MATCHINGS IN NON-PLANAR GRAPHS 7

The routing number r C  of a cycle C =v ;:::;v  is the number of

1 s

edges oriented opp osite to the direction we traverse the cycle:

~

r C = fv ;v ;v ;v ;:::;v ;v ;v ;v g\EG : 8

2 1 3 2 s s1 1 s

Although G is undirected, we need to traverse C one direction or the other;

the direction is known b ecause C comes from a p ermutation, or by sp ecify-

ing clo ckwise or counterclo ckwise, etc. For even length cycles such as all

sup erp osition cycles, the two routings r v ;:::;v  and r v ;:::;v have

1 s s 1

the same parity b ecause the numb er of edges p ointing one way, plus the

numb er p ointing the other way, is the even number s. A cycle is clock-

wise odd [6, p. 92] when it has an o dd numb er of edges p ointing along it

when traversed clo ckwise. Equivalently, r C  is o dd when C is traversed

counterclo ckwise. Rule R1 requires r C  to b e o dd for all sup erp osition

cycles, and by Lemma 2.1, rule R2 requires r C  and C tohave op-

p osite parity when C is any counterclo ckwise cycle including ones of o dd

length. Theorem 2.1 is a consequence of the following prop erty of routing

numb ers.

0 0

Lemma 3.1. Let m and m beperfect matchings. Let  =  m; m =

j ;:::;j k ;:::;k  be the permutation formed as their superposition.

1 s 1 t

Then

Y

r C +1

0

  = 1 9

m m

C 2

where C runs over the cycles of  .

Proof. In 6, the  term is

0

w w = sign   a a :::a a a :::a 

m m j ;j j ;j j ;j k ;k k ;k k ;k

1 2 2 3 s 1 1 2 2 3 t 1

0 0

=   W W : 10

m m m m

The cycles of  are sup erp osition cycles, so they all haveeven length, and

each contributes a factor 1 to sign  . Within a cycle, say the rst, the

matrix elements are the negative of the edge-weight when they are oriented

opp osite to the direction the cycle is traversed, so

r j ;j ;:::;j 

1 2 s

a a :::a =1 w w :::w : 11

j ;j j ;j j ;j j ;j j ;j j ;j

1 2 2 3 s 1 1 2 2 3 s 1

r C +1

Thus each cycle C contributes a sign 1 , and the total contribution

from all cycles is given by 9.

8 GLENN TESLER

In a non-planar graph, the notions of clo ckwise or counterclo ckwise rout-

ing of edges in a cycle do not make sense if the cycle has crossing edges.

Also, vertices inside a cycle can b e matched with vertices outside the cycle,

so a cycle needn't enclose an even numberofvertices. We require alterna-

tives to R1 and R2. The following condition R3 generalizes R1 to

an arbitrary graph, and an algorithm R4 in the next section generalizes

R2.

R3 A crossing orientation of a graph is an orientation in which for every

sup erp osition cycle, the numb er of edges p ointing along it in one direction

has opp osite parity to the numb er of mono chromatic crossings among the

edges of the cycle plus the number of vertices in the plane regions inside

the cycle. Equivalently, r C +  C+ Cisodd.

e

Unlike an admissible orientation R1, a crossing orientation can always

b e constructed; this will b e shown in Section 6. For planar emb eddings

of graphs, crossing orientations and admissible orientations are equivalent,

since all sup erp osition cycles have  C = 0and Ceven, requiring r C 

e

to b e o dd for b oth R1 and R3. Unlike admissible orientations, whether

an orientation is a crossing orientation dep ends on how the graph is drawn

in the plane: deforming an edge to cross itself, or to moveitpasta vertex,

will change the parityof C+ C.

e

Wehave named these crossing orientations b ecause they p ermit us to

determine the parity of the numb er of crossings in a p erfect matching.

Theorem 3.1. a A graph may be oriented so that every perfect match-

ing has sign

m

 =   1 12

m 0

where  = 1 is constant;  may be interpreted as the sign of a perfect

0 0

matching with no crossing edges when such exists.

b An orientation of a graph satis es a if, and only if, it is a crossing

orientation.

See Section 6 for the detailed pro of. Kasteleyn [6, p. 99] states that an

orientation with prop erty a exists, but this explicit characterization b

is new.

4. EMBEDDING GRAPHS ON SURFACES, AND PLANE

MODELS OF SURFACES

Let S be a two dimensional surface. The graph G emb eds in S if it can

b e drawn on S without any edges crossing. Although we will enumerate

p erfect matchings in graphs emb edding in non-planar surfaces, this will

MATCHINGS IN NON-PLANAR GRAPHS 9

b e accomplished by drawing G in the plane with the edges crossing in a

systematic fashion dictated by the structure of S .We still require that only

the endp oints, not the interiors, of edges b e incident with vertices, but we

allow edges to cross each other at non-vertex p oints.

Any compact b oundaryless 2-dimensional surface S can b e represented

in the plane bya plane model [1, p. 32] also called a pasting map [9,p.

16]. Drawa2nsided p olygon P or other non-intersecting closed curve

with 2n segments marked o , and intro duce symb ols a ;:::;a .Form

1 n

0 0

n pairs of sides p ;p , j =1;:::;n.Paste together p and p . Any S

j j

j j

0

can b e represented by a suitable p olygon and pastings. If p and p are

j

j

pasted together by traversing P clo ckwise along b oth, then place the lab el

0

a along b oth p and p , and say that S is j -nonoriented. If they are

j j

j

pasted by traversing P clo ckwise along one and counterclo ckwise along the

1

other, lab el the clo ckwise one a , the counterclo ckwise one a , and say

j

j

that S is j -oriented.Form a word  from these 2n symb ols by starting

at any side and reading o the lab els as P is traversed clo ckwise. We

also say that  is j -oriented or j -nonoriented. If the o ccurrences of a

j

1 1

or a are interleaved with the o ccurrences of a or a , suchasin=

k

j

k

1

a a a a ,wesay that  is j; k -alternating; otherwise it

j j k

k

is j; k -nonalternating. This is a prop ertyof, not of S .Pasting can also

b e extended to surfaces with b oundaries by using p olygons with more than

2n sides, of which only n pairs are pasted together. The unpasted sides

are b oundaries of S . Lab el each unpasted side with its own symb ol. In the

ensuing discussion, these lab els make no contribution to the computations;

we could contract each of these sides down to a p oint without a ecting

whether a graph emb eds in the resulting surface, so just delete the symb ols

for b oundary sides from  .

The orientable compact b oundaryless surfaces are classi ed up to home-

omorphism by their genus g =0;1;2;:::, while the non-orientable ones are

homeomorphic to the connected sum of genus g surface with either a Klein

b ottle or a pro jective plane, for some g  0. Possible words representing

these surfaces are in Table 1. Other words are also p ossible, and maybe

used if convenient in a particular problem. Note that the number n is re-

lated to the Euler characteristic of the surface by n  2 S , and the

words in the table have n =2 S.

Now takeanemb edding of a graph G on this surface, and draw it within

this plane mo del of the surface. Edges wholly contained inside the p olygon

P do not cross, and are called 0-edges. The edges that go through sides

0

p , p of P are called j -edges. Initially,a j-edge from vertex u to v is

j

j

0

drawn as a curve starting at u, terminating at a p oint u somewhere along

0 0 0

p , resuming at the p oint v identi ed with u on p , and continuing to v ,

j

j

b ecause that is what the plane mo del of S dictates. To extend this drawing

of an emb edding of G in S to a drawing of G in the plane with crossing

10 GLENN TESLER

1-edges

a1 3-edges

a3 a2

a -1 3 a1

-1 a2

2-edges

FIG. 2. A graph that emb eds on the connected sum of a torus with a pro jective

1 1

plane. The surface word  = a a a a a a is 1; 2-alternating and 3-nonoriented.

1 2 3 3

1 2

The 0-edges are drawn as solid lines; the 1, 2, 3-edges cross outside the hexagon P used

to represent the surface. One p ossible crossing orientation given by rule R4 is shown.

MATCHINGS IN NON-PLANAR GRAPHS 11

Surface word  n

Sphere or plane null word 0

Pro jective plane a a 1

1 1

1

Klein b ottle a a a a or a a a a 2

1 1 2 2 1 2 2

1

1 1 1 1

genus g surface a a a a a a a a 

1 2 3 4

1 2 3 4

1 1

a a a a 2g

2g1 2g

2g1 2g

Connected sum of genus g surface with

1 1 1 1

Pro jective plane a a a a  a a a a

1 2 2g1 2g

1 2 2g1 2g

a a 2g +1

2g+1 2g +1

1 1 1 1

Klein b ottle a a a a  a a a a

1 2 2g1 2g

1 2 2g1 2g

a a a a 2g +2

2g+1 2g +1 2g +2 2g +2

TABLE 1.

Words representing surfaces

0 0

edges, we draw in the missing segment of the edge as a curve from u to v

with no self-intersections in the region of the plane outside P . Crossings

may b e formed exterior to P among edges extended in this fashion. See

Figure 2. It p ermissible for an edge to b e b oth a j -edge and a k -edge for

0

j 6= k , and to makemultiple crossings of p and p .

j

j

If S is j -oriented, the j -edges can b e drawn in the plane without crossing

each other and in any case must b e drawn so that each pair crosses an

even numb er of times. If there are N j  j -edges, as we traverse p clo ck-

j

0

wise we encounter them in the order 1; 2;:::;Nj, and as we traverse p

j

clo ckwise, we encounter them in the reverse order, N j ;:::;2;1. Com-

plete the drawing of the edges 1; 2;:::;Njby lo oping around the outside

of P clo ckwise so they do not cross.

If S is j -nonoriented, the j -edges can b e drawn so that every pair of j -

edges crosses exactly once and in any case must b e drawn so that each pair

0

crosses an o dd numb er of times. As we traverse either p or p clo ckwise,

j

j

we encounter the edges in the same order 1; 2;:::;Nj. Complete the

drawing of the edges by lo oping around the outside of P clo ckwise, so that

each pair of edges crosses exactly once.

0

An edge that crosses p , p multiple times should b e counted in N j 

j

j

with multiplicity equal to the numb er of crossings. It is also p ossible for

an edge to b e counted as b oth a j -edge and a k -edge, an so on.

Wemay form a crossing orientation of such a drawing of G as follows,

provided the subgraph of 0-edges is connected; see Figure 2. This is proved

in Section 6.4. If the subgraph of 0-edges is not connected, extra edges

of weight0 may b e added to connect it. A longer metho d that works for

12 GLENN TESLER

all graphs, even without the crossings organized by pastings, is given in

Section 6.

R4 Orient the subgraph of 0-edges so that all its faces are clo ckwise

o dd. Orient each j -edge e j>0 as follows. Ignoring all other non 0-

edges, there is a face formed by e and certain 0-edges along the b oundary

of the subgraph of 0-edges. Orient e so that this face is clo ckwise o dd.

Although all surfaces we consider can b e represented by pastings on a

single p olygon P as we've describ ed, it may b e convenient to representa

surface by pastings on a compact planar region P with a nite number

of holes. The outer p erimeter is a p olygon P . The holes are p olygons

0

P ;:::;P .Pastings o ccur b etween pairs of edges on each p olygon, but not

1 r

from one p olygon to another. The pastings dictate how edges cross in the

region interior to the p olygons P ;:::;P , and exterior to P .Ifa is a

1 r 0 j

lab el placed on an edge of one p olygon, and a is on another p olygon, the

k

j and k -edges never cross each other, so the mo del is j; k -nonalternating.

Rule R4 may b e used as stated to orient graphs drawn in such a plane

mo del. See Figure 10a.

5. ENUMERATING WEIGHTED PERFECT MATCHINGS

ON NON-PLANAR GRAPHS

Let A b e the signed adjacency matrix for a crossing orientation R3

of the graph G, whether constructed by R4 or by the full metho d of

Section 6.

Consider any p erfect matching m in G. Let N j  b e the number of

m

j -edges in m, counted with multiplicity when appropriate. Let C j; k be

m

the numb er of crossings formed byaj-edge with a k -edge. Then mo dulo

2, for 0





N j 

m

if  is j -nonoriented;

2

C j; j  13

m

0 otherwise.

n

N j   N k  if  is j; k -alternating;

m m

C j; k  14

m

0 otherwise.

The total numb er of pairs of crossing edges is

X

C = C j; k  : 15

m m

1j k n

In Pf A,every p erfect matching m is counted with weight

C

m

w =  1 W : 16

m 0 m

MATCHINGS IN NON-PLANAR GRAPHS 13

We will nd a linear combination of Pfaans of di erentweightings of the

graph for which the weightofmis simply  W .

0 m

Intro duce new variables x ;:::;x . Multiply the weights of all j -edges

1 n

by x , use the same crossing orientation as for A on the resulting weighted

j

graph, and let B x ;:::;x  b e the signed adjacency matrix as a function

1 n

of these variables. Call this the x-adjacency matrix.Sob = a when

uv vu

u; v  is not a j -edge for any j 6= 0, while b = a x when fu; v g is a

uv uv j

0

j -edge. If an edge makes s crossings in either direction from p to p , use

j

j

s

b = a x . Ifitisbothaj-edge and a k -edge, use b = a x x , and

uv vu j uv uv j k

so on for similar complications.

4 4

Let f ! ;:::;!  2 C[! ;:::;! ]=1 ! ;:::;1! : in other words,

1 n 1 n 1 n

all exp onents are to b e reduced mo dulo 4 to one of 0; 1; 2; 3.

X

r r

1 n

f = !  ! 17

r ;:::;r 1 n

1 n

0r ;r ;:::;r 3

1 2 n

The f -weight of the p erfect matching m is

N 1 N n

m m

w f =fi ;:::;i w 18

m m

p

1, and the f -weightofGis where i =

X

r r

1 n

Pf B i ;:::;i  19 w f =

r ;:::;r G

1 n

r;r ;:::;r

1 2 n

X X

r N 1 r N n

1 m n m

w  i    i 20 =

r ;:::;r m

1 n

m r ;r ;:::;r

1 2 n

X

= w f  : 21

m

m

We will nd an f for which w f = W for all m.

m 0 m

For 0





1 1

1i 1+i 1i

! + ! = ! + i! if  is j -nonoriented;

j j

j j

2 2 2

L = 22

jj

1 otherwise.





1

2 2 2 2

1+ ! + ! ! ! if  is j; k -alternating;

j k j k

2

L = 23

jk

1 otherwise.

These p olynomials dep end only on  , j , and k , not on any p erfect matching.

On multiplying f by them, the weights of di erent p erfect matchings change

in a manner dep ending on the numb er of crossings they contain. The

p olynomial 23 generalizes the linear combination of Pfaans Kasteleyn

used to compute p erfect matchings on a torus [4], while 22 is new, and

allows computing p erfect matchings on a non-orientable surface.

14 GLENN TESLER

Lemma 5.1.

C j;j 

m

a w L f =1 w f 

m jj m

24

C j;k 

m

b w L f =1 w f 

m jk m

Proof. a If  is j -oriented, then C j; j  0 mo d 2 and L =1,

m jj

so a holds.

So supp ose  is j -nonoriented. Multiplying the weights of the j -edges

byanumber results in the weight of this matching b eing multiplied by

N j 

m

,sowehave

r rN j

m

w ! f=i w f : 25

m j m

Thus,

1+i 1i

N j N j

m m

i + i  w f : 26 w L f =

m m jj

2 2

It is readily veri ed that



N

1+ i 1 i

1 if N 0 or 1 mo d 4;

N N

 

2

i + i = 1 = 27

1ifN 2 or 3 mo d 4,

2 2

so a holds by 13.

b If  is not j; k -alternating, then C j; k  0 and L =1,sob

m jk

holds.

If  is j; k -alternating, then

1

N j  N k  N j +N k 

m m m m

w L f = 1+ 1 +1 1 w f  :

m jk m

2

28

It is readily veri ed that

1

N j  N k  N j +N k 

m m m m

1+1 +1 1 29

2



1 if N j  and N k  are b oth o dd;

m m

N j N k 

m m

=1 =

1 if N j orN kiseven,

m m

so b holds by 14.

Theorem 5.1. The total unsigned weight of al l perfect matchings in G

is

0 1

Y

@ A

 w L : 30

0 G jk

1j k n

MATCHINGS IN NON-PLANAR GRAPHS 15

Proof. Wehave

1 0 1 0

Y Y

C C j;k 

m m

A @ A @

w 1 = 1 w 1 : w L = 1

m m m jk

1jkn 1jkn

C

m

But by 16, w 1 = w =  1 W , and on plugging this into the

m m 0 m

ab ove equation, the signs cancel and we are left with

0 1

Y

@ A

w L =  W : 31

m jk 0 m

1j k n

Summing b oth sides of 31 over all p erfect matchings and moving the sign

 to the other side gives 30.

0

In the pro duct in 30, wemay reduce all exp onents mo dulo 4. If  is j -

oriented then the exp onents of ! are always 0 or 2, and otherwise they are

j

n

always 1 or 3. There are 2 monomialsin ! ;:::;! with such exp onents,

1 n

n

so the expansion into Pfaans has up to 2 terms. On setting n for each

surface according to Table 1, wehave established the following theorem.

Theorem 5.2. The number of perfect matchings in a graph may becom-

puted as a linear combination of Pfaans of modi ed signed adjacency ma-

trices of the graph. This is achieved by evaluating equation 30, via 22,

23; 17; and 19. An upper bound on the total number of Pfaans

necessary in this expansion depends on the surface S in which the graph

embeds without crossings: plane 1,projective plane 2, Klein bottle 4,

g

genus g surface 4 ,connected sum of a projective plane with a genus g

2g +1

surface 2 ,connected sum of a Klein bottle with a genus g surface

2g +2 2 S 

2 . In short, this bound is 2 Pfaans.

For example, consider the graph in Figure 2 that emb eds on the con-

nected sum of a torus with a pro jective plane. Letting B x ;x ;x  b e its

1 2 3

x-adjacency matrix, with the 0-edges having weight 1 and the j -edges hav-

ing weight x , the numb er of p erfect matchings is given by w f , where

j G

by 30,

f = L L omitting factors that equal 1

12 33

1 1 i

2 2 2 2 1

= 1 + ! + ! ! !   ! + i! 

1 2 1 2 3 3

2 2

1 i

3 2 2 3 2

= ! + i! + ! ! + i! ! + ! !

3 3 1 3 1 3 2 3 4

16 GLENN TESLER

2 3 2 2 2 2 3

+ i! ! ! ! ! i! ! ! :

2 3 1 2 3 1 2 3

Thus, by 19,

1i

 Pf B 1; 1;i+ iPf B 1; 1; i w f =

G

4

+PfB1;1;i+ iPf B 1; 1; i

+PfB1; 1;i+ iPf B 1; 1; i

Pf B 1; 1;i iPf B 1; 1; i

1i

=Re Pf B 1; 1;i+ Pf B1;1;i

2

+PfB1; 1;i Pf B 1; 1;i

= 3232:

Remark 5.1. For non-orientable surfaces, the numb er of Pfaans can

actually b e cut in half, provided the weights are real or are indeterminates

treated as reals. If we represent the pro jective plane by the word  = a a ,

1 1

the two Pfaans obtained from 22 are complex conjugates, so wemay

compute the numb er of p erfect matchings by taking the real part of only

one Pfaan:

 

 p erfect matchings = Re w 1 i! =Re 1 iPf Bi :

G 1

Similarly, using the representations of the non-orientable surfaces shown in

Table 1, the subword a a contributes one factor of form 22 that

2g +1 2g +1

may b e replaced by taking the real part of the result of using 1 i!

2g +1

instead. Note that ! do es not app ear in any other factors b ecause

2g +1

a a do es not alternate with any other letters.

2g +1 2g +1

Remark 5.2. Galluccio and Lo ebl [2]have also enumerated the p erfect

matchings in graphs emb edding on orientable surfaces of genus g , using a

g

linear combination of 4 Pfaans. Their enumeration formula and edge-

orientations are the ones obtained here for a plane mo del consisting of one

1 1 1 1

4g sided p olygon pasted by  = a a a a  a a a a : Their

1 2 2g1 2g

1 2 2g1 2g

analysis is similar to Theorem 3.1a but restricted to the case of graphs

drawn this way.We treat more general plane mo dels, and give the machin-

ery of crossing orientations that fully generalizes Kasteleyn's \admissible

orientations" to any nite graph drawn in the plane with crossing edges;

this p ermits us to handle non-orientable surfaces concurrently with the

orientable ones.

MATCHINGS IN NON-PLANAR GRAPHS 17

3434

1212

FIG. 3. A protected crossing and its p ossible crossing orientations, up to lab eling.

6. CONSTRUCTION OF A CROSSING ORIENTATION

6.1. Orienting graphs with protected crossings

A protectedcrossing of two edges f1; 4g, f2; 3g has the form shown in

Figure 3. The four vertices form the K , and no other

4

vertices or edges are drawn in the interior of the square 1243. Kasteleyn

describ ed how to orient graphs whose crossings are all protected; we rst

do this, and then we reduce the general situation to this case.

Lemma 6.1. [6, p. 98] A graph G whose crossings areallprotected

crossings can be oriented so that every perfect matching has sign  =

m

m

  1 for a constant  = 1.

0 0

Proof. Let G b e a graph whose N crossings are all protected crossings.

Lab el the vertices in each1 ;2 ;3 ;4 for k =1;:::;N in the same form

k k k k

as Figure 3. Delete all edges f2 ; 3 g to obtain a planar graph, and orient

k k

it by R2. Let  = 1 b e the common sign of p erfect matchings in

0

this orientation. Finally, put back in the edges f2 ; 3 g, oriented so that

k k

~

the cycle 1 ; 3 ; 2  is clo ckwise o dd, resulting in an orientation G of the

k k k

~

original G. Note that if we deleted the edges f1 ; 4 g from G, the resulting

k k

oriented planar graph would also satisfy R2.

In a graph so oriented, we consider the signs of three p erfect matchings

that are identical but for the edges in a protected crossing. There are eight

orientations p ossible in a protected crossing, but up to cyclic rotation of

the lab els, these reduce to two; see Figure 3, where the crossed edges are

directed 1; 4 and 2; 3. The three other rotations of this are similar.

Let m contain f1; 4g ; f2; 3g; m contain f1; 3g ; f2; 4g; and m contain

1 2 3

f1; 2g ; f4; 3g. The crossing in m has a contribution to its sign  = 1

1 1432

18 GLENN TESLER

(a) (b)

FIG. 4. Separate all crossings. Step 1: a has three edges through one p oint,

and two edges sharing a segment with an in nite numb er of p oints. b These are

deformed so as to have only two edges crossing at any p oint, and a nite number of

crossings.

due to these vertices, while the non-crossings in m and m yield signs

2 3

 = +1,  = +1, so  =  =  .

3124 1234 m m m

1 2 3

Now let m be any p erfect matching of G. The crossed edges are f1 ; 4 g ;

k k

f2 ; 3 g for mvalues of k . These are vertex disjoint b ecause it's a p er-

k k

fect matching. Replace these by f1 ; 2 g ; f3 ; 4 g to obtain a new p erfect

k k k k

0 m

0

matching m with no crossed edges. The sign is  =  =   1 ,so

0 m m

m

 =  1 .

m 0

6.2. Orienting graphs without protected crossings

Wenow prove Theorem 3.1a. Let G b e a graph with crossing edges. We

will augmentittohave only protected crossings; orientitby the previous

~

section; and then remove the augmentation to form an orientation G of G.

0

1. Draw G with crossing edges. We augment G to a graph G without

multiplicities in edge-crossings as follows. Deform the edges if necessary

without passing anyvertex through an edge so that only two edges cross

through any non-vertex p oint, and there are only a nite numb er of cross-

ings. See Figure 4. If any edge e crosses itself, or some edges cross in

multiple lo cations, add in 2 vertices b etween each crossing as in Figure 5.

This breaks the edges into o dd numb ers of segments, with no segment in-

tersecting itself, and no two segments intersecting multiple times. If the

segments are alternately colored black and white, with the initial and end-

0

ing segments in black, the crossings in G all o ccur on black segments. A

p erfect matching of G containing e corresp onds to a p erfect matching in

0

G containing the black segments, and a p erfect matching of G without e

MATCHINGS IN NON-PLANAR GRAPHS 19

G G'

0

FIG. 5. Isolate crossings. Step 1: Form G from G by adding pairs of vertices to

split edges so that no edge has self-crossings or is in multiple crossings. Step 5: Convert

0

~ ~

the orientation G to an orientation G according to which direction an o dd number of

arrows p oint in each split edge.

c dc d GG' 7 8 34

12 5 6

abba

FIG. 6. Protect crossings. Step 2: Augment each crossing in G to form a pro-

0 0

~ ~

tected crossing in G . Step 5: Convert the orientation G to an orientation G according

to which direction an o dd numb er of arrows p oint in each split edge.

corresp onds to a p erfect matching containing the white segments and no

crossings involving them.

2. In a neighb orho o d of each p oint where two edges cross, add 8 vertices

and form new edges to create the protected crossing con guration shown

0

in Figure 6. Wehave nished constructing G .

0 0

~

3. Form an orientation G of G by applying Lemma 6.1.

20 GLENN TESLER

0

4. For each protected crossing of G , delete the edges f1; 2g, f2; 4g, f4; 3g,

f3; 1g by setting their weights to 0. Now, p erfect matchings with edge

0

fa; dg in G corresp ond to p erfect matchings with fa; 5g ; f1; 4g ; f8;dg in G ,

and p erfect matchings without this edge corresp ond to p erfect matchings

0

with f5; 1g ; f4; 8g in G . Similarly, p erfect matchings with edge fc; bg in G

0

corresp ond to p erfect matchings with fc; 7g ; f3; 2g ; f6;bg in G , and p erfect

matchings without fc; bg have f7; 3g ; f2; 6g.

~

5. Now form an orientation G of the original G by orienting each non-

0

~

crossing edge as it is oriented in G . Each edge fu; v g of G involved in

crossings was split into an o dd numb er of segments in step 1 or 2. An o dd

numb er of its segments p oint in one direction and an even numb er in the

~

other; the edge should b e oriented u; v inGif an o dd numb er of the seg-

0

~

ments in G p oint along the direction from u to v , and should b e oriented

v; u otherwise. See Figures 5 and 6. Any cycle C of G containing edge

0 0 0

fu; v g, and the corresp onding cycle C of G ,haverC rC  mo d 2

by this choice of orientation. So given two p erfect matchings m , m in G;

1 2

0 0 0

the corresp onding p erfect matchings m , m in G ; and the sup erp ositions

1 2

0 0 0

 =  m ; m ,  =  m ; m , Lemma 3.1 yields

1 2

1 2

Y



m

1 r C +1

=   = 1

m m

1 2



m

2

C 2

Y

0



0

m

r C +1

1

0 0

= 1 =   = :

m m

1 2

0



m

0 0

2

C 2

Wehave not changed the relative sign b etween anytwo p erfect matchings.

0

We also have  C = C  for all sup erp osition cycles, so on xing m

e e 2

wehave for all m ,

1

0

  

m m m

2 2 2

0 0 m  m  m 

1 1

1

0

 =       = 1 = 1 =  1

m 0

m

1 0 0

1

0 0 0

  

m m m

2 2 2

0

0

where  =   = . Thus 12 holds for G.

0 m

m

2

0

2

This proves Theorem 3.1a.

0

Remark 6.1. In step 5, the parities of C  and C  are equal as well,

b ecause vertices were added to regions of the plane in pairs; for example,

0 0

f5; 1g of Figure 6. Each such pair either lies on C ; inside of C ; or outside

0 0

of C ,so C Ciseven.

6.3. Characterizing Crossing Orientations

Wenow prove Theorem 3.1b.

MATCHINGS IN NON-PLANAR GRAPHS 21

(a) (a) (b) (c) (b)

(c)

0

FIG. 7. The sup erp osition cycles  of p erfect matchings m black and m white,

shown dashed. As wemovevertices along them, the colors of crossings and the p oints

interior to other cycles change. In c the edge ofa2vertex cycle is traversed back and

forth to form a cycle.

0 0

Lemma 6.2. Let m and m beperfect matchings, and  =  m; m  be

the permutation formed as their superposition. Then

X

0

m+m   C+ C mo d 2 : 32

e

C2

0

Proof. Color the edges of m black and the edges of m white. Wenow

work with the drawing of  this induces, and we disregard all other edges

of G. See Figure 7 for illustrations of steps a{c.

a Consider the drawing of a cycle C of  . Cho ose a vertex v on it

1

with an edge that forms a crossing with another cycle C .Movevalong

2

C past the crossing, therebychanging the color of the p ortion of C it

1 1

moved along. Wehavechanged the color of one edge at the crossing, thus

0

changing either mormby1 dep ending on the colors and whether

that created or destroyed a mono chromatic crossing. Simultaneously, v has

moved from inside of C to outside, or vice-versa, so C changed by 1,

2 2

but no other C changed b ecause wehave not altered whether v is inside,

outside, or along any other cycle. Wehavechanged b oth sides of 32 by

1 mo d 2, so the equation still holds or still fails after moving v .

b Now consider a cycle C with crossing edges. If wemovea vertex

1

along C past a crossing, wechange the color of one segment in the crossing,

1

causing  C tochange by 1. Wehave also changed either mor

e 1

0

mby1. Wehave not changed any other quantity, so 32 continues

to hold or continues to fail.

22 GLENN TESLER

v u

FIG. 8. d Move the vertices along each curve till they're all b etween 2 crossings;

now they're also in one planar region w.r.t. all other cycles.

c If C is a 2-cycle, its sole edge is counted in one direction as black

1

and in the other as white. Wemovea vertex past a crossing by erasing the

segment of the edge as wemove along it. This mo di es a and b.

In a, if C is also 2-cycle, then C and C had formed a mono chromatic

2 1 2

white crossing and a mono chromatic black crossing, but do no longer, so

0

m and m have each gone down by1.Novertex is inside of C ,so

2

C  has not changed.

2

In a, if C is not a 2-cycle, then C and C had formed a mono chromatic

2 1 2

crossing either due to the white or the black edge of C , but do no longer,

1

0

so either mor m has decreased by 1. Also, the vertex has moved

from inside of C to outside, or vice versa, so C  has changed by 1.

2

In b, each crossing yields one black mono chromatic crossing and one

0

white, so moving the vertex reduces m and m  eachby 1, without

changing whether anyvertex is interior to any cycle.

So in all cases, these vertex moves do not a ect whether 32 holds or

fails.

d Wenowmovevertices on all the cycles of  as just describ ed. For

each cycle C forming any crossings whatso ever, use a{c to move all the

vertices along the cycle until they are all congregated b etween a single pair

of crossings; see Figure 8. This is exactly the opp osite of what we did in

step 1 of the preceding section. All 2-cycles can b e deformed to form no

crossings at all. It suces to prove 32 for the graph so obtained.

0

The vertices of C are now all inside or all outside of any other cycle C .

0

This is true for all C so all C  0 mo d 2.

The twovertices u and v at either extreme of C are joined by one edge

we call the `long edge.' The long edge is entirely blackorentirely white. It

MATCHINGS IN NON-PLANAR GRAPHS 23

is drawn as a curve that forms all the intersections involving this cycle. It

0

forms  C intersections with itself. With any other cycle C , it forms an

e

even numb er of mono chromaticintersections. To see this, supp ose without

0

loss of generality that u and v are inside C . They are b oth inside or b oth

outside since wehavemoved all the vertices of C into the same region of

the plane. As we travel from u to v along the long edge, the curve al-

0

ternates b eing inside, outside, . . . , inside of C ,aswe pass each crossing.

So altogether there is an even numb er of crossings. If the long edges of C

0 0

and C are the same color, wehaveaneven contribution to morm,

and if they are of opp osite color, wehave 0 contribution to these. Either

way,we do not a ect their parity.Thus, the total numb er of crossings

P

0

in this case is m+ m  C mo d 2. Since the vertices

e

C

have b een congregated together into groups of even size, in regions com-

pletely interior or exterior to other cycles, all C  are even. So 32 holds.

Proof of Theorem 3.1b:

~

Let G b e a crossing orientation. We are given two p erfect matchings m,

0 0

~

m , and their sup erp osition  =  m; m . Since G is a crossing orienta-

P

tion, the right side of 32 is congruentto rC+1 mo d 2; plug

C

this into 9, obtaining



P

 C + C 

e

C

0

  =1

m m

33

0 0

m+m  m m 

=1 =1 1 :

0

0 m 

0

On xing any m and setting  =1  = 1, wehave =

0 m m

m

1 for all m, so Theorem 3.1a holds. If there is a p erfect matching

0

with no crossings, wemayinterpret  as its sign.

0

~

Conversely, supp ose that an orientation G satis es Theorem 3.1a. Let

C b e a sup erp osition cycle. Alternately color its edges black and white.

0

00

Let m b e a p erfect matching of the vertices of G not along C ; this exists

0

b ecause C is a sup erp osition cycle, not just anyeven length cycle. Let m

0

00 0

consist of the black edges of C and all the edges of m . Let m consist of

0

00

the white edges of C and all the edges of m . The sup erp osition  of m

0

0 00

and m has the cycle C and a bunch of 2-cycles, one for each edge of m .

0

Perform the construction in the preceding pro of of Lemma 6.2, step d.

00 00 00 00

Now each 2-cycle C of  resulting from m has  C =0, C =0,

e

00

rC  = 1, and forms no intersections with other cycles. So by Lemma 6.2,

X

0

m+m   C+ C

e

C

X

00 00

=  C + C +  C + C 

e 0 0 e

00

C

 C + C  ; 34

e 0 0

24 GLENN TESLER

00 00

where C runs over the 2-cycles induced by m , while

X X

00

r C +1=rC+1+ r C + 1

0

00

C C

X

=rC+1+ 1 + 1

0

00

C

r C +1 : 35

0

r C +1

0

0

By 9 and 35,   =1 . Since the orientation satis es The-

m m

0

m+m   C + C 

e 0 0

0

orem 3.1a, we also have   =1 =1

m m

by 34. So r C +1  C + C  mo d 2, and the orientation is a

0 e 0 0

crossing orientation. Wehave proven Theorem 3.1b.

6.4. Pro of of R4

We show that rule R4 gives the same orientation as the construction

of Section 6.2 when applied to graphs as we draw them in Section 4.

0

i Let G b e our original graph with crossings, and G the augmented

graph from steps 1 and 2 of Section 6.2.

0

ii In step 3, we form an orientation of G by Lemma 6.1, and then

induce an orientation of G from this in step 5. The 0-edges of G are not

involved in any crossings, so their nal orientation is determined by R2

in step 3. This is what R4 says to do with the 0-edges.

iii Now consider any j -edge e of G j>0, a counterclo ckwise cycle C it

forms with edges along the b oundary of the 0-edges, and the corresp onding

0 0

cycle C of G . While C do es not cross itself, e mayhave b een split into

0 0

many segments in G due to other crossings. Delete the segments of G

crossing these, and delete the edges f1; 4g ; f2; 3g of all other protected

crossings not involved in this j -edge. By Lemma 6.1, the resulting graph

0

is a planar graph satisfying R2. By Remark 6.1, the cycle C in step 5

0

encloses an even number of vertices in G b ecause C encloses no vertices

0 0

in G, so r C isoddby R2. Also in step 5, r C  r C  mo d 2, so

r C  is o dd to o. The only edge of C not already oriented in ii is e, so its

orientation is determined by requiring r C  to b e o dd, as R4 states.



7. GRID ON THE MOBIUS STRIP

Kasteleyn [5]enumerated the p erfect matchings of an m  n grid in the

plane, and of a p erio dic grid on a torus. We will enumerate the p erfect

matchings of an m  n grid on a Mobius strip. The graph and a crossing

orientation R4 are shown in Figure 9. This Mobius strip is a surface with

a b oundary; its word is  = a a a a , and the b oundaries do not enter in

1 2 1 3

to our computation, so we use  = a a .

1 1

MATCHINGS IN NON-PLANAR GRAPHS 25

(a) (1,n) (2,n) (m,n) zz z x1

z z z x1

z z z (1,1)(2,1) (m,1)

x1

x1

(b) (1,n)(2,n) (m,n) zz z

x1 zz z x1

x1 z z z (1,2) (2,2) (m,2)

x1 z z z

(1,1) (2,1) (m,1)

FIG. 9. An orientation R4 of a width m, height n, grid on the Mobius strip. The

pattern is shown for a even n and b o dd n.

26 GLENN TESLER

The vertical edges are weighted by z . The horizontal edges haveweight

1. In the x-adjacency matrix B x , the crossing edges haveweight x .

1 1

The total weight of all p erfect matchings is given by



1 i 1+ i

Mobius

w = Pf B i+ Pf B i=Re 1 iPf Bi : 36

mn

2 2

We lab el the vertices by ordered pairs, f j; k :1jm; 1  k  n g :

0 0

The x-adjacency matrix has comp onents b x =

jk;j k 1

k

0 0 0

   1 horizontal 0-edges

j+1;j j +1;j k;k

nk n

0 0 0

+ x   1   +1    horizontal 1-edges

1 k;n+1k j;m j ;1 j ;m j;1

0 0 0

+ z      vertical 0-edges.

j;j k +1;k k +1;k

This can b e compactly written in terms of tensor pro ducts as

n

B x =Q E +x G H zI Q ; 37

1 m n 1 n m n

m

where wehave adopted certain matrices of Kasteleyn and intro duced oth-

n

ers. I is the m  m identity matrix. Q , E , H are n  n, and Q , G

m

m n n n m

are m  m.

2 3

0 1 0 0  0 0

6 7

1 0 1 0  0 0

6 7

6 0 1 0 1  0 07

6 7

6 0 0 1 0 1  07

Q = 38

n

6 7

. .

6 7

. .

. .

0 0 0

6 7

4 5

0 0 0  1 0 1

0 0 0  0 1 0

k 0

0 0

E  =  1 1  k; k  n

n k;k k;k

39

k +1 0

0 0

H  =  1 1  k; k  n

n k;k k+k ;n+1

n n

n

G  =1; G  =1 ;

m m

m;1 1;m

n

0

0

G  =0 otherwise in 1  k; k  m

m

k;k

1 0

De ne additional n  n matrices U , U with comp onents 1  j; j  n:

n

n

q

0

2 kk 

k

0

i sin U  =

n k;k

n+1 n+1

q

40

0

1

2 kk 

k

0

U  = i sin :

n k;k

n+1 n+1

MATCHINGS IN NON-PLANAR GRAPHS 27

Conjugate Q , E , H by U to obtain

n n n n

k

1

e e

0 0

Q = U Q U Q  =   2i cos

n n n n k;k k;k

n

n+1

1

e e

41

0 0

E = U E U E  = 

n n n n k;k k+k ;n+1

n

1 n+1 k

e e

0 0

H = U H U H  =i 1  :

n n n n k;k k;k

n

Conjugate B x byI U to obtain

1 m n

1

e

B x =I U BxI U 

1 m n 1 m n

n

e e e

= Q E +x G H zI Q 42

m n 1 n m n

m

3 2

G iq I 0 0  0 0 Q

1 1 m

7 6

0 G iq I  0 0 Q 0

2 2 m

7 6

7 6

. .

. .

7 6

. .

0 0  0 0

7 6

7 6

......

......

=

7 6

. . . .  . .

7 6

7 6

. .

. .

7 6

. .

0 0  0 0

7 6

5 4

0 Q 0  0 G iq I 0

m n1 n1

Q 0 0  0 0 G iq I

m n n

n

where we abbreviate G = G , I = I , and for k =1;:::;n,

m

m

k

= q 43 q =2zcos

n+1k k

n +1

n+1 k

= x i 1 : 44

k 1

e

Although det B x  = det B x , wehave destroyed the antisymmetry

1 1

of the matrix, so we cannot directly take the Pfaan. However, we can

rearrange the rows and columns to makeitantisymmetric again, resulting

e e

in a Pfaan o by a factor 1ori. The matrices H and Q are diagonal,

n n

e e

and E is reverse diagonal, so on rearranging the blo cks, B x maybe

n 1

written as a blo ck sum of bn=2c antisymmetric 2m  2m matrices, and an

additional m  m blo ck when n is o dd. The r th blo ckr=1;:::;bn=2c,

0

corresp onding to blo ckrows k = r;n +1 r and blo ck columns k =

n +1r;r of 42, may b e expressed in terms of the 2m  2m antisymmetric

28 GLENN TESLER

matrix

2 3

q 0 0  0 0 1 0  0 0

6 7

1 0 1  0 0 0 q 0  0 0

6 7

6 7

0 1 0  0 0 0 0 q  0 0

6 7

6 7

......

. . . .

......

6 7

. . . .

......

6 7

6 7

0 0 0  q 0 0 0 0  0 1

6 7

6 7

0 0 0  1 0 0 0  0 q

6 7

T q; ; = 45

6 7

m

6 7

q 0 0  0 0 1 0  0 0

6 7

6 7

0 q 0  0 0 1 0 1  0 0

6 7

6 7

0 0 q  0 0 0 1 0  0 0

6 7

6 7

......

. . . .

......

6 7

. . . .

......

6 7

4 5

0 0 0  0 1 0 0 0  q 0

0 0  0 q 0 0 0  1 0

as T iq ; ; , where we note iq = iq and de ne

m r r r n+1r r

n n+1 r

=1 = = x  i 1 46

r n+1r r 1

n+1 n+1 r

= =1 = x  i 1 : 47

r n+1r r 1

When n is o dd, the additional blo ck is the m  m antisymmetric matrix

2 3

0 1 0 0  0 x

1

6 1 0 1 0  0 0 7

6 7

6 0 1 0 1  0 0 7

6 7

6 0 0 1 0 1  0 7

V x = : 48

m 1

6 7

. .

6 7

. .

. .

0 0 0

6 7

4 5

0 0 0  1 0 1

x 0 0  0 1 0

1

The blo ck decomp osition is

bn=2c

M

r

n+1 r n+1 r



e

B x  T 2iz cos ;x i 1 ;x  i 1

=

1 m 1 1

n +1

r =1

M

V x  if n is o dd. 49

m 1

In computing the Pfaan of these blo cks, we will require a q -analogue

of the Fib onacci numb ers.

bm=2c bm=2c

X X

m j m j

m2j m2j

F q = q = q 50

m

m 2j j

j =0 j =0

MATCHINGS IN NON-PLANAR GRAPHS 29

bm=2c bm=2c

X X

m j m j

m2j m2j j j

e

q q = 1 F q = 1

m

j m 2j

j =0 j =0

With slight mo di cations, these have b een studied in other contexts; see [3].

These satisfy F q =F q+qF q; F 1 is the mth Fib onacci

m m2 m1 m

P

d

c q where c is the number of words in the numb er; and F q =

md md m

d

alphab et f1; 2g whose digits sum to m and that have exactly d 1's. These

are related by

m

e

F iq =i F q: 51

m m

Lemma 7.1.

m bm=2c

e e

F q  F q 1 Pf T q; ; =1

m m2 m



0 if m is even

+ 52

+ if m is odd



x +1 if n is odd and m is even

1

bm=2c

1 Pf V x = 53

m 1

0 if n is odd and m is odd

Proof. The matrix V x  is the signed adjacency matrix of the graph

m 1

shown in Figure 10b. It is an admissible orientation of a planar graph.

If m is o dd, there are no p erfect matchings and the Pfaan is 0. If m is

even, there are two p erfect matchings:

p erfect matching weight

ff1; 2g ; f3; 4g ;:::;fm 1;mgg 1

ff2; 3g ; f4; 5g ;:::;fm 2;m 1g;fm; 1gg x

1

Up to sign, the Pfaan is x + 1. Compute the sign from either matching;

1

as listed, all edges of the rst matching are against the routing, so the sign

m=2

is 1 .

The matrix T q; ;  is the signed adjacency matrix of the graph shown

m

in Figure 10a. It is a crossing orientation: the 0-edges f1; 2g, f2; 3g,...,

f2m; 1g are the edges of the p erimeter of the 2m-gon, and form a clo ckwise

o dd cycle. The 1-edges f1;m +1g,...,fm; 2mg are oriented as by R4,

in a hole of a planar region.

Wenow classify the p erfect matchings of Figure 10a according to

whether they contain the edges e = f1; 2mg or e = fm; m +1g.

1 2

Perfect matchings with e but not e : Vertex m is adjacenttom+

1 2

1;m 1;2m, but can only b e matched to m 1. Vertex m + 1 is ad-

jacenttom; m +2;1, but can only b e matched to m +2. Continuing

30 GLENN TESLER

(a) 2m γ 1 2m-1 q 2

 q (b)  m x 1 1 2m-2 q 3 m-1 2 a1 a1 q

 q  m+2 q m-1

m+1 β m

FIG. 10. a A graph with signed adjacency matrix T q; ; ; b A graph with

m

signed adjacency matrix V x .

m

1

this way,we are forced to have edges f1; 2mg; fm; m 1g ; fm +1;m +2g;

f2;3g;f2m1;2m2g; . . . , alternating along the p erimeter. If m is even,

there will b e twovertices remaining that cannot b e matched together, so

we don't form a p erfect matching. If m is o dd, we complete the cycle with

alternating edges, forming a p erfect matching of unsigned weight . The

m

sign of this matching is  =1 ;we place it on the left in 52.

0

Perfect matchings with e but not e : If m is o dd, there is one of signed

2 1

weight  .Ifmis even, there are none.

0

Perfect matchings with neither e nor e : We enco de the matchings

1 2

of this form bywords w = w w w comprised of digits w 2f1;2g,

1 2 k j

with w +  + w = m. Lo ok at the vertices 1;:::;m consecutively, and

1 k

record a 1 if a vertex t is matched to t + m, and a 2 when ft; t +1g and

hence ft + m; t + m +1g as well are matched. For m = 8, the word 12212

means f1; 9g ; f2; 3g, f4; 5g, f6; 14g, and f7; 8g are edges and implies the

remaining edges are f10; 11g, f12; 13g, and f15; 16g. If there are d 1's

and j 2's, with d + j = k , d +2j = m, then there are d edges that



d

crossing pairs of edges. cross each other through the center, forming

2

d

 bd=2c 

2

=  1 = Pf T q ; a; c counts this matching with sign  1

0 m 0

bm2j =2c bm=2c j d m2j

 1 =  1  1 , and unsigned weight q = q .

0 0



mj

, so the total weightof The number of words with d 1's and j 2's is j

MATCHINGS IN NON-PLANAR GRAPHS 31

all these p erfect matchings is

bm=2c

e

F q  : 54  1

m 0

Perfect matchings with both e and e : We enco de the matchings of this

1 2

form bywords whose digit sum is m 2, enco ding howvertices 2;:::;m1

are matched, in a similar fashion to the preceding case. The total signed

weightis

bm=2c bm2=2c

e e

F q  : 55 F q = 1  1

m2 m2 0 0

Adding together the signed weights from these four cases gives 52.

Theorem 7.1. On the m  n grid on the Mobius strip as depictedin

Figure 9, the weight of al l perfect matchings is

m n weight of perfect matchings

odd odd 0

"

n=2

Y

r

odd even Re 1 i F 2z cos

m

n +1

r =1



r

r +n=2

+ F 2z cos +2i1

m2

n +1

n1=2

Y

r r

even odd 2  F 2z cos +F 2z cos

m m2

n +1 n +1

r =1

n=2

Y

r r

even even F 2z cos +F 2z cos

m m2

n +1 n +1

r =1

Proof. When m and n are b oth o dd, there is an o dd number of vertices

so there is no p erfect matching; this manifests itself in our computations

by a factor Pf V x  = 0 in 53.

m 1

In all other cases,

n+1 r n

+ = x  i  1  1 + 1 

r r 1



n+1 r

2x  i  1 if n is even

1

= 56

0 if n is o dd

2 n+1 2r 2

= x i i 1 = x =1 57

r r 1 1

32 GLENN TESLER

where in the last step, we used the fact that only x = i are used in our

1

computation. Plugging these and 51 into 52 yields

m

1 Pf T iq ; ; 

m r r r



bm=2c m

F q +F q  =1 i

m r m2 r

58



0 if m is even or n is o dd

+

n+1 r

2x  i  1 if m is o dd and n is even.

1

bm=2c m m=2 m=2

When m is even, 1 i =1 1 = 1, and wehave

m

1 Pf T iq ; ; =F q+F q  : 59

m r r r m r m2 r

On plugging in 43, the right side is a p olynomial in z with nonnegative

real co ecients for r =1;:::;bn=2c.Wemultiply these together over all

r , obtaining a pro duct y , indep endentofx . When n is even, wenowhave

1

Mobius

1+i 1i

w y + y = y 60 =

mn

2 2

where  = 1ori; since y and the total weight should b oth b e p olyno-

mials in z with nonnegative real co ecients,  =1.

When m is even and n is o dd, wehave the additional factor Pf V x 

m 1

evaluated in 53, giving

Mobius

1+i 1i

  w  1 + iy +  1 iy =2y: 61 =

mn

2 2

Finally, when m is o dd and n is even, 58 reduces to

m r +n=2

i1 Pf T iq ; ; = F q+ F q +2x 1

m r r r m r m2 r 1

and there is no factor of Pf V x . On plugging in x = i, and expressing

m 1 1

it as a p olynomial in z , all terms on the right but the constant term have

nonnegative real co ecients. Multiplying the right side over r and plugging

this into 36 gives the total weightuptoanoverall sign. The highest degree

term in z has a p ositive real co ecient, so we'vechosen the correct sign.

APPENDIX: COMPUTING

A.1. COMPUTING PFAFFIANS BY ROW AND COLUMN

REDUCTION

For graphs emb edding in the plane, we only need to compute one Pfaf-

p

det A as the number of an, and can take the p ositivevalue j Pf Aj =

MATCHINGS IN NON-PLANAR GRAPHS 33

p erfect matchings. For other surfaces, we compute a linear combination

of Pfaans, p ossibly involving complex numb ers, so wemust b e sure to

have the correct sign on each term. The Pfaan of A can b e computed by

simultaneous row and column reduction.

a Multiplying b oth row j and column j by multiplies the Pfaan by

.

b Simultaneously swapping row j with row k , and column j with col-

umn k , negates the Pfaan. Simultaneously p ermuting the rows and

columns by the same p ermutation multiplies the Pfaan by the sign of

that p ermutation.

c Adding times row j to row k , and simultaneously adding times

column j to column k , do es not change the value of the Pfaan.

Using these op erations, we can reduce anyantisymmetric matrix A to a

blo ck sum of 2  2 matrices,

3 2

0 a

7 6 a 0

7 6

7 6 0 b

: A.1 C =

7 6

b 0

5 4

.

.

.

WehavePfC =ab , and Pf A is a multiple of this that dep ends on

the op erations a{c p erformed in the reduction.

A.2. BIPARTITE GRAPHS

Let G b e a . Lab el its vertices so that the twovertex

classes are f1;:::;pg and fp +1;:::;2pg. The signed adjacency matrix

now takes on the form

 

0 C

A = A.2

C 0

p

 

2

and Pf A =1 det C .Sowemay systematically use determinants of

signed bipartite adjacency matrices instead of Pfaans.

A.3. HAFNIANS AND PERMANENTS

The Hafnian of a 2p  2p symmetric matrix D =[d ]is

ij

X

Hf D = d d A.3

u ;v u ;v

1 1 p p m

34 GLENN TESLER

where m = ffu ;v g;:::;fu ;v gg again ranges over the partitions of

1 1 p p

f1;:::;2pg into p sets of size 2. If D is the ordinary weighted adjacency

matrix of an undirected graph, d = W , then Hf D is the total weight

ij

fi;j g

of all p erfect matchings. This is not easy to compute. Computing it by

the metho ds of this pap er, wehave the complete graph on 2p vertices,

with edge-weights. For p  2, the complete graph has Euler characteristic

h i

p72p

K = 2 see [1,p. 112] so its plane mo del has 2n sides,

2p

6

h i

2

2p7p+11

where n =2 K =2 .SoHfDcan b e expressed as a

2p

6

n

linear combination of 2 Pfaans of 2p  2p antisymmetric matrices.

The p ermanentofappmatrix D =[d ]is

ij

X

per D = d d A.4

1; 1 p; p

2S

p

summed over all p ermutations of p elements. If D is the ordinary not

signed weighted adjacency matrix of a bipartite graph, then p er D is the

total weight of all p erfect matchings. The b est known formula to compute

2 p1

this in general was found by Ryser [10, p. 27], and requires ab out p  2

op erations. Using our metho ds, the K has

p;p

h i

p4p

Euler characteristic K =2 for p  3 so n =2 K =

p;p p;p

4

h i

2

p 4p+7

n

2 .Thus p er D can b e computed as a linear combination of 2

4

determinants of p  p matrices, which is not as ecient as Ryser's metho d.

A.4. SYMBOLIC METHOD

n

Wehave exhibited a linear combination of 2 Pfaans of matrices with

complex valued entries, which is useful for graphs with numeric weights

b ecause these Pfaans may b e computed eciently as just describ ed. In

terms of the variables x ;:::;x , the expansion

1 n

X

r r

1 n

Pf B x ;:::;x = x x A.5

1 n r ;:::;r 1 n

1 n

0r ;r ;:::;r 3

1 2 n

is symb olic, and need not b e as eciently computable. However, if this ex-

pansion is known, wemay directly compute the numb er of p erfect match-

ings from it, rather than plugging it and 30 into 19.

In A.5, is the signed weight of all p erfect matchings whose

r ;:::;r

1 n

number of j -edges is congruenttor mo d 4. We can remove the signs

j

by taking absolute values, obtaining

X

 p erfect matchings = j j : A.6

r ;:::;r

1 n

0r ;:::;r 3

1 n

MATCHINGS IN NON-PLANAR GRAPHS 35

We can also remove the signs by explicitly computing and cancelling them,

giving the numb er of p erfect matchings as

P P

X

n

C r + C r ;r 

j j jk j k

j =1 1j

1 ; A.7

r ;:::;r

1 n

0r ;r ;:::;r 3

1 2 n

where the C 's give the numb er of pairs of crossed edges:





r

j

if  is j -nonoriented;

2

C r =

j j

0 otherwise.

n

r r if  is j; k -alternating;

j k

C r ;r =

jk j k

0 otherwise.

ACKNOWLEDGMENTS

Iwould like to thank Jim Propp, William Jo ckusch, and Richard Stanley for their

discussions with me ab out this research, and Dan Klain and a referee for help with the

revisions.

REFERENCES

1. P. A. Firby and C. F. Gardiner, Surface topology, second ed., Ellis Horwo o d Series:

Mathematics and its Applications, Ellis Horwo o d, New York, 1991.

2. A. Galluccio and M. Lo ebl, On the theory of Pfaan orientations. I. Perfect match-

ings and permanents, Electron. J. Combin. 6 1999, no. 1, ResearchPap er 6, 18 pp.

electronic.

3. S. W. Golomb and A. Lemp el, Second order polynomial recursions, SIAM J. Appl.

Math. 33 1977, no. 4, 587{592.

4. P. W. Kasteleyn, The statistics of dimers on a lattice. I. The number of dimer

arrangements on a quadratic lattice,Physica 27 1961, 1209{1225.

, Dimer statistics and phase transitions, J. Mathematical Phys. 4 1963, 5.

287{293.

, and crystal physics, Graph Theory and Theoretical Physics, 6.

Academic Press, London, 1967, pp. 43{110.

7. L. Lov asz and M. D. Plummer, Matching theory, North-Holland Mathematics Stud-

ies, vol. 121, North-Holland Publishing Co., Amsterdam, 1986, Annals of Discrete

Mathematics, 29.

8. J. R. Munkres, Topology: a rst course, Prentice-Hall Inc., Englewo o d Cli s, N.J.,

1975.

, Elements of algebraic topology, Addison-Wesley Publishing Company, Menlo 9.

Park, Calif., 1984.

10. H. J. Ryser, Combinatorial mathematics, Published by The Mathematical Asso cia-

tion of America, 1963, The Carus Mathematical Monographs, No. 14.

11. G. Tesler, Kasteleyn's Pfaan Method, in the domino electronic mailing list archives,

vol. 96a; contact [email protected] for access. 1992, 1996.