Parity

Martin Loebl1

1 KAM MFF UK, Charles University, Malostranske n. 25, 118 00 Praha 1 Czech republic [email protected]

Abstract We study the Parity-Matching problem: Given a graph on n vertices with edge-weights from {0, 1, −1}, and pairs of edges p1, . . . , pg, find the maximum weight of a perfect matching M of G such that |M ∩ pi| is even for each i = 1, . . . , g. A straightforward algorithm for the Parity-Matching problem has complexity 2g × poly(n) and we wonder if any deterministic or randomized algorithm does better than that. Our study of the Parity-Matching problem is an attempt to pinpoint the curse of dimensionality of the Max-Cut problem for graphs embedded into orientable surfaces. We show that existence of an algorithm for the Parity-Matching problem beating the 2g bound implies that in the class of graphs where the crossing number is equal to the genus, the complexity of the Max-Cut problem is smaller than the additive determinantal complexity of cuts enumeration. At present, no natural class of graphs with this property is known. A well established way to approach matching problems is to determine, by means of the Isolating lemma [14], whether a coefficient of the generating function of the perfect matchings (with suitable substitutions) is non-zero. We argue that this approach will unlikely lead to an algorithm with complexity better than 2g for the Parity-Matching problem.

1998 ACM Subject Classification F.2.2 Nonnumerical Algorithms and Problems

Keywords and phrases complexity, matching, MaxCut, embedded graphs, enumeration, Pfaffian

Digital Object Identifier 10.4230/LIPIcs...

1 Introduction

Given a graph G = (V,E), a set of edges M ⊆ E is called perfect matching if the graph (V,M) has one at each vertex. Matching theory is perhaps the most developed part of and it is also closely linked to the study of algorithms and their complexity. In this paper we introduce and study a matching problem called the Parity-Matching problem: Given a graph G on n vertices with edge-weights from {0, 1, −1}, and pairs of edges p1, . . . , pg, find the maximum weight of a perfect matching M of G such that |M ∩ pi| is even for each i = 1, . . . , g. ` For a collection of disjoint pairs of edges {pi}i=1 we say that a perfect matching M of G is admissible if |M ∩ pi| is even for each i = 1, . . . , `. The Parity-Matching problem thus asks for maximum weight of an admissible perfect matching. As far as we know, the problem was not studied before; it somehow resembles the extensively studied Matroid Parity problem (see [12]). Leslie Valiant (personal communication) observed that NP-completness of the Parity-Matching problem follows in a simple way from the hardness of the Multiple choice matching problem, using techiques developed in [17]. NP-completeness is also a straightforward consequence of the results presented here. We provide evidence that the Parity-Matching problem pinpoints the time complexity as a function of the surface genus of the Max-Cut problem for graphs on surfaces. This

© Martin Loebl; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Parity Matching

problem is studied extensively e.g. in statistical physics. Experience with the embedded Max-Cut problems leads us to formulate the

Frustration Conjecture: No algorithm can solve the Parity-Matching problem with time complexity asymptotically better than 2g.

A straightforward algorithm for the Parity-Matching problem consists in solving 2g maximum weight perfect matching problems and thus has complexity 2g × poly(n). The Frustration Conjecture thus proposes that no algorithm can significantly outperform the described straightforward algorithm. We show that existence of an algorithm beating the 2g bound of the Frustration Conjecture would mean that in the class of graphs where the crossing number is equal to the genus, the complexity of the Max-Cut problem is smaller than the additive determinantal complexity of the cuts enumeration. At present, no natural class of graphs with this property is known. Let G = (V,E) be a graph. A set of edges C ⊆ E is called an edge-cut of G, if there is a V 0 ⊆ V so that C = {e ∈ E : |e ∩ V 0| = 1}. The Max-Cut problem, one of the basic optimization problems, asks for the maximum size of an edge-cut in the input graph G, or, if weights on the edges are given, for the maximum total weight of an edge-cut. Let g ≥ 0. The g-Emb-Max-Cut problem asks for the maximum total weight of an edge-cut in the input graph G given along with its embedding in the 2-dimensional closed surface of genus g.

1.1 Optimization by enumeration

The motivation of this paper is a curious phenomenon: There is a strongly polynomial algorithm to solve the 0-Emb-Max-Cut problem (planar graphs) based on a reduction to the weighted perfect matching problem. For g ≥ 1 the situation is different: There is a weakly polynomial algorithm by Galluccio and Loebl ([4]; see also [5], [6]) to solve the problem for g ≥ 1. The algorithm is called Algorithm 1 in this paper and it is sketched in the appendix. Algorithm 1 was implemented several times and applied in extensive statistical physics calculations (see [13] ). Recently other related algorithms based on the Valiant’s theory [16] of holomorphic algorithms appeared (see [1], [3]). All presently known approaches are in principle of enumeration nature, even for the toroidal square grids. The seminal observation was formulated by Kasteleyn [9] and proved by Galluccio, Loebl [4] and independently by Tesler [15]: The generating function of perfect matchings of a graph of genus g can be written as a linear combination of 4g Pfaffians. Cimasoni and Reshetikhin [2] provided a beautiful interpretation of the formula which then became known as the Arf invariant formula. The Arf invariant formula produces, together with the value of the g-Emb-Max-Cut also the number of edge-cuts of maximum total weight, and in fact the whole generating function of edge-cuts of the given graph.

1.2 Additive determinantal complexity

As mentioned above, Algorithm 1 of Galluccio and Loebl consists in calculating 22g Pfaffians. A recent result of Loebl and Masbaum [11] indicates that this might be optimum for the cuts enumeration. It is shown by Loebl and Masbaum in [11] that, if we want to enumerate the edge-cuts of each possible size of an input graph G of genus g, then in a strongly restricted setting called additive determinantal complexity the number of the Pfaffian calculations cannot be smaller than 22g. M. Loebl XX:3

1.3 Main Contribution In this paper we show that for a graph G with n vertices and embedded to the plane with g crossings, finding a maximum size of an edge-cut in G is polynomial time reducible to determining a maximum weight perfect matching M in a graph G0 which is admisible for a set of 2g pairs of G0 edges. The Frustration Conjecture is our attempt to pinpoint a puzzle: Is there an algorithm for solving the Max-Cut problem in a natural class of embedded graphs, whose complexity beats the additive determinantal complexity of the cuts enumeration. At present no such algorithm for a natural class of graphs is known. A well-established way to design a randomized algorithm for a matching problem is to determine whether some particular coefficient of a multivariable generating function of the perfect matchings (with suitable substitutions) is non-zero. In section 2 we argue that such algorithms will unlikely contradict the Frustration Conjecture.

1.4 The Exponential Time Hypothesis The Exponential Time Hypothesis (ETH) is an unproven computational hardness assumption that was formulated by Impagliazzo and Paturi [7]. ETH states that 3-SAT cannot be solved in subexponential time in the worst case. This was strenghthened by Impagliazzo, Paturi and Zane [8] to the Strong Exponential Time Hypothesis (SETH): For all d < 1 there is a k such that k-SAT cannot be solved in O(2dn) time. The ETH and SETH have a very natural role: they are used to argue that known algorithms are probably optimal. A lower bound for the time complexity of the perfect matchings enumeration in the class of graphs of genus g, assuming an enumeration variant of ETH, was recently obtained by Curticapean and Xia in [3]. Acknowledgement. This project initially started as a joint work with Marcos Kiwi. I would like to thank to Marcos for many helpful discussions.

2 The Coefficient Problem

A well-established way to approach matching problems is to determine whether a coefficient of the generating function of the perfect matchings (with suitable substitutions) is non-zero. In this section we analyse this approach for the Parity-Matching problem and argue that unlikely it disproves the Frustration Conjecture. Given a graph G = (V,E), let P(G) denote the set of all perfect matchings of G. We assume that a variable xe is associated with each edge e, we write x = (xe)e∈E(G), and define over Z[x] the generating polynomial for perfect matchings, denoted PG, as follows: X Y PG(x) = xe . M∈P(G) e∈M

2.1 Pfaffians Assume the vertices of G are numbered from 1 to n. If D is an orientation of G, we denote by A(G, D) the skew-symmetric adjacency matrix of D defined as follows: The diagonal entries of A(G, D) are zero, and the off-diagonal entries are X A(G, D)ij = ±xe , XX:4 Parity Matching

where the sum is over all edges e connecting vertices i and j, and the sign in front of xe is 1 if e is oriented from i to j in the orientation D, and −1 otherwise. As is well-known, the Pfaffian of this matrix counts perfect matchings of G with signs: X Y Pfaf A(G, D) = sign(M,D) xe , M∈P(G) e∈M

where sign(M,D) = ±1. We use this as the definition of the sign of a perfect matching M with respect to an orientation D. We denote the polynomial Pfaf A(G, D) ∈ Z[x] by FD(x) and call it the Pfaffian associated to the orientation D (for a more in depth discussion about Pfaffians see for example [10, §9.1]). Next we introduce the Coefficient problem. Coefficient problem. Input: Graph G = (V,E), positive integer k ∈ N, edge weights w : E → Z, for each edge e ∈ E a Laurent monomial Ie = Ie(y1, . . . , yd) in d auxiliary variables y1, . . . , yd, and an d integer vector (j1, . . . , jd) ∈ Z . 0 0 k Q ji Output: Yes if and only if for a k ≥ k the coefficient of z i yi is non-zero in

w(e) P (G, w, (Ie)e∈E) := PG(x)|xe:=z Ie .

In other words, following the notation of the problem’s definition, we look at the terms of the Laurent multivariable polynomial P (G, w, (Ie, ce)e∈E) where each auxiliary variable yi has exponent ji, and check if in one of them, z has exponent at least k.

2.2 Randomized algorithm

The essential randomized algorithm to solve the coefficient problem (see [14]) is based on the Isolating Lemma:

I Lemma 1 ([14]). Let (Ω, S) be a set system, i.e., if S ∈ S then S ⊂ Ω, and let |Ω| = n. Let the elements of Ω be assigned weights chosen uniformly and independently from {1,..., 2n}. Then the probability that there is a unique minimum weight set in S is at least 1/2.

In order to use this lemma for a randomized algorithm to solve the Coefficient problem, we let Ω := E and S be the set system of all the perfect matchings M ⊂ E of G with Q Q ji P e∈M Ie = i yi and e∈M w(e) maximised. Let this maximum total w−weight be denoted by W . Let D be an orientation of G. For each e ∈ E we choose weight u(e) ∈ {1,..., 2|E|} independently uniformly at random. We let

u(e) w(e) FD(G, w, (Ie, u(e))e∈E) := FD(x)|xe:=2 z Ie . The randomized algorithm for the Coefficient problem consists of the following steps: 1. We completely determine FD(G, w, (Ie, u(e))e∈E). We recall that Laurent polynomial FD(G, w, (Ie, u(e))e∈E) is a Pfaffian. 0 a Q ji Let W be the maximum exponent of z in a monomial of form z i yi with a non-zero coefficient in FD(G, w, (Ie, u(e))e∈E). 2. The algorithm answers YES if and only if W 0 ≥ k. The following observation proves correctness of the described randomized algorithm.

0 0 I Lemma 2. We have W ≤ W and with probability at least 1/2, W = W . M. Loebl XX:5

Proof. Each monomial of FD(G, w, (Ie, u(e))e∈E) is also a monomial of P (G, w, (Ie)e∈E) and thus W 0 ≤ W . Let us denote the minimum total u−weight of a set in S by U. By Lemma 1, with probability at least 1/2 there is a unique set in S with the total u−weight W Q ji equal to U. Hence, it follows that with probability at least 1/2, the coefficient of z i yi U P in FD(G, w, (Ie, u(e))e∈E) is, up to a sign, 2 + i Ui, where each Ui is in absolute value a power of 2 greater than U. It follows that with probability at least 1/2 the coefficient of W Q ji 0 z i yi is non-zero in FD(G, w, (Ie, u(e))e∈E) and thus W = W . J

2.3 The coefficient complexity

Clearly, the complexity of the described algorithm for the Coefficient problem is determined by the complexity of calculating the Pfaffian. Pfaffian is a determinant-type expression and as such it can be calculated in a polynomal time if entries are rational numbers.

Hence a realistic measure of calculation of Laurent polynomial FD(G, w, (Ie, u(e))e∈E) is the number of the substitutions we need to make in order to calculate it by interpolation. We recall from the last proof that each monomial of FD(G, w, (Ie, u(e))e∈E) is also a monomial of P (G, w, (Ie)e∈E). A choice of orientation D can thus decrease the required number of substitutions but this is hard to control. A realistic measure of the computational complexity of the coefficient problem is thus the following.

I Definition 3. The coefficient complexity of P (G, w, (Ie)e∈E) is Y (deg(z) + 1) (deg(yi) + 1), i where deg(a) = d1(a) − d2(a) and d1(a) (d2(a) respectively) denotes maximum (minimum respectively) degree of variable a in the Laurent polynomial P (G, w, (Ie)e∈E).

We can define the coefficient complexity of the general decision problem.

I Definition 4. The coefficient complexity of a general decision problem P is the smallest coefficient complexity of Laurent polynomial P (G, w, (Ie, ce)e∈E) such that problem P can be reduced in a polynomial time to a Coefficient problem associated with P (G, w, (Ie, ce)e∈E).

2.4 Reduction of the Parity-Matching problem to the Coefficient problem We say that a non-negative integer d × g matrix is useful if no (0, 1, −1)-vector belongs to its kernel. We now describe a simple way how useful matrices provide a reduction of the Parity-Matching problem to the Coefficient problem. Let the input of the Parity-Matching problem be: Graph G = (V,E) with n vertices, integer g = g(n), disjoint pairs of edges p1, . . . , pg ⊂ E, edge weights w : E → {0, 1, −1}, and 1 2 integer k ∈ N. We let pi = {ei , ei } for each i = 1, . . . , g. g Given a useful d × g matrix A and (G, w, {pi}i=1, k), we denote by C(A, G) the following input to the Coefficient problem:

C(A, G) = (G, w, (Ie(y1, . . . , yd))e∈E(G), (j1, . . . , jd), k)

Q Aj,i 1 Q −Aj,i 2 where ji = 0 for all i and Ie = j yj for e = ei , Ie = j yj for e = ei , i = 1, . . . , g, while Ie = 1 for each e ∈ E(G) \ dipi. The following observation is straightforward. XX:6 Parity Matching

R1

a2

a3 a1

R4

a4 a8 R0

R2

a7 a5

a6

R3

Figure 1 A 1-highway.

g I Lemma 5. The outputs of Parity-Matching problem with input (G, w, {pi}i=1, k), and of Coefficient problem with input C(A, G), A useful, are the same.

Clearly, the coefficient complexity of C(A, G) is determined by matrix A. We have the following observation which supports the Frustration Conjecture.

I Lemma 6. Let an integer d × g matrix A be useful. Then

d Y X g (1 + Aij) ≥ 2 . i=1 j≤g

Proof. If the inequality does not hold then there are two subsets P 6= Q ⊂ {1, . . . , g} such that the sum of the columns of A indexed by P is equal to the sum of the columns of A indexed by Q. This contradicts A being useful. J

3 Geometric considerations

In this section we build geometric notions which we use in the next section to reduce the Max-Cut problem to the Parity-Matching problem.

3.1 Surfaces

We recall the following standard description of a genus g surface Sg with one boundary component (see [10]). (We reserve the notation Σg for a closed surface of genus g.) ¯ I Definition 7. A 1-highway (see Figure 1) is a surface Sg which consists of a base polygon R0 and bridges R1,...,R2g, where R0 is a convex 4g-gon with vertices a1, . . . , a4g numbered clockwise. M. Loebl XX:7

Each R2i−1 is a rectangle with vertices x(i, 1), . . . , x(i, 4) numbered clockwise and glued to R0. Edges [x(i, 1), x(i, 2)] and [x(i, 3), x(i, 4)] of R2i−1 are identified with edges [a4(i−1)+1, a4(i−1)+2] and [a4(i−1)+3, a4(i−1)+4] of R0, respectively. Each R2i is a rectangle with vertices y(i, 1), . . . , y(i, 4) numbered clockwise and glued to R0. Edges [y(i, 1), y(i, 2)] and [y(i, 3), y(i, 4)] of R2i−1 are identified with edges [a4(i−1)+2, a4(i−1)+3] and [a4(i−1)+4, a4(i−1)+5] of R0, respectively. (Here, indices are considered modulo 4g.) Before proceeding, we point out a simple fact that we will soon exploit: the boundary of a 1-highway is isotopic to the boundary of a disk. Next, follows the standard description of a genus g surface Sg with more than one boundary component.

I Definition 8. A highway surface Sg is obtained from a 2-sphere Z with h disjoint polygons R1,...,Rh specified, and h disjoint 1-highway surfaces S¯1 ,..., S¯h , where g = g + ... + g , 0 0 g1 gh 1 h by first identifying the base polygon of each S¯i with the polygon Ri , and then by cutting gi 0 i out the interiors of these polygons R0 (i = 1, . . . , h).

Now assume the graph G is embedded into a closed orientable surface Σg of genus g. We think of Σg as Sg union h additional disks δi (i = 1, . . . , h), glued to the boundaries of Sg. By an isotopy of the embedding, we may assume that G does not meet the disks δi’s and that, moreover, no vertex of G lies in a bridge. We may also assume that the intersection of j G with any of the rectangular bridges Ri consists of disjoint straight lines connecting the j two sides of Ri which are glued to the base sphere Z.

3.2 Local non-planarity

We note that each embedding of a graph G into Σg defines its geometric dual, usually denoted by G∗, much in the same way as an embedding of a graph in the plane determines its dual graph. We consider simultaneous embeddings of the graph and its geometric dual into Σg.

I Definition 9. Let G = (V,E) be a graph. A simultaneous embedding of G into Σg consists of (1) an embedding N of graph G, and (2) an embedding N ∗ of the geometric dual G∗ = (V ∗,E∗) of N. In addition, we require that (a) G is the geometric dual of N ∗, (b) each vertex of G∗ (of G respectively) is embedded in the face of N (N ∗ respectively) it represents, (c) each pair of dual edges e, e∗ intersects exactly once, and N,N ∗ have no other ∗ intersections, and (d) both N,N are embeddings into Sg ⊆ Σg. For a collection of edges S ⊆ E we denote by S∗ ⊆ E∗ the collection of dual edges e∗ such that e ∈ S.

Since a simultaneous embedding of G into Σg is by definition an embedding into Sg ⊆ Σg, we will also call it simultaneous embedding into Sg.

I Definition 10. A simultaneous embedding of G into Sg is called even if it holds that C ⊆ E is an edge-cut of G if and only if C∗ ⊆ E∗ is an even set of G∗ which crosses each bridge of Sg an even number of times. We will call such even sets admissible. A basic example of an even simultaneous embedding is a toroidal square grid and its geometric dual.

I Definition 11. We say that a simultaneous even embedding of a graph G into some Sg is restricted if every bridge contains at most 2 segments of edges of E∗.

I Definition 12. We say that graph G belongs to class C1 if G may be drawn to the plane so that crossings of edges are allowed, but for each crossing there is a planar disc where the drawing looks as depicted in Figure 2. XX:8 Parity Matching

u

vt

w

Figure 2

u

t v

w

0 Figure 3 Simultaneous embedding of graph G ∈ C1 near a crossing. There is one pair of bridges; the boundaries of the vertical bridge are depicted by dotted lines and the boundaries of the horizontal bridge are not depicted to simplify the presentation. The edges of G0 are depicted by normal lines and the dual edges are depicted by thick lines.

I Theorem 13. If G ∈ C1, then G admits a restricted simultaneous even embedding into Sg. Proof. We let G0 be the graph obtained from G by adding, for each edge-crossing: (1) the edges uv, vw, wt, tu, and (2) one new vertex connected by double edges to the two vertices of degree 2 in Figure 2. A local embedding of G0 is described in Figure 3. We let the weights of all the new edges be zero. We consider a simultaneous local embedding of the graph G0 as described in Figure 3. The embedding is clearly restricted. We need to show that the embedding is even. We first observe that the set δ(v) of the edges of G0 incident with any vertex v of G0 satisfies that δ∗(v) intersects each bridge in an even number of segments. Since each edge-cut of G0 is the symmetric difference of some sets δ(v), we get: If C is an edge-cut of G, then C∗ is admissible. In order to prove that the embedding is even, we need to show, that each admissible set C∗ of dual edges is a symmetric difference of dual faces; this implies that C is an edge-cut. We can assume that C∗ has empty intersection with the bridges (depicted in Figure 3) since there is a dual face with exactly 2 edges on the vertical bridge and no edge on the horizontal M. Loebl XX:9 bridge, and also a dual face where the role of the two bridges is exchanged. If C∗ has no edge intersecting a local bridge, then C∗ is an even subset of an embedded . We are done if we show that each face of this planar graph is a symmetric difference of the dual faces; indeed, such a face is either a dual face itself, or it looks like the square of Figure 3 comprised of edges depicted as thick lines, which is the symmetric difference of the dual faces 0 encircling the three unlabeled vertices of G of Figure 3. J

4 Max-Cut problem and Parity-Matching problem

We show that for a graph G = (V,E) with n vertices and embedded to the plane with g edge crossings, finding a maximum size of an edge-cut in G is polynomial time reducible to determining a maximum weight perfect matching M in a graph G0 which is admisible for a set of 2g disjoint pairs of G0’s edges. The reduction goes as follows:

Step 1. We subdivide all edges of G; if e ∈ E got subdsivided into pair of edges e1, e2 then we let the weight of e1 equal to 1 and the weight of e2 equal to −1. We denote the new graph by G1 and note that the Max-Cut problem for G is reduced to the Max-Cut problem for G1. We further note that G1 ∈ C1. ∗ Step 2. We use Proposition 13. Let G1 be the dual from the restricted simultaneous ∗ even embedding of G1 into S2g. This specifies 2g pairs p1, . . . , p2g of edges of G1: each pair consists of the two edges embedded on one of the 2g bridges of S2g (see Figure 3). We note that the Max-Cut problem for G is reduced to the problem of finding maximum even set of ∗ G1 which contains an even number of elements of each pair pi, i = 1,..., 2g. ∗ 0 Step 3: Fisher’s construction. We transform G1 into G by the Fisher’s construction (see e.g. book [10]) described next.

I Definition 14. Let G be a graph. Let σ = (σv)v∈V (G) be a choice, for every vertex v, of a linear ordering of the edges incident to v. The blow-up, or ∆-extension, of (G, σ) is the graph Gσ obtained by performing the following operation one by one for each vertex v. Let e1, . . . , ed be the linear ordering σv and let ei = vui, i = 1, . . . , d. We delete the vertex v and replace it with a path consisting of 6d new vertices v1, . . . , v6d and edges vivi+1, i = 1,..., 6d − 1. To this path, we add edges v3j−2v3j, j = 1,..., 2d. Finally, we add edges v6i−4ui corresponding to the original edges e1, . . . , ed.

σ The subgraph of G spanned by the 6d vertices v1, . . . , vd that replaced a vertex v of the σ original graph will be called a gadget and denoted by Γv. The edges of G which do not belong to a gadget are in natural bijection with the edges of G. By abuse of notation, we will identify an edge of G with the corresponding edge of Gσ. Thus E(Gσ) is the disjoint union of E(G) and the various E(Γv) (v ∈ V (G)). It is important to note that different choices of linear orderings σv at the vertices of G may lead to non-isomorphic graphs Gσ. Nevertheless, one always has the following:

I Theorem 15. There is a natural bijection between the set of even subsets of G and the set of perfect matchings of Gσ. More precisely, every even set E0 ⊆ E(G) uniquely extends to a perfect matching M ⊂ E(Gσ), and every perfect matching of Gσ arises (exactly once) in this way.

∗ σ It follows that if we set the weights of the edges of the gadgets of (G1) equal to zero, we get that the value of the Max-Cut problem for G is equal to the value of the Parity-Matching ∗ σ problem for (G1) . XX:10 Parity Matching

u3

v13 u3 v12

u2 v v18 Γv

u2 v1 u1 v7

v6

u1 (a) (b)

Figure 4 For a node v with the neighborhood illustrated in (4)(a) the associated gadget Γv is depicted in (4)(b).

A Sketch of Algorithm 1.

In this section we sketch the deterministic algorithm of Galluccio and Loebl [4] to solve the g-Emb-Max-Cut problem, g ≥ 1, called Algorithm 1 in this paper. Let C(G) denote the set of all edge-cuts of G, let E(G) denote the set of all even subgraphs of G, and let P(G) denote the set of all perfect matchings of G.

We assume that a variable xe is associated with each edge e, we write x = (xe)e∈E(G), and define over Z[x] the generating polynomials for edge-cuts, even sets and perfect matchings, denoted CG, EG and PG, respectively, as follows: X Y CG(x) = xe , C∈C(G) e∈C X Y EG(x) = xe , E0∈E(G) e∈E0 X Y PG(x) = xe . M∈P(G) e∈M

Knowing the polynomial CG is equivalent to knowing the polynomial EG. Indeed, the theorem of Mac Williams (see e.g. book [10]) states that CG(x) is the same as EG(x) up to a change of variables and multiplication by a constant factor:

 Y  C (x) = 21−|V | (1 + x ) E ((z ) ) . G e G e e∈E(G) 1−xe ze := e∈E(G) 1+xe

Next, using the Fisher’s construction described in section 4, we get for the even subgraph polynomial of our original graph G:

EG = PGσ σ . (1) xe = 1, ∀e ∈ E(G )\E(G)

If D is an orientation of Gσ, we define

σ σ  F (x) = Pfaf A(G ,D) σ . D xe = 1, ∀e ∈ E(G )\E(G) M. Loebl XX:11

σ Any polynomial obtained in this way will be called a σ-projected Pfaffian. Note that FD(x) is a polynomial in the variables associated to the edges of the original graph G. Now assume G is embedded into an orientable surface Σ of genus g. It is not hard to see that we can choose σ in such a way that Gσ also embeds into Σ. We have the following result for EG:

I Theorem 16 (Galluccio-Loebl [4]). If G embeds into an orientable surface of genus g, σ g σ then for an appropriate choice of blow-up G , there exist 4 orientations Di := Di(G ) g σ (i = 1,..., 4 ) of G such that the even subgraph polynomial EG(x) can be expressed as a linear combination of the σ-projected Pfaffians F σ (x). Di Remark. We point out that the orientations D and the coefficients multiplying F σ (x), say I i Di c(Di), in the linear combination whose existence Theorem 16 guarantees can be determined in polynomial time from the embedding of G. The linear combination formula is known as the Arf invariant formula. The first step in the construction of the orientations is to change the given embedding into an embedding to the highway surface (see 8). The described theory implies the only presently known polynomial time algorithm to calculate the value of g-Emb-Max-Cut for graphs embedded in a closed surface of genus g, namely Algorithm 1. The time complexity of Algorithm 1 is a polynomial (of the input size) only if the edge-weights are bounded in the absolute value by a polynomial in n (the number of the vertices). In that case the complexity of Algorithm 1 is 22g × poly(n).

References 1 S. Bravyi, Contraction of matchgate tensor networks on non-planar graphs, Contemporary Mathematics 482 (2009). 2 D. Cimasoni, N. Reshetikhin, Dimers on surface graphs and spin structures I. Comm. Math.Phys. 275(1) (2007). 3 R. Curticapean, M. Xia, Parametrizing the Permanent: Genus, Apices, Evaluation mod 2k, Foundations of Computer Science (FOCS), IEEE Computer Society (2015). 4 A. Galluccio, M. loebl, On the theory of pfaffian orientations II. t-joins, k-cuts, and duality of enumeration, Electron. J. Combin. 6 (1999). 5 A. Galluccio, M. Loebl, J. Vondrak, A new algorithm for the Ising problem: partition function for finite lattice graphs, Physical Review Letters 84 (2000). 6 A. Galluccio, M. Loebl, J. Vondrak, Optimization via enumeration: a new algorithm for the Max Cut problem, Mathematical Programming 90 (2001). 7 R. Impagliazzo, R. Paturi, On the Complexity of k-SAT, J. Comput. Syst. Sci., 62(2) (2001), 367-–375. 8 R. Impagliazzo, R. Paturi, F. Zane, Which Problems Have Strongly Exponential Complex- ity?, J. Comput. Syst. Sci., 63(4) (2001), 512—530. 9 P. Kasteleyn, Graph theory and crystal physics, in: Graph theory and theoretical physics, Academic Press, London (1967). 10 M. Loebl, Discrete mathematics in statistical physics, Vieweg and Teubner 2010. 11 M. Loebl, G. Masbaum, On the optimality of the Arf invariant formula for graph polyno- mials, Advances in Mathematics 226 (2011). 12 L. Lovasz, Matroid matching and some applications, Journal of Combinatorial Theory-B, 28 (1980). 13 J. Lukic, A. Galluccio, E. Marinari, O.C. Martin, G. Rinaldi, Critical Thermodynamics of the Two-Dimensional +/-J Ising Spin Glass, Physical Review Letters 92 (11) (2004). XX:12 Parity Matching

14 K. Mulmuley, U.V. Vazirani, V.V. Vazirani, Matching is as easy as matrix inversion, In Proceedings of the 19th Annual ACM Symposium on Theory of Computing, STOC’87 (1987), 345– 354. 15 G. Tesler, Matchings in graphs on Non-orientable Surfaces, Journal of Combinatorial Theory-B, 78 (2000). 16 L. Valiant, Holographic Algorithms (Extended Abstract), Foundations of Computer Science (FOCS), IEEE Computer Society (2004). 17 L. Valiant, The complexity of computing the permanent, Theoretical Computer Science 8,2 (1979).