Space Complexity of Perfect Matching in Bounded Genus Bipartite Graphs

Samir Datta, Raghav Kulkarni, Raghunath Tewari, N. V. Vinodchandran

Introduction

The perfect matching problem and its variations are one of the most well-studied problems in theoretical computer science. Research in understanding the inherent complexity of computational problems related to matching has lead to important results and techniques in complexity theory and elsewhere in theoretical computer science. However, even after decades of research, the exact complexity of many problems related to matching is not yet completely understood.

We investigate the space complexity of certain well studied perfect matching problems over bipartite graphs. We prove new uniform space complexity upper bounds on these problems for graphs embedded on surfaces of constant genus. We prove our upper bounds by solving the technical problem of ‘deterministically isolating’ a perfect matching for this class of graphs.

Distinguishing a single solution out of a set of solutions is a basic algorithmic problem with many applications. The isolating lemma due to Mulmulay, Vazirani, and Vazirani provides a general randomized solution to this problem. Let F{\cal F} be a non-empty set system on U={1,…,n}U=\{1,\ldots,n\}. The isolating lemma says, for a random weigh function on UU (bounded by nO(1)n^{O(1)}), with high probability there is a unique set in F{\cal F} of minimum weight [MVV87]. This lemma was originally used to give an elegant \RNC algorithm for constructing a maximum matching (by isolating a minimum weight perfect matching) in general graphs. Since its discovery, the isolating lemma has found many applications, mostly in discovering new randomized or non-uniform upper bounds, via isolating minimum weight solutions [MVV87, RA00, GW96, ARZ99]. Clearly, derandomizing the isolating lemma in sufficient generality will improve these upper bounds to their deterministic counterparts and hence will be a major result. Unfortunately, recently it is shown that such a derandomization will imply certain circuit lower bounds and hence is a difficult task [AM08].

Can we bypass isolating lemma altogether and deterministically isolate minimum weight solutions in specific situations? Recent results illustrate that one may be able to use the structure of specific computational problem under consideration to achieve non-trivial deterministic isolation. In [BTV09], the authors used the structure of directed paths in planar graphs to prescribe a simple weight function that is computable deterministically in logarithmic space with respect to which the minimum weight directed path between any two vertices is unique. In [DKR08], the authors isolated a perfect matching in planar bipartite graphs. In this paper we extend the deterministic isolation technique of [DKR08] to isolate a minimum weight perfect matching in bipartite graphs embedded on constant genus surfaces.

Let GG be a bipartite graph with weight function ww on it edges. For an even cycle C=e1e2⋯e2kC=e_{1}e_{2}\cdots e_{2k}, the circulation of CC with respect to ww is the sum ∑i=12k(−1)iw(ei)\sum_{i=1}^{2k}(-1)^{i}w(e_{i}). The main technical contribution of the present paper can be stated (semi-formally) as follows.

Main Technical Result. There is a logspace matching preserving reduction ff, and a logspace computable and polynomially bounded weight function ww, so that given a bipartite graph GG with a combinatorial embedding on a surface of constant genus, the circulation of any simple cycle in f(G)f(G) with respect to ww is non-zero. (This implies that the minimum weight perfect matching in f(G)f(G) is unique [DKR08]).

We use this result to establish (using known techniques) the following new upper bounds. Refer to the next section for definitions.

New Upper Bounds. For bipartite graphs, combinatorially embedded on surfaces of constant genus the problems \isMatch and \isUniqueMatch are in \SPL, and the problem \constructMatch is in \FL\SPL\FL^{\SPL}.

is a logspace complexity class that was first studied by Allender, Reinhardt, and Zhou [ARZ99]. This is the class of problems reducible to the determinant with the promise that the determinant is either 0 or 1. In [ARZ99], the authors show, using a non-uniform version of isolating lemma, that perfect matching problem for general graphs is in a ‘non-uniform’ version of \SPL. In [DKR08], using the above-mentioned deterministic isolation, the authors show that for planar bipartite graphs, \isMatch is in fact in \SPL (uniformly). Recently, Hoang showed that for graphs with polynomially many matchings, perfect matchings and many related matching problems are in \SPL [Hoa09]. \SPL is contained in logspace counting classes such as \modkl\modkl for all k≥2k\geq 2 (in particular in ⊕\L\oplus\L), \PL, and \ceql\ceql, which are in turn contained in \NC2\NC^{2}. Thus the upper bound of \SPL that we prove implies that the problems \isMatch and \isUniqueMatch for the class of graphs we study are in these logspace counting classes as well.

The techniques that we use in this paper can also be used to isolate directed paths in graphs on constant genus surfaces. This shows that the reachability problem for this class of graphs can be decided in the unambiguous class \UL\UL, extending the results of [BTV09]. But this upper bound is already known since recently Kynčl and Vyskočil show that reachability for bounded genus graphs logspace reduces to reachability in planar graphs [KV09].

Matching problems over graphs of low genus have been of interest to researchers, mainly from a parallel complexity viewpoint. The matching problems that we consider in this paper are known to be in \NC. In particular in [KMV08], the authors present an \NC2\NC^{2} algorithm for computing a perfect matching for bipartite graphs on surfaces of O(log⁡n)O(\log n) genus (readers can also find an account of known parallel complexity upper bounds for matching problems over various classes of graphs in their paper). However, the space complexity of matching problems for graphs of low genus has not been investigated before. The present paper takes a step in this direction.

Proof Outline. We assume that the graph GG is presented as a combinatorial embedding on a surface (orientable or non-orientable) of genus gg, where gg is a constant. This is a standard assumption when dealing with graphs on surfaces, since it is NP-complete to check whether a graph has genus ≤g\leq g [Tho89]. We first give a sequence of two reductions to get, from GG, a graph G′G^{\prime} with an embedding on a genus gg ‘polygonal schema in normal form’. These two reductions work for both orientable and non-orientable cases. At this point we take care of the non-orientable case by reducing it to the orientable case. Once we have the embedding on an orientable polygonal schema in normal form, we further reduce G′G^{\prime} to G′′G^{\prime\prime} where G′′G^{\prime\prime} is embedded on a constant genus ‘grid graph’. These reductions are matching preserving, bipartiteness preserving and computable in logspace. Finally, for G′′G^{\prime\prime}, we prescribe a set of 4g+14g+1 weight functions, W={wi}1≤i≤4g+1\mathcal{W}=\{w_{i}\}_{1\leq i\leq 4g+1}, so that for any cycle CC in G′′G^{\prime\prime}, there is a weight function wi∈Ww_{i}\in\mathcal{W} with respect to which the circulation of CC is non-zero. Since gg is constant, we can take a linear combination of the elements in W\mathcal{W}, for example ∑wi∈Wwi×(nc)i\sum_{w_{i}\in\mathcal{W}}{w_{i}\times\left(n^{c}\right)^{i}} (where nn is the number of vertices in the grid) for some fixed constant cc (say c=4c=4), to get a single weight function with respect which the circulation of any cycle is non-zero.

The intuition behind these weight functions is as follows (for some of the definitions, refer to later sections). The set W{\mathcal{W}} is a disjoint union W1∪W2∪{w}\mathcal{W}_{1}\cup\mathcal{W}_{2}\cup\{w\} of the sets of weight functions W1\mathcal{W}_{1}, W2\mathcal{W}_{2}, and {w}\{w\}. Consider a graph GG embedded on a fundamental polygon with 2g2g sides. There are two types cycles in GG: surface separating and surface non-separating. A basic theorem from algebraic topology implies that a surface non-separating cycle will intersect at least one of the sides of the polygon an odd number of times. This leads to 2g2g weight functions in W1\mathcal{W}_{1} to take care of all the surface non-separating cycles. There are two types of surface separating cycles: (a) ones which completely lie inside the polygon and (b) the ones which cross some boundary. Type (a) cycles behaves exactly like cycles in plane so the weight function ww designed for planar graphs works (from [DKR08]). For dealing with cycles of type (b), we first prove that if such a cycle intersects a boundary, it should alternate between ‘coming in’ and ‘going out’. This leads to 2g2g weight functions in W2\mathcal{W}_{2} which handle all type (b) cycles.

Figure 1 gives a pictorial view of the components involved in the proof of our main technical result.

The rest of the paper is organized as follows. In Section 22 we give the necessary definitions and state results from earlier work, that we use in this paper. In Section 33 we state and prove our upper bounds assuming a grid embedding. In Section 44 we reduce the non-orientable case to the orientable one. In Section 55 we give matching preserving, logspace reductions from a combinatorial embedding of the graph on a surface of genus gg, to a grid embedding. In Section 66 we add proofs of some necessarylemmas and theorems that we use to prove our results.

Preliminaries

We introduce the necessary terminology from algebraic topology. For a more comprehensive understanding of this topic, refer to any standard algebraic topology book such as [Mas91].

A polygonal schema of a surface Γ\Gamma, is a polygon with 2g′2g^{\prime} directed sides, such that the sides of the polygon are partitioned into g′g^{\prime} classes, each class containing exactly two sides and glueing the two sides of each equivalence class gives the surface Γ\Gamma (upto homeomorphism). A side in the iith equivalence class is labelled σi\sigma_{i} or σiˉ\bar{\sigma_{i}} depending on whether it is directed clockwise or anti-clockwise respectively. The partner of a side σ\sigma is the other side in its equivalence class. By an abuse of notation, we shall sometimes refer to the symbol of a side’s partner, as the partner of the symbol. Frequently we will denote a polygonal schema as a linear ordering of its sides moving in a clockwise direction, denoted by XX. For a polygonal schema XX, we shall refer to any polygonal schema which is a cyclic permutation, or a reversal of the symbols, or a complementation (σ\sigma mapped to σˉ\bar{\sigma} and vice versa) of the symbols, as being the same as XX. A polygonal schema is called orientable (resp. non-orientable) if the corresponding surface is orientable (resp. non-orientable).

An orientable polygonal schema is said to be in normal form if it is in one of the following forms:

A non-orientable polygonal schema is said to be in normal form if it is of one of the following forms:

where, XX is a string representing an orientable schema in normal form (i.e. like Form 2.1 or 2.2 above).

We denote the polygonal schema in the normal form of a surface Γ\Gamma as Λ(Γ)\Lambda(\Gamma). We will refer to two orientable symbols σ,τ\sigma,\tau which form the following contiguous substring: στσˉτˉ\sigma\tau\bar{\sigma}\bar{\tau} as being clustered together while a non-orientable symbol σ\sigma which occurs like σσ\sigma\sigma as a contiguous subtring is said to form a pair. Thus, in the first and third normal forms above all symbols are clustered. The first normal form represents a connected sum of torii and the third of a projective plane and torii. In the fourth normal form all but one of the orientable symbols are clustered while the only non-orientable symbol is sort of clustered with the other orientable symbol. This form represents a connected sum of a Klein Bottle and torii. The second normal form represents a sphere.

An undirected graph GG is said to be embedded on a surface Γ\Gamma if it can be drawn on Γ\Gamma so that no two edges cross. We assume that the graph is given with a combinatorial embedding on a surface of constant genus. Refer to the book by Mohar and Thomassen [MT01] for details. A graph GG is said to have genus gg if GG has a minimal embedding (an embedding where every face of GG is homeomorphic to a disc) on a genus gg surface. Such an embedding is also called a 2-cell embedding. A genus gg graph is said to be orientable (non-orientable) if the surface is orientable (non-orientable).

The polygonal schema of a graph GG is a combinatorial embedding given on the polygonal schema of some surface Γ\Gamma together with the ordered set of vertices on each side of the polygon. Formally it is a tuple (ϕ,S)(\phi,\mathcal{S}), where ϕ\phi is a cyclic ordering of the edges around a vertex and S=(S1,S2,…,S2g)\mathcal{S}=(S_{1},S_{2},\ldots,S_{2g}) is the cyclic ordering of the directed sides of the polygon. Each SiS_{i} is an ordered sequence of the vertices, from the tail to the head of the side SiS_{i}. Moreover every SiS_{i} is paired with some other side, say Si−1S_{i}^{-1} in S\mathcal{S}, such that the jjth vertex of SiS_{i} (say from the tail of SiS_{i}) is the same as the jjth vertex of Si−1S_{i}^{-1} (form the tail of Si−1S_{i}^{-1}).

2 Complexity Theory

For a nondeterministic machine MM, let accM(x){\it acc}_{M}(x) and rejM(x){\it rej}_{M}(x) denote the number of accepting computations and the number of rejecting computations respectively. Denote gapM(x)=accM(x)−rejM(x){\it gap}_{M}(x)={\it acc}_{M}(x)-{\it rej}_{M}(x).

A language LL is in \SPL\SPL if there exists a logspace bounded nondeterministic machine MM so that for all inputs xx, gapM(x)∈{0,1}{\it gap}_{M}(x)\in\{0,1\} and x∈Lx\in L if and only if gapM(x)=1{\it gap}_{M}(x)=1. \FL\SPL\FL^{\SPL} is the class of functions computed by a logspace machine with an \SPL oracle. \UL is the class of languages LL, decided by a nondeterministic logspace machine (say MM), such that for every string in LL, MM has exactly one accepting path and for a string not in LL, MM has no accepting path.

Alternatively, we can define \SPL as the class of problems logspace reducible to the problem of checking whether the determinant of a matrix is or not under the promise that the determinant is either or 11. For definitions of other complexity classes refer to any standard textbooks such as [AB09, Vol99]. All reductions discussed in this paper are logspace reductions.

Given an undirected graph G=(V,E)G=(V,E), a matching MM is a subset of EE such that no two edges in MM have a vertex in common. A maximum matching is a matching of maximum cardinality. MM is said to be a perfect matching if every vertex is an endpoint of some edge in MM.

We define the following computational problems related to matching:

: Given a bipartite graph GG, checking if GG has a perfect matching.

: Given a bipartite graph GG, constructing a perfect matching, if one exists.

: Given a bipartite graph GG, checking if GG has a unique perfect matching.

3 Necessary Prior Results

For any bipartite graph GG and a weight function ww, if all circulations of GG are non-zero, then GG has a unique minimum weight perfect matching.

For any weighted graph GG assume that the minimum weight perfect matching in GG is unique and also for any subset of edges E′⊆EE^{\prime}\subseteq E, the minimum weight perfect matching in G∖E′G\setminus E^{\prime} is also unique. Then deciding if GG has a perfect matching is in \SPL. Moreover, computing the perfect matching (in case it exists) is in \FL\SPL\FL^{\SPL}.

By definition, g(G)=1g(G)=1 if GG has a perfect matching, else it is .

To compute a perfect matching in GG, we will construct a logspace transducer that makes several queries to the function ff defined above. For a graph G′G^{\prime} having a unique minimum weight perfect matching (say M′M^{\prime}), the weight of M′M^{\prime} can be computed by iteratively querying the function f(G′,k)f(G^{\prime},k) for values of k∈Wk\in W in an increasing order, starting from n⋅wminn\cdot w_{min}. The value kk, for which the function outputs a non-zero value for the first time, is the weight of M′M^{\prime}. We denote this weight by wG′w_{G^{\prime}}. First compute wGw_{G}. For an ee in GG, define the graph G−e=G∖{e}G^{-e}=G\setminus\{e\}. Now compute wG−ew_{G^{-e}} for every edge ee in GG. Output the edges ee for which wG−e>wGw_{G^{-e}}>w_{G}. The set of outputted edges comprise a perfect matching (in fact the minimum weight perfect matching) because deleting an edge in this set had increased the weight of the minimum weight perfect matching in the resulting graph. ∎

Embedding on a Grid

Given a 2-cell combinatorial embedding of a graph GG of constant genus, there is a logspace transducer that constructs a graph G′∈\GGG^{\prime}\in\GG, such that, there is a perfect matching in GG iff there is a perfect matching in G′G^{\prime}. Moreover, given a perfect matching M′M^{\prime} in G′G^{\prime}, in logspace one can construct a perfect matching MM in GG.

Using Corollary 7 reduce GG to a graph G1G_{1} that has an embedding on the polygonal schema in the normal form. If the schema is non-orientable, then by applying Theorem 18 we get a graph G2G_{2} along with its embedding on an orientable polygonal schema (need not be in the normal form). Again by Corollary 7, we reduce it to a graph on a polygonal schema in the normal form. Finally we apply Lemma 8, we get the desired graph. ∎

Let GG be a graph embedded on a surface, and let TT be a spanning tree of GG. Then there is an edge e∈E(G)e\in E(G) such that T∪{e}T\cup\{e\} contains a non-separating cycle.

Notice that in [ABC+09] the graph was required to be embedded on an orientable surface but the proof did not use this requirement.

Given a cycle (or path) CC in an embedded graph GG, define by G\mbox\LeftScissorsCG\mbox{\LeftScissors}C the graph constructed by “cutting” the edges incident on the cycle from the right. In other words, the neighbors of u∈Cu\in C (which are not on the cycle) can be partitioned into two sets, arbitrarily called left and right. For every neighbbor vv of uu which lies to the right of CC, cut the edge (u,v)(u,v) into two pieces (u,xuv)(u,x_{uv}) and (yuv,v)(y_{uv},v) where xuv,yuvx_{uv},y_{uv} are (new) spurious vertices. We add spurious edges between consecutive spurious vertices along the cut and label all the newly formed spurious edges with the label LCL_{C} along the left set and LC−1L_{C}^{-1} along the right set. (see Figure 2).

Also, if CC is a path, its endpoints will lie on two paths. Consider the first path - if the two edges on either side of CC on this path have the same label L1L_{1}. This can be broken into two cases - firstly, if the left and right side of this endpoint are the same (in other words, the path is a cycle). In this case, we just keep the same label L1L_{1}. When the left and right side of this endpoint are distinct, we will need to split the label into two or three new labels as detailed below and similarly for the other path and common label L2L_{2}. We will only describe the case when L1,L2L_{1},L_{2} are both defined - the other cases are similar and simpler.

First assume that L1≠L2L_{1}\neq L_{2} and L1≠L2−1L_{1}\neq L_{2}^{-1}. Then we will split remove labels L1,L2L_{1},L_{2} and replace them by four new labels say L1,C′,L1,C′′L^{\prime}_{1,C},L^{\prime\prime}_{1,C} and L2,C′,L2,C′′L^{\prime}_{2,C},L^{\prime\prime}_{2,C}, respectively for the two sides of the intersection. If, on the other hand, L1L_{1} is the same as L2L_{2} or its inverse - then there are two subcases. Firstly, if the path CC is between two copies of the same vertex then we replace L1L_{1} by two new labels L1,C′,L1,C′′L^{\prime}_{1,C},L^{\prime\prime}_{1,C} one for either side of the cut. L2L_{2} being a copy or an inverse copy of L1L_{1} splits automatically. The second case is if CC is between two distinct points on two copies or inverse copies. Then we split L1L_{1} into three parts according to the two points. The rotation system is modified appropriately. We illustrate this in Figure 3.

Notice that in the process of cutting, for every new label LCL_{C} we are adding at most 44 new labels.

Given a graph GiG_{i} embedded on a surface, potentially with spurious edges, we can find Ci+1C_{i+1}, a non-separating cycle (which does not use a spurious edge) by invoking Lemma 4. Define Gi+1G_{i+1} to be Gi\mbox\LeftScissorsCi+1G_{i}\mbox{\LeftScissors}C_{i+1}.

Starting with G0=GG_{0}=G of genus gg and repeating the above operation at most gg times, we get a planar graph HH with at most 2g2g spurious faces (which consist of spurious vertices and edges).

Now find a spanning tree of this graph which does not use a spurious edge - that such a tree exists follows from noticing that the graph without spurious edges is still connected. Find a tree path connecting any two spurious faces. Cut along this path to combine the two spurious faces into one larger spurious face. Repeat the operation till all the spurious faces are merged into one spurious face and re-embed the planar graph so that it forms the external face.

It is easy to see that the procedure above can be performed in logspace, provided that gg is constant. Thus we have sketched the proof of the following:

Given the combinatorial embedding of a constant genus graph we can find a polygonal schema for the graph in logspace.

0.2 Normalizing a Polygonal Schema

We adapt the algorithmic proof of Brahana-Dehn-Heegaard (BDH) [Bra21, DH07] classification theorem as described in Vegter-Yap [VY90] so that it runs in logspace for constant genus graphs. The algorithm starts with a polygonal schema and uses the following five transforms O(m)O(m) times to yield a normalized polygonal schema, where the original polygonal schema has 2m2m sides.

Replace XσσˉX\sigma\bar{\sigma} by XX (Example given in Figure 4).

Replace στXτˉY\sigma\tau X\bar{\tau}Y by ρXρˉσY\rho X\bar{\rho}\sigma Y (Example given in Figure 5).

Replace σXσY\sigma X\sigma Y by ττY∗X\tau\tau Y^{*}X, where Y∗Y^{*} is reverse complement of YY (Example given in Figure 6).

Replace σXτYσˉUτˉV\sigma X\tau Y\bar{\sigma}U\bar{\tau}V by ρπρˉπˉUYXV\rho\pi\bar{\rho}\bar{\pi}UYXV (Example given in Figure 7).

Replace σ1σ1Xσ2σ3σ2ˉσ3ˉY\sigma_{1}\sigma_{1}X\sigma_{2}\sigma_{3}\bar{\sigma_{2}}\bar{\sigma_{3}}Y by τ1τ1τ2τ2τ3τ3XY\tau_{1}\tau_{1}\tau_{2}\tau_{2}\tau_{3}\tau_{3}XY (Example given in Figure 8).

Replace σσττX\sigma\sigma\tau\tau X by σρσˉρX\sigma\rho\bar{\sigma}\rho X (Example given in Figure 9).

Use reductions A,B,C several times to ensure that all the sides of the polygonal schema have a common endpoint.

Orientable case: Use transform D repeatedly to bring the polygon in normal form.

Use reductions C,D to convert the schema into a form where the orientable symbols are clustered and non-orientable symbols are paired

Use reduction E repeatedly (in the forward direction) to eliminate all orientable symbols.

Use Reduction E in the reverse direction repeatedly to eliminate all but at most one non-orientable symbol.

Use Reduction F, if necessary, to ensure that there is at most one non-orientable symbol.

Possibly, the only step requiring any explanation is the last one. We apply Reduction E in reverse with XX as the empty string to replace three non-orientable symbols by two orientable ones forming a cluster of 44 and a single non-orientable one which forms a pair. The way we apply the reduction, ensures that both the orientable and the non-orientable parts are contiguous.

Fianlly we will be left with a string in one of the first two normal forms or a string of the form σσττX\sigma\sigma\tau\tau X (where XX is an orientable schema in normal form) in which case Reduction F is applicable.

To see that the above procedure can be carried out in Ł it suffices to prove that each of the above reductions can be carried out in Ł, the number of reductions is bounded by a constant and we can decide in Ł when to carry out a reduction.

The Vegter-Yap paper does careful book-keeping in order to ensure that the number of operations in Step 1 is linear in the original genus. We can alternatively, follow the brute force approach and keep on applying Reductions A,B,C while the sides of the polygon do not have a common end-point. This will require at most linear number of applications of the first two reductions.

Observe that for the orientable case, each application of reduction D reduces the number of unclustered symbols by two. Thus we are done in O(m)O(m) applications of this reduction. Similarly, each application of reduction C reduces the number of unpaired non-orientable symbols by one and as before every application of reduction D reduces the number of unclustered orientable symbols by two. So in O(m)O(m) steps all the orientable symbols are clustered and the non-orientable symbols are paired. Now every application of reduction E in the forward direction gets rid of two orientable symbols so in O(m)O(m) steps all the orientable symbols are removed. Finally O(m)O(m) applications of reduction E in reverse lead to removal of all but one non-orientable symbols.

To see that each of the steps is in Ł observe that each of the steps involves one or more of the following operations:

find a path through the interior of the polygon between two points on its boundary

paste two paired sides of (a cut) polygon together

We know how to do the second operation in Ł while the third, being the reverse of the second one is even easier, since we just have to identify corresponding spurious vertices and then excise them out of the corresponding edge. The first operation is just an undirected reachability question in the graph (minus its boundary) hence is in Ł by Reingold’s Theorem.

Finally, a determination of when to apply a particular reduction is easily seen to be in Ł for all but, possibly, reduction D. In this case, for an orientable symbol σ\sigma separated from its mate σˉ\bar{\sigma} on both sides, sequentially test for each other symbol τ\tau if it lies in one of the two stretches that σ\sigma and its mate divide the schema into, while its mate τˉ\bar{\tau} lies in the other. Having found the first such τ\tau suffices to enable a use of the reduction.

Thus, using the above argument and Lemma 5 we have sketched the proof of the following theorem:

Given a combinatorial embedding of constant genus, say gg (which is positive or otherwise), for a graph GG, in logspace we can find a polygonal schema for the graph in normal form. of genus O(∣g∣)O(|g|) in magnitude, and also the corresponding combinatorial embedding.

Let \kGonBi be the class of constant genus, bipartite graphs along with an embedding given on the polygonal schema in normal form of the surface in which the graph has an embedding. Moreover, for every graph in this class, no edge has both its end points on the boundary of the polygon.

At this point, there are no vertices lying on the boundary of the polygonal schema, only edges crossing it. It is easy to see that for each such edge e=(u,v)e=(u,v) which has two halves lying on segments of the polygon, if we introduce internal vertices u′=v′,v′′u^{\prime}=v^{\prime},v^{\prime\prime} on the edge (converting it to a path u,u′=v′,v′′,vu,u^{\prime}=v^{\prime},v^{\prime\prime},v) so that u′,v′u^{\prime},v^{\prime} lie on the boundary of the polygon on the sides nearer to u,vu,v respectively, then, because the path has odd length the number of perfect matchings in the modified graph is preserved.

Given the combinatorial embedding of a graph of constant genus, there is an logspace reduction, which preserves perfect matchings, to a graph in the class \kGonBi.

0.3 From Polygonal Schema in normal form to a Grid

If GG is an orientable graph in \kGonBi, then one can get a logspace, matching-preserving reduction form GG to a graph H∈\GGH\in\GG

We start with a graph G∈\kGonBiG\in\kGonBi and construct a graph H∈\GGH\in\GG such that the number of perfect matchings in GG and HH are the same.

We can assume that the maximum degree of GG is 33 and there exists a vertex ss of degree 22 [KMV08]. Think of GG as a planar graph. Reduce GG to a grid graph G′G^{\prime} using [ABC+09]. It follows from the reduction that faces are preserved (modulo subdivision of edges). Let TT be the spanning tree of GG constructed by the algorithm that would be embedded on the course grid and let T′T^{\prime} be the tree corresponding to TT in G′G^{\prime}. Every vertex (say vv) on boundary of the polygon in GG is a leaf node since every edge has at most one of its end points on the boundary of the polygon (by definition of \kGonBi). Therefore vv is also a leaf in TT. Let ss be the root of TT and h(u)h(u) be the height of a vertex uu in TT. It follows from the reduction that h(u)h(u) is the value of its yy-coordinate in G′G^{\prime}.

For the rest of this proof we will use the notation u′u^{\prime} and v′v^{\prime} to denote the respective copies of some two vertices uu and vv in GG. Now subdivide every horizontal edge in G′G^{\prime} into 22 edges to get the grid graph G′′G^{\prime\prime}. This ensures that the horizontal distance between the copies of any two vertices in G′G^{\prime} is even. First claim is that the number of matchings in GG and G′′G^{\prime\prime} are the same. To see this it is enough to show that: e=(u,v)e=(u,v) is an edge in GG iff any simple path from u′u^{\prime} to v′v^{\prime} has odd length. If ee is a tree edge then the vertical distance between u′u^{\prime} and v′v^{\prime} is 11 and the horizontal distance is even. Thus the distance between them on the grid is odd and therefore any path between them on the grid has odd length. Similarly, if ee is a non-tree edge, then h(u)h(u) and h(v)h(v) have different parity and therefore the vertical distance between them is odd.

Now we will see how to construct the grid graph HH as required by the Lemma. Let G′′G^{\prime\prime} be a m1×m2m_{1}\times m_{2} grid. Construct an empty grid HH, of size (m1+2)×(m2+2)(m_{1}+2)\times(m_{2}+2). Place the grid G′′G^{\prime\prime} on HH so that G′′G^{\prime\prime} lies properly inside the grid (that is no edge of G′′G^{\prime\prime} has an end point on any of the boundary vertices of HH). Suppose two vertices uu and vv in GG get identified when GG is thought of as a genus gg graph. Then from our earlier observation we have that both u′u^{\prime} and v′v^{\prime} must be leaf nodes and lie on the outer face of G′′G^{\prime\prime}. Also h(u)h(u) and h(v)h(v) must have the same parity, since otherwise we can construct an odd cycle in GG by traversing from ss to uu (which is the same as vv) and back to ss via vv. This implies that the yy-coordinate of both u′u^{\prime} and v′v^{\prime} in G′′G^{\prime\prime} has the same parity. Drop a path from uu (and similarly a path from vv) by going down all the way to the south border of HH. Observe that the sum of the lengths of these two paths is even. This is because, the difference in their yy-coordinates is even. This ensures that matching is preserved by adding these paths.

The ordering of the segments in the outer face that get glued, is same in both HH and GG since faces are preserved by the reduction in [ABC+09]. Also the by our construction the length of each segment is even since the horizontal distance between two vertices is a multiple of 22. Additionally from there are no edges along the boundary of the grid as required. ∎

1 Any graph in a“genus g𝑔g grid” is bipartite

Let CC be a cycle in GG. First we consider the case when CC is a simple cycle. Partition CC into paths P1=(p1,…,p2),P2=(p2,…,p3),…,Pk=(pk,…,p1)P_{1}=(p_{1},\ldots,p_{2}),P_{2}=(p_{2},\ldots,p_{3}),\ldots,P_{k}=(p_{k},\ldots,p_{1}), such that each PiP_{i} lies entirely in the grid with its two end points pip_{i} and pi+1p_{i+1} lying on some two segments. An example of this partition is shown in Figure 10(a) for the respective cycle. For each path PiP_{i} construct a path Pi′P^{\prime}_{i} by moving along the border of the grid from pip_{i} to pi+1p_{i+1} along a fixed direction (say in clockwise direction).

Fix an i∈[k]i\in[k]. Consider the partition of Pi′P^{\prime}_{i}, induced by the segments along which it passes. Denote the first and the last partition by Pi1′P^{\prime}_{i_{1}} and Pi2′P^{\prime}_{i_{2}} respectively. Note that any of the intermediate partitions of Pi′P^{\prime}_{i} has even length since the length of an intermediate partition equals the length of the corresponding segment and hence is even. Therefore we have,

because the path PiP_{i} and Pi′P^{\prime}_{i} together form a simple cycle on the grid and any cycle that lies entirely on the grid has even length. Consider the sum,

Since ∣Pi2′∣|P^{\prime}_{i_{2}}| and ∣P((i+1)mod  k)1′∣|P^{\prime}_{{((i+1)\mod k)}_{1}}| are equal, we have,

Now combining Equations (3.1), (3.2) and (3.5), we have ∑i=1k∣Pi∣\sum_{i=1}^{k}|P_{i}| is even and thus CC is of even length.

If CC is non-simple, then CC can be decomposed into a collection of simple cycles {Cj}\{C_{j}\} such that ∣C∣=∑jCj|C|=\sum_{j}C_{j}. Now using the previous part we get that CC has even length. ∎

New Upper Bounds

In this section we establish new upper bounds on the space complexity of certain matching problems on bipartite constant genus graphs, embedded on a ‘genus gg grid’.

We define \GG to be the class of genus gg graphs such that: for every G∈\GGG\in\GG, GG is a grid graph embedded on a grid of size 2m×2m2m\times 2m. We assume that the distance between adjacent horizontal (and similarly vertical) vertices is of unit length. The entire boundary of the grid is divided into 4g4g segments, and each segment has even length, for some constant gg. The 4g4g segments are labelled as (S1,S2,S1′,S2′,…S2i−1,S2i,S2i−1′,S2i′,(S_{1},S_{2},S_{1}^{\prime},S_{2}^{\prime},\ldots S_{2i-1},S_{2i},S_{2i-1}^{\prime},S_{2i}^{\prime}, …,S2g−1,S2g,S2g−1′,S2g′)\ldots,S_{2g-1},S_{2g},S_{2g-1}^{\prime},S_{2g}^{\prime}), together with a direction, namely, SiS_{i} is directed from left to right and Si′S_{i}^{\prime} is directed from right to left for each i∈[2g]i\in[2g]. The jjth vertex on a segment SiS_{i} is the jjth vertex on the border of the grid, starting from the head of the segment SiS_{i} and going along the direction of the segment. Finally the segments SiS_{i} and Si′S_{i}^{\prime} are glued to each other for each i∈[2g]i\in[2g] in the same direction. In other words, the jjth vertex on segment SiS_{i} is the same as the jjth vertex on segment Si′S_{i}^{\prime}. Also there are no edges along the boundary of the grid.

If CC is a cycle in GG, we denote the circulation of CC with respect to a weight function ww as circw(C)circ_{w}(C). For any subset E′⊆CE^{\prime}\subseteq C, circw(E′)circ_{w}(E^{\prime}) is the value of the circulation restricted to the edges of E′E^{\prime}.

There exists a logspace computable and polynomially bounded weight function WW, such that for any graph G∈\GGG\in\GG and any cycle C∈GC\in G, circW(C)≠0circ_{W}(C)\neq 0.

For a graph embedded on a constant genus surface,

As a result of Theorem 3, we can assume that our input graph G∈\GGG\in\GG. Using Theorem 10 and Lemma 1 we get a logspace computable weight function WW, such that the minimum weight perfect matching in GG with respect to WW is unique. Moreover, for any subset E′⊆EE^{\prime}\subseteq E, Theorem 10 is valid for the subgraph G∖E′G\setminus E^{\prime} also, with respect to the same weight function WW. Now (a) and (b) follows from Lemma 2. Checking for uniqueness can be done by first computing a perfect matching, then deleting an edge from the matching and rechecking to see if a perfect matching exists in the new graph. If it does, then GG did not have a unique perfect matching, else it did. Note that Theorem 10 is valid for any graph formed by deletion of edges of GG. ∎

Theorem 10 also gives an alternative proof of directed graph reachability for constant genus graphs.

Directed graph reachability for constant genus graphs is in \UL.

The proof of Theorem 12 follows from Lemma 13 and [BTV09]. We adapt Lemma 13 from the journal version of [DKR08] (to appear in Theory of Computing Systems).

There exist a logspace computable weight function that assigns polynomially bounded weights to the edges of a directed graph such that: (a) the weights are skew symmetric, i.e., w(u,v) = - w(v,u), and (b) the sum of weights along any (simple) directed cycle is non-zero.

In any class of graphs closed under the subdivision of edges, Theorem 10 implies the hypothesis of Lemma 13.

Given an undirected graph G,G, construct a bipartite graph G′G^{\prime} as follows: replace every undirected edge {u,v}\{u,v\} by a path u−w−vu-w-v of length two. Use Lemma 13 to assign weights to the edges of G′.G^{\prime}. Suppose that the weight assigned to the undirected edge {u,w}\{u,w\} in G′G^{\prime} is aa and the weight of {w,v}\{w,v\} is b.b. Let G→\overrightarrow{G} denote the directed graph obtained from GG by considering each undirected edge as two directed edges in opposite directions. Now we assign the weights to the edges of G→\overrightarrow{G} as follows: directed edge (u,v)(u,v) gets weight a−b;a-b; whereas the directed edge (v,u)(v,u) will get weight b−a.b-a. The circulations of the cycles in G′G^{\prime} being non-zero will translate into the sum of the edges along any cycle in the directed graph G→\overrightarrow{G} being non-zero. ∎

For a graph G∈\GGG\in\GG, we define WW is a linear combination of the following 4g+14g+1 weight functions defined below. This is possible in logspace since gg is constant.

Define 4g+14g+1 weight functions as follows:

Note that if ee does not lie on the boundary of the grid then w′′(e)w^{\prime\prime}(e) is same as the weight function defined in [DKR08].

If CC is a cycle in GG, we denote the circulation of CC with respect to a weight function ww as circw(C)circ_{w}(C). For any subset E′⊆CE^{\prime}\subseteq C, circw(E′)circ_{w}(E^{\prime}) is the value of the circulation restricted to the edges of E′E^{\prime}. An example of a cycle on a grid is given in Figure 10(a).

Let CC be a simple cycle in GG. If CC is surface non-separating, then circwi(C)≠0circ_{w_{i}}(C)\neq 0 for some ii. If CC is surface separating and crosses the boundary of the grid at some vertex vv, then circwi′(C)≠0circ_{w^{\prime}_{i}}(C)\neq 0 for ii, such that vv lies in the segment SiS_{i}. If CC does not intersect any of the boundary segments, then CC does not have any edge on the boundary since there are no edges along the boundary by definition of \GG. Therefore circw′′(C)≠0circ_{w^{\prime\prime}}(C)\neq 0 by [DKR08].

Without loss of generality, assume CC intersects segment S1S_{1}. Let E1CE^{C}_{1} be the set of edges of CC that intersect S1S_{1}. Note that circw1(C)=circw1(E1C)circ_{w_{1}}(C)=circ_{w_{1}}(E^{C}_{1}) (same thing holds for w1′w^{\prime}_{1} as well. We can assume that ∣E1C∣|E^{C}_{1}| is even since otherwise circw1(E1C)circ_{w_{1}}(E^{C}_{1}) is odd and hence non-zero. By Lemma 16 it follows that the edges of E1CE^{C}_{1}, alternate between going out and coming into the grid. Then using Lemma 17 we get that circw1′(E1C)≠0circ_{w^{\prime}_{1}}(E^{C}_{1})\neq 0 and thus circw1′(C)≠0circ_{w^{\prime}_{1}}(C)\neq 0. (See below for Lemma 16 and 17) ∎

To establish Lemma 16 we use an argument (Lemma 15) from homology theory. For two cycles (directed or undirected) C1C_{1} and C2C_{2}, let I(C1,C2)I(C_{1},C_{2}) denote the number of times C1C_{1} and C2C_{2} cross each other (that is one of them goes from the left to the right side of the other, or vice versa).

Next we adapt the following Lemma from Cabello and Mohar [CM07]. Here we assume we are given an orientable surface (Cabello and Mohar gives a proof for a graph on a surface).

Given a genus gg orientable, surface Γ\Gamma, let C={Ci}i∈[2g]\mathcal{C}=\{C_{i}\}_{i\in[2g]} be a set of cycles that generate the first homology group H1(Γ)H_{1}(\Gamma). A cycle CC in Γ\Gamma in non-separating if and only if there is some cycle Ci∈CC_{i}\in\mathcal{C} such that I(C,Ci)≡1(mod  2)I(C,C_{i})\equiv 1(\mod 2).

Suppose CC is non-separating. One can construct a cycle C′C^{\prime} on Γ\Gamma, that intersects CC exactly once. Let C′=∑i∈[2g]ti′CiC^{\prime}=\sum_{i\in[2g]}t_{i}^{\prime}C_{i}. Now 1≡IC′(C)≡∑i∈[2g]ti′I(C,Ci)(mod  2)1\equiv I_{C^{\prime}}(C)\equiv\sum_{i\in[2g]}t_{i}^{\prime}I(C,C_{i})(\mod 2). This implies that there exists i∈[2g]i\in[2g] such that I(C,Ci)≡1(mod  2)I(C,C_{i})\equiv 1(\mod 2). ∎

Let CC be a simple directed cycle on a genus gg orientable surface Γ\Gamma and let C={Ci}i∈[2g]\mathcal{C}=\{C_{i}\}_{i\in[2g]} be a system of 2g2g directed cycles on Γ\Gamma, having exactly one point in common and Γ∖C\Gamma\setminus\mathcal{C} is the fundamental polygon, say Γ′\Gamma^{\prime}. If I(C,Ci)I(C,C_{i}) is even for all i∈[2g]i\in[2g] then for all j∈[2g]j\in[2g], CC alternates between going from left to right and from right to left of the cycle CjC_{j} in the direction of CjC_{j} (if CC crosses CjC_{j} at all).

Suppose there exists a j∈[2g]j\in[2g] such that CC does not alternate being going from left to right and from right to left with respect to CjC_{j}. Thus if we consider the ordered set of points where CC intersects CjC_{j}, ordered in the direction of CjC_{j}, there are two consecutive points (say P1P_{1} and P2P_{2}) such that at both these points CC crosses CjC_{j} in the same direction.

Let Q1Q_{1} and Q2Q_{2} be two points in Γ∖C\Gamma\setminus C. We will show that there exists a path in Γ∖C\Gamma\setminus C between Q1Q_{1} and Q2Q_{2}. Consider the shortest path from Q1Q_{1} to CC. Let Q1′Q_{1}^{\prime} be the point on this path that is as close to CC as possible, without lying on CC. Similarly define a point Q2′Q_{2}^{\prime} corresponding to Q2Q_{2}. Note that it is sufficient for us to construct a path between Q1′Q_{1}^{\prime} and Q2′Q_{2}^{\prime} in Γ∖C\Gamma\setminus C. If both Q1′Q_{1}^{\prime} and Q2′Q_{2}^{\prime} locally lie on the same side of CC, then we get a path from Q1′Q_{1}^{\prime} to Q2′Q_{2}^{\prime} not intersecting CC, by traversing along the boundary of CC. Now suppose Q1′Q_{1}^{\prime} and Q2′Q_{2}^{\prime} lie on opposite sides (w.l.o.g. assume that Q1′Q_{1}^{\prime} lies on the right side) of CC. From Q1′Q_{1}^{\prime} start traversing the cycle until you reach cycle CjC_{j} (point P1P_{1} in Figure 10(b)). Continue along cycle CjC_{j} towards the adjacent intersection point of CC and CjC_{j}, going as close to CC as possible, without intersecting it (point P2P_{2} in Figure 10(b)). Essentially this corresponds to switching from one side of CC to the other side without intersecting it. Next traverse along CC to reach Q2′Q_{2}^{\prime}. Thus we have a path from Q1′Q_{1}^{\prime} to Q2′Q_{2}^{\prime} in Γ∖C\Gamma\setminus C. We give an example of this traversal in Figure 10(b). This implies that CC is non-separating.

It is well known that C\mathcal{C} forms a generating set of H1(Γ)H_{1}(\Gamma), the first homology group of the surface. Now from Lemma 15 it follows that I(C,Cl)≡1(mod  2)I(C,C_{l})\equiv 1(\mod 2) for some l∈[2g]l\in[2g], which is a contradiction.

Let GG be a graph in \GG with CC being a simple cycle in GG and E1CE^{C}_{1} being the set of edges of CC that intersects segment S1S_{1}. Assume ∣E1C∣|E^{C}_{1}| is even and the edges in E1CE^{C}_{1} alternate between going out and coming into the grid. Let i1<i2<…<i2p−1<i2pi_{1}<i_{2}<\ldots<i_{2p-1}<i_{2p} be the distinct indices on S1S_{1} where CC intersects it. Then

and thus non-zero unless E1CE^{C}_{1} is empty.

Let ej=(uj,vj)e_{j}=(u_{j},v_{j}) for j∈[2p]j\in[2p] be the 2p2p edges of GG lying on the segment S1S_{1}. Assume without loss of generality that the vertices vjv_{j}’s lie on S1S_{1}. Assign an orientation to CC such that e1e_{1} is directed from u1u_{1} to v1v_{1}. Also assume that i1i_{1} is even and the circulation gives a positive sign to the edge e1e_{1}. Therefore circw1′({e1})=−i1circ_{w^{\prime}_{1}}(\{e_{1}\})=-i_{1}.

Now consider any edge eje_{j} such that jj is even. By Lemma 16, the edge enters the segment S1S_{1}. Suppose iji_{j} is odd. Then consider the following cycle C′C^{\prime} formed by tracing CC from uju_{j} to u1u_{1}, without the edges e1e_{1} and eje_{j} and then moving along the segment S1S_{1} back to uju_{j}. Since iji_{j} is odd therefore the latter part of C′C^{\prime} has odd length. Note that C′C^{\prime} need not be a simple cycle. By Lemma 9, ∣C′∣|C^{\prime}| is even, therefore the part of C′C^{\prime} from u1u_{1} to uju_{j} also has odd length. This implies that the circulation gives a positive sign to the edge eje_{j}. Therefore, circw1′({ej})=ijcirc_{w^{\prime}_{1}}(\{e_{j}\})=i_{j}. Similarly, if iji_{j} is odd, then the part of C′C^{\prime} from u1u_{1} to uju_{j} will have even length. Thus the circulation gives a negative sign to the edge eje_{j} and therefore circw1′({ej})=−(−ij)=ijcirc_{w^{\prime}_{1}}(\{e_{j}\})=-(-i_{j})=i_{j}.

If jj is odd, the above argument can be applied to show that circw1′({ej})=−ijcirc_{w^{\prime}_{1}}(\{e_{j}\})=-i_{j}. Therefore we have,

Now removing the assumptions at the beginning of this proof would show that the LHS and RHS of the above equation is true modulo absolute value as required. ∎

It is interesting to note here that similar method does not show that bipartite matching in non-orientable constant genus graphs is in \SPL. The reason is that Lemma 16 crucially uses the fact that the surface is orientable. In fact, one can easily come with counterexample to the Lemma if the surface is non-orientable.

Reducing the non-orientable case to the orientable case

Let GG be a bipartite graph embedded on a genus gg non-orientable surface. As a result of Theorem 6 we can assume that we are given a combinatorial embedding (say Π\Pi) of GG on a (non-orientable) polygonal schema, say Λ(Γ),\Lambda(\Gamma), in the normal form with 2g′2g^{\prime} sides. (Here g′g^{\prime} is a function of g.g.)

Let Y=(X1,X2)Y=(X_{1},X_{2}) be the cyclic ordering of the labels of the sides of Λ(Γ)\Lambda(\Gamma), where X2X_{2} is the ‘orientable part’ and X1X_{1} is the ‘non-orientable part’. More precisely, for the polygonal schema in the normal form, we have: X1X_{1} is either (σ,σ)(\sigma,\sigma) (thus corresponds to the projective plane) or it is (σ,τ,σˉ,τ)(\sigma,\tau,\bar{\sigma},\tau) (thus corresponds to the Klein bottle). See Figure 11.

Now let GG be a bipartite graph embedded on a non-orientable polygonal schema Λ(Γ)\Lambda(\Gamma) with 2g′2g^{\prime} sides. We will construct a graph G′G^{\prime} embedded on an orientable polygonal schema with 4g′−24g^{\prime}-2 sides such that GG has a perfect matching iff G′G^{\prime} has a perfect matching. Moreover, given a perfect matching in G′G^{\prime} one can retrieve in logspace a perfect matching in G.G. This is illustrated in the following Theorem.

Let GG be a bipartite graph given with its embedding on a non-orientable polygonal schema in normal form Λ(Γ)\Lambda(\Gamma), with 2g′2g^{\prime} sides as above. One can construct in logspace, another graph G′G^{\prime} together with its embedding on the polygonal schema of an orientable surface Γ′\Gamma^{\prime} of genus 4g′−24g^{\prime}-2 such that: GG has a perfect matching iff G′G^{\prime} has a perfect matching. Moreover, given a perfect matching in G′,G^{\prime}, one can construct in logspace a perfect matching in G.G.

We first show the case when Γ\Gamma is the sum of an orientable surface and a Klein bottle. Consider the polygonal schema formed by taking two copies of Λ(Γ)\Lambda(\Gamma) and glueing the side τ\tau of one copy with its partnered side τ\tau of the other copy. We relabel the edge labelled σ\sigma in the second copy with some unused symbol δ\delta to avoid confusion. The entire reduction is shown in Figure 12. Let G′G^{\prime} be the resulting graph.

Note that the polygonal schema obtained as a result represents an orientable surface and has constantly many sides. Also every vertex and edge in GG has exactly two copies in G′G^{\prime} and G′G^{\prime} is also bipartite. Let MM be a matching in GG. Let M′M^{\prime} be the union of the edges of MM from both the copies of GG . Its easy to see that M′M^{\prime} is a matching in G′G^{\prime}. Now consider a matching M′M^{\prime} in G′G^{\prime}. The projection of M′M^{\prime} to GG gives a subgraph of GG where every vertex has degree (counted with multiplicity) exactly two. Since GG is bipartite, one can obtain a perfect matching within this subgraph.

Now consider the case when Γ\Gamma is the ‘sum’ of an orientable surface and a projective plane, i.e., following the notation above X1X_{1} corresponds to the labels of a polygonal schema for the projective plane and X2X_{2} corresponds to the labels of a polygonal schema of an orientable surface. Take two copies of Λ(Γ)\Lambda(\Gamma), and glue σ\sigma of one copy with its partner σ\sigma in the other copy. We show this operation in Figure 13.

The rest of the proof is similar to the Klein bottle case. ∎

Thus we see that the non-orientable case can be reduced to the orientable case. The resulting polygonal schema need not be in the normal form. Once again we apply Theorem 6 to get a combinatorial embedding on a polygonal schema in the normal form.

Acknowledgment

The third author would like to thank Prof. Mark Brittenham from the Mathematics department at the University of Nebraska-Lincoln, for numerous discussions that they had and for providing valuable insight into topics in algebraic topology.

References