The ombinatorial approah yields an NC algorithm for omputing PfaÆans Meena Maha jan y The Institute of Mathematial Sienes, Chennai, INDIA. meenaims.ernet.in z P. R. Subramanya, V. Vinay Dept. of Computer Siene & Automation, Indian Institute of Siene, Bangalore, INDIA. fsubbu,vinaygsa.iis.ernet.in November 21, 2003 Keywords: PfaÆan, mathing, ombinatoris, algorithm, NC. Abstrat The PfaÆan of an oriented graph is losely linked to Perfet Mathing. It is also naturally related to the determinant of an appropriately dened matrix. This relation between PfaÆan and determinant is usually exploited to give a fast algorithm for omputing PfaÆans. We present the rst NC algorithm for omputing the PfaÆan. (Previous determinantbased methods omputed it in NC only up to the orret sign, while previous polynomialtime algorithms did not lend themselves to parallelization.) Our algorithm is ompletely ombinatorial in nature. Furthermore, it is division-free and works over arbitrary ommutative rings. Over integers, we show that it an be implemented in the omplexity lass GapL. This upper bound was not known before, and establishes that omputing the PfaÆan for integer skew-symmetri matries is omplete for GapL. Our proof tehniques generalize the reent ombinatorial haraterization of determinant [MV97℄. As a orollary, we show that under reasonable enodings of a planar graph, Kasteleyn's algorithm [Kas67℄ for ounting the number of perfet mathings in a planar graph is also in GapL. An extended abstrat desribing these results appeared in the Proeedings of the Fifth Annual International Computing and Combinatoris Conferene COCOON 1999, in the Springer-Verlag Leture Notes in Computer Siene series Volume 1627, pp. 134{143. y Part of this work was done when this author was supported by the NSF grant CCR-9734918 on a visit to Rutgers University during summer 1999. z This work was initiated when this author was visiting DIMACS at Rutgers University during summer 1998. 1 Introdution The main results of this paper are 1. a new ombinatorial haraterization of the PfaÆan of an oriented graph, and 2. the rst NC algorithm for omputing the PfaÆan, based on this haraterization, and 3. pinpointing the omputational omplexity of PfaÆan as omplete for the lass GapL. Our ombinatorial haraterisation and algorithm are similar in spirit to a reent result of Mahajan & Vinay [MV97℄ who give a ombinatorial algorithm for omputing the determinant of a matrix. See [Rot01℄ for a unied presentation of [MV97℄ and this work, along with various extensions. Our algorithm pinpoints the omputational omplexity of PfaÆans: we establish that omputing the PfaÆan of a graph is omplete for the omplexity lass GapL. GapL is the lass of funtions that an be expressed as the dierene in the number of aepting paths of two nondeterministi logspae mahines (i.e. the dierene of two ℄L funtions). This denes a spae analog of the important ounting lasses GapP and ℄P. It is known that taking the dierene of two ℄L funtions is equivalent to omputing the determinant of an integer matrix [Vin91, Dam91, Val92, Tod91℄. In other words, GapL is also the lass of funtions that are logspae reduible to omputing the determinant of an integer matrix. GapL is ontained in NC2 , the lass of funtions omputable by polynomial size iruits of log2 n depth. PfaÆans are a well-studied objet in algebra (see e.g. [Lan65℄), and play an important role in mathing theory [LP86℄. They are intimately onneted to determinants. In fat, PfaÆans an be onsidered to be more fundamental than determinants, in the sense that determinants are merely the bipartite speial ase of a general sum over mathings, see for instane [Knu96, Rot01℄. In partiular, for a matrix A of dimension n with n 0 or 1 (mod 4) ! 0 A det(A) = Pf AT 0 implying that omputing the PfaÆan is hard for GapL. However, no mathing upper bound was known till now. It is known that the square of the PfaÆan of an oriented graph is equal to the determinant of a related matrix. Thus, omputing the PfaÆan orret up to the sign is known to be in NC. This is, however, not adequate to imply a GapL algorithm as (1) we do not know if GapL is losed under square roots (of positive integers), and (2) this does not give the orret sign of the PfaÆan. This does not even imply any NC algorithm for the sign. The PfaÆan (inluding the sign) an be omputed in polynomial time [Bar83, GM94℄ using ross-eliminations (akin to Gaussian elimination for determinants) and hoosing pivot elements arefully, see also [Von99℄. However, this method suers the same drawbak as Gaussian elimination of not lending itself to eÆient parallelization. In [GM94℄ the authors expliitly state that urrent tehniques whih allow determinant omputations to be performed in NC do not appear to generalize to PfaÆans, and that no NC algorithm for PfaÆans is known. The subsequent determinant algorithm of [MV97℄ uses tehniques that do generalize to PfaÆans, yielding the algorithm desribed in 1 this work1 . Our algorithm is thus the rst to plae PfaÆans inside NC, and more preisely, in GapL. It follows that omputing integer PfaÆans exatly haraterizes the lass GapL. The importane of omputing the sign annot be underestimated. As pointed out in [GM94℄, the omputation of the PfaÆan an be substituted by that of the determinant (followed by a square-root operation) in the solution of existene versions of various problems, but to solve the orresponding exat value problem (see eg [CGM92℄), omputing the PfaÆan beomes essential. The algorithm of [MV00℄ is a ase in point: it requires a linear ombination of ertain PfaÆans and thus annot be implemented in NC unless the PfaÆan with its sign an be omputed in NC. One of the motivations for this work is to understand the omplexity of Perfet Mathing. Perfet Mathing is not known to be in NC, but is known to be in RNC [MVV87℄. This result has been reently improved by Allender, Reinhardt and Zhou [ARZ99℄ who show that Perfet Mathing is in the lass SPL (non-uniformly). (SPL is that sublass of GapL where funtions take the value 0 or 1. Refer to [ARZ99℄ for details.) Interestingly, [ARZ99℄ make use of the Mahajan-Vinay low sequenes [MV97℄ ritially to establish their result. PfaÆans arise naturally in the study of mathings; the PfaÆan of an oriented graph is just the sum over all possible perfet mathings exept that eah mathing has an assoiated sign as well, ditated by the orientation. This gives it a avour similar to that of a determinant. In the absene of the sign, it would alulate the number of perfet mathings in a graph, a problem that is well-known to be omplete for ℄P [Val79℄. Also, in the ase of speial graphs, it is known that the graph may be oriented in suh a way that all the terms of the PfaÆan turn out to be positive. This obviously means that there would be no anellation and hene the PfaÆan would ount the number of perfet mathings in the underlying graph. Suh orientations of graphs are alled PfaÆan orientations. It is easy to onstrut graphs whih do not admit a PfaÆan orientation; K3;3 is one suh graph. A elebrated result of Kasteleyn [Kas67℄ proves that all planar graphs admit a PfaÆan orientation. This result was subsequently improved by [Lit74℄ who showed that all K3;3 -free graphs admit a PfaÆan orientation. Finding suh an orientation was shown to be in NC by Vazirani [Vaz89℄. In this paper, we partially improve Vazirani's result to show that for planar graphs presented by reasonable enodings, a PfaÆan orientation an be found in deterministi logspae L. Combining this with our ombinatorial algorithm for PfaÆans, we thus show that under reasonable enodings of planar graphs, the problem of ounting the number of perfet mathings in a planar graph is in GapL as well. The problem of extending our result to K3;3 -free graphs remains to be investigated. Reent work in [MV00℄ uses our PfaÆan algorithm and the results of [GL99℄ to extend this result in another diretion: under reasonable enodings, ounting the number of perfet mathings in a graph of small (logarithmi) genus is in NC. In setion 2, a few denitions and preliminaries are stated. In setion 3, we set up the ombinatorial framework for PfaÆans. Setion 4 fouses on the ombinatorial algorithm for omputing PfaÆans. We show in setion 5 that nding PfaÆan orientations of planar graphs is in L, and hene ounting the number of perfet mathings in a planar graph is in GapL. 1 Our main theorem is similar in spirit to Theorem 1 in [MV97℄, though there are essential dierenes in the proof. 2 2 Preliminaries & Denitions Let D be an n n matrix. Sn is the permutation group on f1; 2; : : : ; ng (denoted [n℄). The permanent and determinant of D, per(D) and det(D), are dened as, per(D) = XY 2Sn i det(D) = di(i) X 2Sn sgn( ) Y i di(i) where sgn( ) is 1 if has an odd number of inversions, +1 otherwise. An equivalent denition of the sign of a permutation is in terms of the number of yles in its yle deomposition. We assoiate with the matrix D the graph GD , whih is the omplete direted graph on n verties (with self-loops), having the matrix elements as edge weights. We denote by wt(e) the weight of edge e. Every permutation 2 Sn an be deomposed into a set of yles in GD . These yles are non-interseting (i.e. simple), disjoint and they over every vertex in the graph, i.e. these are yle overs. The sign of a yle over is dened in terms of the number of even length yles onstituting it. The sign is +1 if there are an even number of suh yles, else it is 1. A low in GD is a walk that starts at some vertex (alled head), visits verties larger than the head any number of times, and returns to the head. This yle in GD is not always a simple yle. Formally, Denition 1 [MV97℄ 1. A low is an ordered sequene of edges C = he1 ; e2 ; : : : ; em i suh that ei = hvi ; vi+1 i and em = hvm ; v1 i, v1 6= vj for j 2 f2; 3; : : : ; mg and v1 = minfv1 ; : : : ; vm g. The vertex v1 is alled the head of the lowQand denoted h(C ). The length of the low is jC j = m, and the weight of the low is m i=1 wt(ei ) and is denoted wt(C ). [Note: C = hei where e = hv; v i, i.e. a self-loop, is also a low, of length one.℄ 2. A low sequene P is an ordered sequene of lows C = (C1 ; : : : ; Ck ) suh that h(C1 ) < : : : < h(Ck ) and ki=1 jCi j = n. Kasteleyn [Kas67℄ introdued the use of PfaÆans to ount the number of dimer overings of a lattie graph. We dene mathings and PfaÆans more formally. We onsider only simple graphs (with no multiple edges) without self-loops. Denition 2 Given a simple loopless undireted graph G = (V; E ) with V = f1; 2; : : : ; ng: 1. A mathing M is a subset of the edges of G suh that no two edges have a vertex in ommon. That is, a mathing is a set M E (G) suh that [(i1 ; j1 ); (i2 ; j2 ) 2 M ^ (i1 = i2 )℄ , j1 = j2 2. A mathing M is a perfet mathing if every vertex i 2 V (G) ours as the end-point of some edge in M. 3 3. The weight of a mathing edges. M, denoted wt(M), is the produt of the weights of its Thus a perfet mathing is a partition of the verties of G into n2 unordered pairs, where eah pair is an edge. We will in the sequel prove our results for graphs with integer weights on edges, although our results an easily be seen to hold over arbitrary ommutative rings. Given an undireted graph G with no loops or multiple edges and with integer weights ~ . The Tutte Matrix on the edges, assign orientations to edges of G to get a direted graph G ~ assoiated with G is the skew-symmetri adjaeny matrix dened as ~ )ij As (G ~ if hi; j i is an edge in G ~ if hj; ii is an edge in G 0 if (i; j ) is not an edge in G = = = wt(i; j ) wt(i; j ) Here wt(i; j ) refers to the weight of the undireted edge (i; j ) in G. ~ of an undireted graph Let D be a skew-symmetri matrix representing an orientation G G. Let be a permutation in Sn . We an think of as representing the perfet mathing fh(1); (2)i, h(3); (4)i, : : : ; h(n 1); (n)ig. Several permutations an orrespond to the same mathing beause the edges in the mathing are neither oriented nor ordered (in fat, n there are exatly 2 2 ( n2 )! distint permutations representing eah mathing). The weight of Qn the permutation is dened as wt( ) = i2=1 d(2i 1)(2i) Consider a perfet mathing M in G. Irrespetive of whih permutation one hooses ~ is invariant2 . This to represent M, the term sgn( )wt( ) as omputed with respet to G invariant an be written as p(M) = sgn(M)wt(M). Thus orienting the graph G assigns a sign to eah perfet mathing. The PfaÆan of the oriented graph sums up these signed weights of perfet mathings. Formally, Denition 3 Given a skew-symmetri matrix ~ of an D , or equivalently, an orientation G undireted graph G over n verties, The weight of a permutation 2 Sn with respet to D is dened as n wt( ) = 2 Y =1 i d(2i 1)(2i) The PfaÆan term p(M) of a perfet mathing M is dened to be sgn( )wt( ), where 2 Sn is any permutation satisfying M = fh (1); (2)i, h (3); (4)i, : : : ; h (n 1); (n)ig. M Let and 0 both represent . If diers from 0 only in one edge being ipped, then the signs of the permutations are dierent but so are their weights (reall that D is skew-symmetri). If and 0 dier only in the arrangement of edges, then the number of transpositions to onvert to 0 is even, and therefore their signs are the same. If more than one edge is ipped, and/or the arrangement of edges is dierent, the argument an be extended. 2 Why? 4 ~ ) is dened as The PfaÆan of D (or equivalently, of G Pf (D) = X M M) p( where the sum ranges over all perfet mathings M. The anonial permutation for any mathing M, denoted M , is the permutation where edges are from smaller to larger verties and are listed in inreasing order of the smaller verties in eah edge, i.e. M (2l 1) < M (2l) for l = 1; : : : ; n2 , and M (1) < M (3) < : : : < M (n 1). Using these, the PfaÆan may be dened as Pf (D) = X M sgn(M ) wt(M ) where the sum ranges over all perfet mathings M. Consider the graph given in Figure 1. The edge weights are represented by indeterminates xa ; xb ; x ; xd ; xe . If all edges are oriented from their smaller endpoint to their larger endpoint, then the assoiated matrix D is 2 66 D=6 4 0 xa 0 xa xb xe x 0 xb xe x 0 0 xd xd 0 3 77 75 Possible Mathings (1 2) (3 4) (1 4) (2 3) (1 3) (2 4) Terms Pf (D) = xa xd + x xe +1:xa :xd +1:xe :x 1:xb :0 Eah PfaÆan term orresponds to a possible perfet mathing in the graph. The nonvanishing terms orrespond to feasible perfet mathings. e 1 4 a b 2 1 4 2 3 d 3 c Figure 1: An Example Graph Figure 2: An Oriented Example Graph Fig 2 imposes another orientation on the graph in Fig 1. Assuming that the weights of all the edges in the graph are equal to +1, this amounts to assigning +1 to xb ; x ; xe and 1 to xa and xd , and results in the matrix D given below. Now, omparing per(D), det(D) and Pf (D), we have 2 0 1 1 13 per(D) = 2 66 1 0 1 0 77 D=6 7 det(D) = 4 4 1 1 0 15 Pf (D) = 2 1 0 1 0 Linear algebra yields the following properties of skew symmetri matries D. 5 If D has an odd number of rows, then det(D) = 0. If D has an even number of rows, then det(D) = (Pf (D))2 . Denition 4 The Gap-Path funtion is dened as follows: Input : A direted ayli graph G with integer weights on its edges; three speial verties s, t+ and t of G. Output : The funtion f dened below. f= X : ;t+ s wt() X : ;t s wt( ) where iterates over all paths from s to t+ , over all s to t paths, and wt() or wt( ) is the weight of the path (i.e. the produt of the weights of all the edges on the path). GapL is preisely the lass of funtions that an be formulated (using only logarithmi spae) in this fashion. Equivalently, GapL onsists of those funtions that are the dierene of two ℄L funtions, where ℄L is the ounting lass for NL. As stated earlier, GapL is also, equivalently, the lass of languages logspae reduible to omputing the integer determinant. GapL is known to be ontained in NC; thus problems in GapL, Gap-Path inluded, have parallel algorithms requiring O(n1 ) proessors and O(log2 n) parallel time, for some onstants 1 and 2 . The Mahajan-Vinay GapL algorithm for the determinant [MV97℄ formulates the determinant in the rst way desribed above. This GapL algorithm an be used to ompute det(D), viz. [Pf (D)℄2 . However, this does not immediately yield a GapL algorithm even for the absolute value of the PfaÆan itself, beause GapL is not known to be losed under square roots. Let F1 and F2 be perfet mathings in a graph G. Their superposition, F1 [ F2 , is the graph obtained by inluding all losed walks along edges alternately from F1 and F2 . Start at a vertex and walk along its mathed edge in F1 . Next, walk along an adjaent edge in F2 . If this loses a yle, pik an unvisited vertex and start the losed walks on the remaining verties. Else, ontinue walking till there are no more mathed edges. F1 [ F2 is a yle over of G where eah yle is an alternating yle and has even length. Note that eah yle in F1 [ F2 an be routed in either of two possible diretions. Generalizing Kasteleyn's notation for yle overs on the regular 2-D lattie, we all the two possible routings lokwise and anti-lokwise. By lokwise routing we mean that routing where the rst vertex is the smallest vertex in the yle and the rst edge of a yle is piked from F1 . ~ . A yle Suppose we impose an orientation on the edges of G to get a direted graph G C in F1 [ F2 , when routed in any partiular way, may traverse some edges aording to their ~ and some edges in a diretion opposite to their orientation. An edge e on orientation in G yle C is said to be properly oriented with respet to a routing of C if this routing of C ~. traverses e aording to its orientation in G ~ if, in that routing A routing of C is said to have an even orientation with respet to G of C , the number of properly oriented edges is even. Otherwise, the routing of C has an 6 odd orientation. As every yle in the superposition of two mathings is of even length, the orientation of both routings (lokwise or anti-lokwise) of suh a yle is the same. Hene for superposition yles we refer to the orientation of the yle itself rather than of a routing of the yle. (For instane, for the graph of Figure 1 routed as in Figure 2, the yle aed has odd orientation beause if we route the yle edges in the order e d a, then the three edges e,d,a are properly oriented. Similarly, if we route the yle edges in the order e a d, then only the edge is properly oriented. The yle edb is evenly oriented if routed as edb and oddly oriented if routed as ebd.) 3 A Combinatorial Setting for PfaÆans In this setion, we build the ombinatorial framework for PfaÆans using a variant of low sequenes. This yields a ombinatorial haraterisation of PfaÆans, whih we will utilize to develop a ombinatorial algorithm for omputing PfaÆans. We rst state some results whih are essentially rephrasings of or easy derivations from standard material; see for instane [Lit74, Kas67℄. For ompleteness, we sketh proofs as well. The following is a variant of a standard lemma (See Lemma 8.3.1 from [LP86℄) for the ases when the edges have arbitrary integer weights. Lemma 5 Let ~ be an arbitrary orientation of an undireted graph G. Let F1 and F2 be G two perfet mathings of G. Let k be the number of evenly oriented alternating yles in F1 F2 . Then, p(F1 ) p(F2 ) = ( 1)k wt(F1 ) wt(F2 ) [ Sketh of Proof: [ [ F1 F2 onsists of yles of even length. Consider the ase when F1 F2 onsists of just one non-trivial yle C . Choose the lokwise routing of C . Represent F1 and F2 by those permutations and respetively, where the edges in C are listed in the order in whih they appear in this lokwise routing, and the other edges are listed identially. Now it is lear that to go from the permutation to the permutation , we need an odd number of transpositions. So the signs of these permutations are opposing. (For instane, let F1 = (1; 2)(3; 4)(5; 6)(7; 8) and F2 = (1; 6)(2; 3)(4; 5)(7; 8). The yle 123456 in F1 [ F2 implies ! ! 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 = and = . 1 2 3 4 5 6 7 8 2 3 4 5 6 1 7 8 In order to onvert to , 1 has to be moved right over ve verties.) As regards the weights, the edges for trivial yles ontribute the same to the weights of both permutations, and so the produt is idential to the produt of the weights of these edges in the mathings. A non-trivial yle ontributes the remaining weight with a 1 thrown in for eah edge traversed wrongly. So, if the number of wrongly traversed edges is ~ ), then the net ontribution is a 1 odd (i.e. the yle is oddly oriented with respet to G over and above the weights of the mathings. i.e. wt( ) wt( ) = wt(F1 ) wt(F2 ). This 1 will nullify the orresponding 1 in the produt of the signs. On the other hand, if the number of edges traversed wrongly is even, then wt( ) wt( ) = wt(F1 ) wt(F2), and the 1 in the sign is not nullied. 7 [ So, if the lone non-trivial yle C in F1 F2 is oddly oriented, then p(F1 ) p(F2 ) = wt(F1 ) wt(F2 ). It is when C is evenly oriented that a 1 is introdued, i.e. p(F1 ) p(F2 ) = wt(F1 ) wt(F2 ). Extending this argument, it is evident that if there are several non-trivial yles in F1 F2 , then a 1 is introdued by eah evenly oriented yle. This proves the lemma. [ The rst idea used for omputing the PfaÆan eÆiently is to ompute the signs of all PfaÆan terms with respet to a anonial orientation hosen as follows: Given a graph ~ whose PfaÆan is to be omputed, let D be the skew-symmetri H and an orientation H ~ ). Given any skew-symmetri matrix A, there is a unique undireted adjaeny matrix As (H graph G, with appropriate edge weights, suh that orienting eah edge of G in the forward diretion (from its smaller endpoint to its larger endpoint) gives an oriented graph Gf with skew-symmetri adjaeny matrix A. Consider the graph G and its orientation Gf obtained ~ ) = Pf(D ) = Pf(Gf ), and we ompute the signs of as above from the matrix D. Then Pf(H f PfaÆan terms as in Pf(G ) instead of diretly in Pf(H ). The seond idea is to ompute all these signs with respet to some referene mathing (possibly of zero weight). We hoose the referene mathing I orresponding to the identity permutation. And we use anonial permutations to represent eah mathing. Consider a mathing M and its superposition with I . Using Lemma 5, we an show the following. Corollary 6 sgn(M ) = ( 1)k where k is the number of yles in M [ I that are evenly oriented with respet to Gf . Proof: From Lemma 5, we have M I sgn(M ) wt(M ) wt(I ) = [sgn(M ) wt(M )℄ [sgn(I ) wt(I )℄ = p( ) p( ) = ( 1)k wt(M ) wt(I ) Therefore, sgn(M ) = ( 1)k . The standard way to haraterize the sign of a PfaÆan term is by the number of evenly oriented yles. We show below that the number of yles plus the number of properly oriented edges also haraterizes the sign. M be a partition of [n℄ into n2 unordered pairs and M be its anonial permutation. Let I be the referene partition orresponding to the identity permutation. Let M [ I have l yles, and let C denote the yle over obtained by the lokwise routing of eah yle in M [ I . The sign of M in the PfaÆan is Lemma 7 Let sgn(M ) = ( 1)jfhi;j i : hi;j i 2 C ; 8 i<j gj + l Proof: Let C have k even yles and m odd yles with respet to the forward orientation; l = k + m. Dene E = fhi; j i : hi; j i 2 C ; i < j g, the set of properly oriented edges. Let the ontributions to jE j from eah of the even and odd oriented yles be ei and oj for 1 i k P P k m and 1 j m. Thus jE j = i=1 ei + j =1 oj . Note that eah ei is even and eah oj is odd. P P Pk Pm Thus jE j + l = ki=1 ei + m j =1 oj + k + m = i=1 ei + j =1 (oj + 1) + k k mod 2. Now the result follows from Corollary 6. Corollary 8 Let M be a partition as above and I be the identity permutation. The sign of M in the PfaÆan is sgn(M ) = ( 1)jM2 j+jM3 j+l where l is the number of yles in M [ I , C is the orientation of M [ I with eah yle routed in the lokwise sense and, M2 and M3 are disjoint subsets of M dened as, M2 = M3 = fhi; 2j i : hi; 2j i 2 M \ C ; i < 2j g fhi; 2j 1i : hi; 2j 1i 2 M \ C ; i > 2j 1 g Proof: Lemma 7 tells us that we need to keep trak of the parity of properly oriented (i.e. forward) edges in the lokwise routing of yles in M [ I . Instead here, let us fous on the edges of M alone, and hold an edge of M responsible for the following I edge. Eah edge of M ontributes 0, 1 or 2 forward edges to M [ I . For instane, suppose the lokwise routing enounters edge hi; 2j 1i from M, where i < 2j 1. Then it also enounters the edge h2j 1; 2j i from I , and both these edges are properly oriented. The other ases an be argued similarly. The table below shows the partition of the edges of M into 4 sets. So, to evaluate the parity of forward edges, it suÆes to keep trak of the edges of M2 and M3 , while M1 and M4 an be ignored. Edge of M ondition as in C Part M1 M2 M3 M4 forward edge ending in odd vertex reverse edge ending in odd vertex forward edge ending in even vertex reverse edge ending in even vertex hi; 2j 1i hi; 2j 1i hi; 2j i hi; 2j i i < 2j i > 2j i < 2j i > 2j number of forward edges in C 1 2 1 1 1 0 We now introdue a new ombinatorial objet alled plows whih we will use in our ombinatorial setting for PfaÆans. (Plows expand to PfaÆan Closed Walks and p-edge stands for PfaÆan-edge.) Denition 9 A pair of edges E = (e1 ; e2 ) is a p-edge if for some i 2 [1; n℄, either 1. e1 = hi; 2j i for some j and e2 = h2j; 2j 9 1i, or 2. e1 = hi; 2j 1i for some j and e2 = h2j 1; 2j i. Figures 3 & 4 below indiate the ases when a pair of onseutive edges forms a p-edge. A plow is a low with its ordered sequene of edges being P = hE1; E2 ; : : : ; Em i where eah Ei is a p-edge. The length of the plow, denoted jP j, is 2m. A plow traversal begins from its smallest vertex (alled the head). A plow sequene is an ordered P sequene of plows, stritly inreasing order, and with li=1 jPi j = n. P = hP1; : : : ; Pl i with heads in The sign of a plow sequene is the parity of the number of evenly oriented plows with respet to Gf . The weight of a p-edge E = (e1 ; e2 ) is the weight of the edge e1 in its forward diretion, i.e. if e1 = (i; j ), its weight is wij if i < j and wji otherwise. The seond edge, e2 , always ontributes a 1 to the weight of E . The weight of a plow is the produt of the p-edge weights. The weight of a plow sequene is the produt of the weights of its plows. i ... 2j-1 2j ... i Figure 3: Seleting hi; 2j i from i. 2j-1 Figure 4: Seleting hi; 2j 2j 1i from i. Thus, if a plow sequene P atually represents a perfet mathing M, then its weight is wt(M ), and its sign is the sign of M . The results of Lemma 7 and Corollary 8 generalize to plow sequenes as well; generalising Lemma 7 gives us the following Lemma: Lemma 10 Let P be a plow sequene with l plows. Its sign is given by sign(P ) = ( 1)jfhi;j i : hi;j i 2 P ; i<j gj + l That is, the sign of a plow sequene is the parity of the number of plows in it plus the number of edges traversed in the forward diretion. Using plow sequenes, we prove a novel and powerful haraterization of the PfaÆan. This provides the basis for our ombinatorial algorithm for omputing PfaÆans. Theorem 11 Let D be a skew-symmetri matrix. Its PfaÆan is given by: Pf (D) = X W: plow sequene 10 W ) wt(W ) sgn( Proof: Plow sequenes that are yle overs are the superposition of the referene mathing with a perfet mathing. We need to show that plow sequenes that are not yle overs do not ontribute to the summation. We establish an involution on the set of plow sequenes. Non-yle overs get mapped onto non-yle overs of opposite signs. The xed points of the involution are the yle overs. Our tehnique would be to pair a plow sequene with another having the same set of edges but with an opposite sign. Consequently, they anel eah other's ontribution to the summation. Note that all plows are, by denition, even in length. However, a given sequene ould have an odd length simple yle in a plow as shown in Fig 5 & 6. To pair suh sequenes, pik the plow with the smallest head that has an odd simple sub-yle. Walk down this plow from its head, until you realize that you have gone around an odd yle. Simply reverse the orientation of all the edges in this yle. This denes a new plow sequene. Conversely, starting with the new sequene, our mapping will onsider the same (sub-)yle and reversing its edges will give us the old plow sequene; so they pair. Their total ontribution is zero, sine reversing an odd number of edges hanges the parity of the number of properly oriented edges and so ontributes a negative sign. The plows in Figures 5 & 6 are an example of the above bijetion. Figure 5: Plow with odd sub-yle Figure 6: Plow with odd sub-yle reversed We are left with plow sequenes in whih all sub-yles in all plows are even. Let = hP1 ; : : : ; Pk i be suh a plow sequene. Pik the smallest i suh that Pi+1 to Pk are disjoint simple yles. If i = 0, then P is a yle over and P maps onto itself. Else, traverse Pi till one of the following happens, P 1. We hit a vertex that meets one of Pi+1 to Pk . 2. We hit a vertex that ompletes an even length simple yle in Pi . Let v be this vertex. Note that, these two onditions are mutually exlusive beause of the way we have traversed Pi . We never hit a vertex that simultaneously satises both the onditions. Case 1: Suppose v touhes Pj , for some j 2 fi + 1; : : : ; kg. Let w be the partner of v in I . (If v is odd, then w = v + 1, else w = v 1.) Either the predeessor or the suessor of v in Pj has to be w . But in Pi , w must be the suessor of v ; if w had been the predeessor of v in Pi , then we would have stopped our traversal at w itself. The orientation of the (v; w) edge in Pj gives rise to two ases. 11 (a) If the edge in Pj is from v to w: (v ,w) is identially oriented in Pi and Pj . We simply stik Pj into Pi at v . Formally, map P to a plow sequene P 0 = hP1; : : : ; Pi 1; P 0; Pi+1; : : : ; Pj 1; Pj+1; : : : Pk i i Pi0 is obtained from Pi by inserting into it the simple yle Pj at the rst ourrene of v . Figure 7 illustrates this ase. (b) If the edge in Pj is from w to v : (v ,w) has opposite orientations in Pi and Pj . We annot stik Pj into Pi as is, beause then Pi would lose the alternating property; it would use two edges from the referene mathing onseutively. So rst reverse the orientation of all edges in Pj , and then insert this plow into Pi at the rst ourrene of v . Figure 8 shows the mapping. v h’ h’ h v v h Pj Pi P’i w w w Figure 7: Pi and Pj have (v ,w) oriented the same way. h’ v w h Pi w v Pj h’ h v P’i w Figure 8: Pi and Pj have (v ,w) oriented dierently. Case 2: Suppose v ompletes a simple yle P in Pi . P must be disjoint from all the later yles. Again, let w be the partner of v in . In Pi , w must be the suessor of v ; if w had been the predeessor of v in Pi , then a simple even yle would have been deteted at w before v and we would have stopped our traversal at w itself. We modify the plow sequene by pluking out P from Pi and introduing it as a new plow. P 's position will be to the right of Pi as the head of Pi would be smaller than that of P . Let h0 be the smallest vertex within P . There are now two sub-ases to onsider: I P 12 (a) In Pi , h0 ours at the start of a p-edge: In this ase, P forms a syntatially valid plow. We just plae P in the sequene to the right of Pi in the appropriate position ditated by P 's head. Reall that in a valid plow sequene, heads of plows must be in stritly inreasing order. This ondition uniquely determinies the position of P . Formally, map P to a plow sequene P 0 = hP1; : : : ; Pi 1; P 0; Pi+1; : : : ; Pj 1; P; Pj ; : : : Pk i i Pi0 is obtained from Pi by deleting P from it, and the index j is suh that h(Pj 1 ) < h0 = h(P ) < h(Pj ). This resulting sequene will satisfy Case 1(a) and applying the transformation there will give bak P . (b) In Pi , h0 ours in the middle of a p-edge: In this ase, P does not form a syntatially valid plow. However, the simple yle P 0 obtained by reversing all edges of P does, sine now we an start a traversal from h0 alternately using arbitrary edges and edges from I . (Note that we have splied and hanged the p-edges of P .) Again, as in the preeding ase, the position of P 0 in the plow sequene is uniquely determined by h0 , and we map the plow sequene to P 0 = hP1; : : : ; Pi 1; P 0; Pi+1; : : : ; Pj 1; P 0; Pj ; : : : Pk i i where Pi0 and j are as before. This resulting sequene will satisfy Case 1(b) and applying the transformation there will give bak P . We need to argue the orretness of these mappings. It should be lear that the new sequenes map bak to the original sequenes and hene the mapping is an involution. We now show that the mapped plow sequenes have opposing signs, and as their weights are idential, they anel eah other's ontribution. Reall that the sign is haraterized by the number of plows and the number of properly oriented edges. In nding the mapped sequenes, we hange the parity of the number of plows. The parity of the number of properly oriented edges remains unhanged, beause the reversal of a plow or an even length sub-yle preserves this. Thus, the mapped plow sequenes indeed have opposing signs. Plow sequenes arising from the superposition of the identity permutation with some perfet mathing map onto themselves. These are the sole survivors. 4 A Combinatorial Algorithm for PfaÆans In this setion we desribe a ombinatorial algorithm for omputing the PfaÆan. We onstrut a layered direted ayli graph HD with three speial verties s, t+ and t , and show that the PfaÆan of D is preisely the Gap-Path funtion (reall denition 4) evaluated on this graph. In this model of omputation, all s t+ (s t ) paths of positive (negative) sign in HD are in 1-1 orrespondene with plow sequenes of positive (negative) sign. HD has the vertex set, fs; t+ ; t g[f[p; h; u; i℄jp 2 f0; 1g; h; u 2 [1; n℄; i 2 f0; : : : ; n 1g g. A path from s to [p; h; u; i℄ indiates that in the plow sequene being onstruted along ; 13 ; this path, p is the parity of the plow sequene, h is the head of the urrent plow, u is the urrent vertex on the plow and i is the number of edges seen so far. An s t+ (s t ) path orresponds to a plow sequene having a positive (negative) sign. HD has n layers and layer i has verties of the form [ ; ; ; i℄. The edges from layer (2j -1) to layer 2j are xed and independent of D. The edges in HD are: ; 1. hs; [0; h; h; 0℄i for h = 2i 1, where i 2 [1; n2 ℄; edge weight is 1. 2. h[p; h; u; 2i℄; [ p; h; v; 2i + 1℄i, v > h, v > u, i 2 [0; n2 1℄; edge weight is duv . 3. h[p; h; u; 2i℄; [p; h; v; 2i + 1℄i, v > h, v < u, i 2 [0; n2 4. h[p; h; 2j 1; 2i 5. h[p; h; 2j; 2i 1℄; [ p; h; 2j; 2i℄i if 2j 1℄; edge weight is dvu . 1 > h, 2i < n; edge weight is 1. 1; 2i℄i if 2j 1 > h, 2i < n; edge weight is 1. 1℄; [ p; h0 ; h0 ; 2i℄i if h0 > h, h0 is odd, 2i < n; edge weight is 1. 1℄; [p; h; 2j 6. h[p; h; h + 1; 2i 7. h[0; h; h + 1; n is 1. ; 1℄; t i and h[1; h; h + 1; n 1℄; t+i if h = 2i 1, i 2 [1; n2 ℄; edge weight Theorem 12 Given a skew symmetri matrix D, let HD be the graph desribed above. Then, Pf (D) = X : s ; t+ wt() X : s ;t wt( ) ; ; Proof: We show a one-to-one orrespondene between s t+ (s t ) paths and plow sequenes of positive (negative) sign. Then, from Theorem 11 the result is immediate. We utilize our haraterization of the sign of a PfaÆan term as stated in Lemma 10. Let W = hP1 ; : : : ; Pk i be a plow Psequene. Let hi be the head of plow Pi , ni the number of forward edges in Pi , pi = (i + ij =1 nj ) mod 2 the parity of the partial plow sequene hP1; : : : ; Pii, and mi the total number of edges of the partial plow sequene hP1; : : : ; Pii. The path we onstrut for W goes through the verties [pi ; hi+1 ; hi+1 ; mi ℄. We use an indutive argument to prove our result. Suppose, after traversing hP1 ; : : : ; Pi i, we are at the vertex [pi ; hi+1 ; hi+1 ; mi ℄. In order to establish the indutive argument, it suÆes to show that starting the traversal of Pi+1 from this vertex, we will orretly reah [pi+1 ; hi+2 ; hi+2 ; mi+1 ℄. Let Pi+1 = hhi+1 ; v1 ; : : : ; vl i. As Pi+1 is a valid plow, there is an edge from [pi ; hi+1 ; hi+1 ; mi ℄ to [pi ; hi+1 ; v1 ; mi + 1℄ in HD . As we traverse Pi+1 , there will be verties of the form [p; hi+1 ; vj ; mi + j ℄ where p is the parity of pi and the number of forward edges upto vj in Pi+1 . When we reah the last vertex vl = hi+1 + 1 of Pi+1 , we would have hanged signs as many as ni+1 1 times. The last edge of any plow is always wrongly oriented and we reah [pi+1 ; hi+2 ; hi+2 ; mi+1 ℄. Lemma 10 tells us that this is the proper way to alulate the sign of a plow. At layer n, depending on whether pn is +1 or 1, HD will have an edge to t+ or t . To show the other diretion, onsider a path s t+ . If we were to list out the path, it will be a non-dereasing sequene with respet to the seond omponent of eah vertex. ; 14 Segments having the same seond omponent orrespond to a plow whose head is the seond omponent. The number of parity hanges along this segment will exatly equal the number of forward edges along the path plus one. This generates a plow sequene orresponding to the s t+ path and of even orientation parity. Similarly, eah s t path orresponds to a plow sequene of odd orientation parity. ; ; Using simple dynami programming tehniques we an evaluate Pf (D) in polynomial time. The algorithm proeeds in n stages, where in the ith stage we ompute the sum of the weighted paths from s to any vertex x in layer i. Layer n has verties t+ and t , and we ompute the dierene of the weighted paths from s to t+ and t . This algorithm looks at an edge in HD one and hene is a polynomial-time algorithm (O(n4) ring operations). There are NC algorithms for evaluating the Gap-Path funtion using standard divide-andonquer tehniques. Hene, to evaluate Pf (D), a parallel algorithm would be to onstrut a desription of HD as desribed above, and then use a parallel algorithm for Gap-Path. When D has integer entries, the entire parallel algorithm is in GapL. Thus we have: Theorem 13 Computing the PfaÆan of a skew-symmetri matrix over integers is in GapL. Corollary 14 Computing the PfaÆan of a skew-symmetri matrix over integers is omplete for GapL under uniform projetions, even when the matrix is restrited to have entries from f 1; 0; +1g. When the entries of D are from an arbitrary ommutative ring, we an still use the same algorithms, but we assume that ring operations are unit ost. With this model, the algorithm for omputing PfaÆan has omplexity as desribed below. Theorem 15 The PfaÆan of a skew-symmetri n n matrix over any ommutative ring an be omputed by an arithmeti iruit with O(n4 ) gates and depth O(log n). The gates of the iruit are of two types: (1) unbounded fanin gates omputing ring addition, and (2) bounded fanin gates omputing ring multipliation. Alternatively, the PfaÆan an be omputed by an OROW PRAM performing O(n6 ) work and running in O(log2 n) parallel time, assuming unit ost per ring operation. Complete proofs of the above theorems is omitted here beause they are idential to analogous results about determinants appearing in [MV97℄. For more details about the eÆient parallel implementations and the GapL implementation, see Setions 6.1 and 6.2 in [MV97℄, where similar algorithms for ounting all low sequenes (the denition of sign and weight is slightly dierent) are desribed; see also [Rot01℄ for a dierent NC algorithm based on the same ombinatorial haraterisation of Theorem 11. 5 Finding PfaÆan orientations for Planar graphs Counting the number of perfet mathings in a graph via PfaÆans requires: 1. Finding a PfaÆan orientation of the graph. An orientation of a graph is said to be PfaÆan if it gives the same sign to all perfet mathings. 15 2. Computing the PfaÆan of the assoiated matrix, assuming all edge weights in the undireted graph are +1. We know how to do the latter from the previous setion. We also know that the general problem of ounting the number of perfet mathings in a graph is ℄P-Complete. In this setion, we show that by restriting ourselves to planar graphs, we an nd PfaÆan orientations in GapL. This means that ounting perfet mathings in planar graphs is in GapL. We follow notation from [Kas67℄. A superposition yle is an even length yle C whih lies in the superposition of any two perfet mathings i.e. an even length simple yle for whih G V (C ) has a perfet mathing. Let G be an undireted graph, and onsider an ~ . The orientation is said to be admissible if orientation of it yielding an oriented graph G ~. every superposition yle has an odd orientation in G Lemma 16 [Kas67℄ Admissible orientations assign the same sign to all perfet mathings, i.e. they are PfaÆan. Admissible orientations ensure that eah PfaÆan term is positive, and hene the PfaÆan orretly omputes the number of perfet mathings in the graph. We show that an admissible orientation of a planar graph an be found in GapL by using a variant of Kasteleyn's algorithm. Lemma 17 Given a planar graph G along with 1. a planar ombinatorial embedding, and 2. an ordering of the faes suh that eah fae has an edge not shared with any of the earlier faes, nding an admissible orientation of G is logspae reduible to the problem of evaluating a parity tree. Proof: We rst desribe, without proof, Kasteleyn's algorithm [Kas67℄ to unover an admissible orientation. Assume that the planar graph is so enoded that the faes seen so far form a simple onneted omponent. Start with any fae and do the following, 1. Orient all unoriented edges exept one arbitrarily. 2. For the last edge, pik an orientation so that the yle bounding the fae has odd orientation parity when traversed lokwise. 3. Continue if there are unoriented faes remaining. Pik an adjoining fae suh that this fae together with the other oriented faes form a simply onneted region. Go to step 1. Planar graphs have the property that no edge is ommon to more than two faes. We utilize this property in our logspae redution. Suppose we are given the faes of the input planar graph. We an order them in many ways as per the requirements of Kasteleyn's algorithm. Atually, the real requirement of 16 Kasteleyn's algorithm is not so muh that the faes seen so far form a simple onneted region, but that eah fae has at least one edge not shared with the earlier faes. One way of nding suh an ordering of the faes, given any planar ombinatorial embedding, is desribed in [LP86℄; x any fae F (say the innite fae), and list faes in dereasing order of distane from F . Let us assume that any suh ordering is xed, say C1 ; C2 ; : : : ; Ck . With respet to this ordering and Kasteleyn's sheme, eah fae an be uniquely assoiated with an edge that has to have a spei orientation in order to maintain odd orientation parity. We denote suh an edge as the ritial edge for the fae with respet to the fae ordering. Figure 9 provides an illustration of ritial edges assoiated with faes. e1 C1 e2 C2 e3 e3 e1 ... e 2 Ci ... e5 Ck e4 critical edge dependent edge Figure 9: Critial Edges assoiated with eah yle Consider a yle Ci in Fig 9. There an be three types of edges on Ci that determine the orientation of its ritial edge. 1. Non-ritial edges whose orientations were xed in yles Cj , j < i. 2. Critial edges from the earlier yles Cj , j < i. 3. Unoriented (or fresh) edges other than the ritial edge of Ci . We have reformulated the problem of nding an admissible orientation of a planar graph to one of nding the orientations of ritial edges so that eah fae has an odd number of properly oriented edges. Let us pik a yle and nd the orientation for its ritial edge. We must examine the orientations of all other edges of this yle; they are of three types as desribed above. Oriented non-ritial edges: As their orientations are xed, we need know the parity of those among them that are properly oriented. Oriented ritial edges: The orientations of these are xed in earlier yles. The dierene being that we need to reompute them. One omputed, we take their parity. Fresh (unoriented) edges: We orient these lokwise, and hene we need to know the parity of suh edges. 17 Computing the orientation of the ritial edge of a yle requires us to know the parity of the properly oriented edges in the yle. During this omputation, on enountering a ritial edge of an earlier yle, its orientation is the outome of another parity omputation on the edges onstituting its yle. This struture repeats along every ritial edge to give us a omputation graph. We shall show that this graph is atually a tree where every internal node is a parity node. Figure 10 illustrates this struture. e3 ... critical edges non-critical edges e2 e1 ... ... Figure 10: Parity Tree for nding the orientation of ritial edges on yles Let ej be the ritial edge of an earlier fae Cj appearing in fae Ci (i.e. j < i). Finding ej 's orientation requires us to do a parity on the properly oriented edges in Cj . Consider some other ritial edge el also appearing in Ci . The omputation path from Ci along the parity node orresponding to el will never enounter ej . This is beause our input is a planar graph, and hene an edge is ommon to at most two faes. Therefore, all paths from a parity node are non-interseting, and we have our parity tree. We need to show that this is a logspae redution. Note that we are assuming that the input is niely enoded. Determining whether the urrent edge of a fae is ritial, nonritial or fresh an be easily done in logspae by sanning the preeding input. Therefore, given a parity node of the tree, we an identify the inoming ars to it within logspae. We deviate from Kasteleyn's sheme of identifying the ritial edge on a yle. We make the rst unoriented edge on a yle as the ritial edge. By doing this, things are simpler beause we now do not need to spend valuable omputational resoures to identify the last edge on the yle. We now show that parity tree evaluation is not a problem of high omplexity; in fat, Lemma 18 Parity Tree Evaluation an be done in logspae. Proof: Parity is assoiative and ommutative. Evaluating the parity of a sequene of ele- ments requires one to remember only the parity of the elements seen so far. Hene, the parity tree an be ollapsed. The parity of the leaves is therefore that of the tree. Systematially nding these leaves an be done by a logspae mahine. 18 From Theorem 13 and lemmas 17 and 18, we have Theorem 19 Given a planar graph G along with 1. a planar ombinatorial embedding, and 2. an ordering of the faes suh that eah fae has an edge not shared with any of the earlier faes, ounting the number of perfet mathings in G an be done within GapL. 6 Disussion We have desribed the rst NC algorithm for omputing the PfaÆan with its sign. This algorithm is entirely ombinatorial in nature. What is more, this algorithm is division-free. Is there any algebrai haraterisation of the sign, perhaps using divisions, that may yield an algebrai NC algorithm for the problem? This and similar questions are also raised in [Rot01℄. We have shown that given a \reasonable" enoding of a planar graph, ounting the number of perfet mathings in it is in GapL. However, aepted versions of \reasonableness" dier. What would be more satisfying is to know the omplexity of ounting the number of perfet mathings in a graph, given that the graph is planar. While this is learly still in NC, it is not immediately lear that this is still in GapL. Note that given a planar ombinatorial embedding, extrating an enoding suitable for the algorithm of Setion 5 an be done in nondeterministi logspae NL. Further, a reent paper [AM00℄ shows that a planar ombinatorial embedding an be found, if one exists, in symmetri logspae SL. However, it is not known if the harateristi funtions of NL languages are omputable in GapL. A related question that immedately arises is: what is the omplexity of planarity testing itself? Can this be done in GapL? The best known upper bound so far (parallel deterministi algorithm) is that planarity testing an be done on a CRCW PRAM in O(log n) time [RR94℄, and hene is in AC1 . This algorithm also onstruts a planar embedding, if one exists. The paper [AM00℄ further shows that planarity testing is sandwihed between the omplexity lasses deterministi logspae and symmetri logspae, and in the non-uniform setting where these lasses oinide, is omplete for that lass. However its exat omplexity in the uniform setting is still not known. For most problems, the deision, searh and ounting versions are ordered that way in inreasing diÆulty. For perfet mathings, when we restrit our attention to planar graphs, the order is reversed: ounting is easy (read NC), deision is easy but only beause one an ount, and searh is not even known to be in NC. This is a baing situation; learly, one expets an NC algorithm for searh. If the planar graph is further restrited to be bipartite, searh is also known to be in NC [MN95℄. This result was reently extended to small genus bipartite graphs [MV00℄. However, we do not know of any approah to removing the bipartite ondition. Of ourse, the big question still remains open: what exatly is the omplexity of both the deision and ounting versions of perfet mathings in general graphs? 19 Aknowledgments The authors would like to thank Gunter Rote for very helpful omments on an earlier version of the paper. The presentation in the urrent version is heavily inuened by extensive disussions the rst author had with Jaikumar Radhakrishnan and Kasturi Varadarajan. Thanks are also due to anonymous referees, whose remarks helped immensely in improving the presentation. Referenes [AM00℄ Eri Allender and Meena Mahajan. The omplexity of planarity testing. In Pro. Symposium on Theoretial Aspets of Computing (STACS). LNCS vol. 1770. Springer, 2000. To appear in Information and Computation. [ARZ99℄ E. Allender, K. Rheinhardt, and S. Zhou. Isolation, mathing and ounting: uniform and nonuniform upper bounds. Journal of Computer and System Sienes, 59:164{181, 1999. [Bar83℄ F Barahona. Balaning signed toroidal graphs in polynomial time. Preprint, University of Chile, 1983. [CGM92℄ P M Camerini, G Galbiati, and F MaÆoli. Random pseudo-polynomial algorithms for exat matroid problems. Journal of Algorithms, 13:258{273, 1992. [Dam91℄ C. Damm. DET=L(#L) . Tehnial Report Informatik{Preprint 8, Fahbereih Informatik der Humboldt{Universitat zu Berlin, 1991. [GL99℄ A Galluio and M Loebl. On the theory of PfaÆan orientations I: Perfet mathings and permanents. The Eletroni Journal of Combinatoris, R6, 1999. [GM94℄ G Galbiati and F MaÆoli. On the omputation of PfaÆans. Disrete Applied Mathematis, 51:269{275, 1994. [Kas67℄ P W Kastelyn. Graph theory and rystal physis. In F Harary, editor, Graph Theory and Theoretial Physis, pages 43{110. Aademi Press, 1967. [Knu96℄ D E Knuth. Overlapping PfaÆans. The Eletroni Journal of Combinatoris, 3(2):R5, 1996. [Lan65℄ S Lang. Algebra. Addison-Wesley, Reading, MA, 1965. [Lit74℄ C H C Little. An extension of Kasteleyn's method of enumerating the 1-fators of planar graphs. In Combinatorial Mathematis, Pro. 2nd Australian Conferene, pages 63{72. D.Holton, Leture Notes in Mathematis, 403, 1974. [LP86℄ L Lovasz and M Plummer. Mathing Theory. North-Holland, 1986. Annals of Disrete Mathematis 29. 20 [MN95℄ G Miller and J Naor. Flow in planar graphs with multiple soures and sinks. SIAM Journal on Computing, 24:1002{1017, 1995. [MV97℄ M. Mahajan and V Vinay. Determinant: ombinatoris, algorithms, omplexity. Chiago Journal of Theoretial Computer Siene http://www.s.uhiago.edu/publiations/jts, 1997:5, de 1997. Preliminary version in Proeedings of the Eighth Annual ACM-SIAM Symposium on Disrete Algorithms SODA 1997, 730{738. [MV00℄ M. Mahajan and K. Varadarajan. A new NC-algorithm for nding a perfet mathing in planar and bounded genus graphs. In Proeedings of the Thirty-Seond Annual ACM Symposium on Theory of Computing (STOC), pages 351{357, 2000. [MVV87℄ K Mulmuley, U Vazirani, and V Vazirani. Mathing is as easy as matrix inversion. Combinatoria, 7(1):105{131, 1987. [Rot01℄ Gunter Rote. Division-free algorithms for the determinant and the pfaÆan: Algebrai and ombinatorial approahes. In H. Alt, editor, Computational Disrete Mathematis: Advaned Letures, volume LNCS 2122, pages 119{135. Springer, 2001. [RR94℄ V. Ramahandran and J. Reif. Planarity testing in parallel. Journal of Computer and System Sienes, 49:517{561, 1994. [Tod91℄ S. Toda. Counting problems omputationally equivalent to the determinant. Tehnial Report CSIM 91-07, Dept of Comp S & Information Mathematis, Univ of Eletro-Communiations, Chofu-shi, Tokyo, 1991. [Val79℄ L. G. Valiant. The omplexity of omputing the permanent. Theoretial Computer Siene, 8:189{201, 1979. [Val92℄ L. G. Valiant. Why is boolean omplexity theory diÆult? In M. S. Paterson, editor, Boolean Funtion Complexity. Cambridge University Press, 1992. London Mathematial Soiety Leture Notes Series 169. [Vaz89℄ V Vazirani. NC algorithms for omputing the number of perfet mathings in K3;3 free graphs and related problems. Information and Computation, 80(2):152{164, 1989. [Vin91℄ V Vinay. Counting auxiliary pushdown automata and semi-unbounded arithmeti iruits. In Proeedings of 6th Struture in Complexity Theory Conferene, pages 270{284, 1991. [Von99℄ Jan Vondrak. Implementation and testing of a new algorithm for the Max-Cut problem. Master's thesis, Charles University, Prague, 1999. 21