Planar Perfect Matching is in NC

by   Piotr Sankowski, et al.
University of Warsaw

In this paper we show that the problem of computing perfect matchings in planar graphs is in NC.



page 1

page 2

page 3

page 4


Planar Graph Perfect Matching is in NC

Is perfect matching in NC? That is, is there a deterministic fast parall...

On the expected number of perfect matchings in cubic planar graphs

A well-known conjecture by Lovász and Plummer from the 1970s asserted th...

Circuit Complexity of Bounded Planar Cutwidth Graph Matching

Recently, perfect matching in bounded planar cutwidth bipartite graphs (...

Packing Trees into 1-planar Graphs

We introduce and study the 1-planar packing problem: Given k graphs with...

Planar Ultrametric Rounding for Image Segmentation

We study the problem of hierarchical clustering on planar graphs. We for...

On some Graphs with a Unique Perfect Matching

We show that deciding whether a given graph G of size m has a unique per...

Complementation in t-perfect graphs

Inspired by applications of perfect graphs in combinatorial optimization...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In this paper we study deterministic parallel algorithms for the maximum planar matching problem. In particular, we concentrate our attention on the NC class where we are given polynomially many processors which need to solve the problem in polylogarithmic time. The fundamental algorithmic challenge is to compute the maximum cardinality matching, or maximum weight matching, or minimum weight perfect matching.

So far in the case of NC algorithms for planar graphs there seemed to be no tools to attack the most general case and we were only able to find perfect matchings only in planar bipartite graphs [28, 27]. This might be bit surprising as in non-planar graph, perfect matchings are essentially as powerful as maximum cardinality matchings, see e.g., [34] for a reduction. Such reductions either make two copies of the graph, where each vertex is connected with its copy, or add a set of vertices that are connected to every vertex in the graph. There exists no similar planarity preserving reduction, and so usefulness of algorithms for planar perfect matchings is limited. Hence, in order to find a maximum cardinality matching we need to retool to less efficient polynomial time algorithms [12, 17, 18] that are limited to bipartite case only. Or, alternatively, we can find a -approximate solution [19]. The lack of such planarity preserving reduction is one of the reasons why computing maximum cardinality matchings in almost linear time was recognized as one of the core problems in planar graph algorithms [5]. This despite the fact that almost linear time algorithms for the perfect matching problem existed before [29, 10].

Formally speaking, our results are as follows. Consider a planar graph with polynomially bounded edge weight (cost) function . A matching in is an independent set of edges, whereas a perfect matching is matching that is incident to every vertex in . We start by giving a relatively simple NC algorithm for finding a perfect matching in . Then we extend this algorithm to finding minimum perfect matching, i.e., a perfect matching of with minimum total weight . Our algorithm is combinatorial in spirit as it does not manipulate a fractional matching, but only requires to know weights of appropriately defined minimum perfect matchings. These weights can be computed using Kasteleyn’s Pfaffian orientation of planar graphs and standard algebraic techniques. The algorithm is based on the fundamental notion of balanced duals that was developed in [8] as well as [14]. This idea allows to define and construct a dual solution in a unique way. In particular, a very simple NC algorithm (see Appendix 8) for constructing a family of blossoms of this dual follows by a direct application of the algorithm given in [8]. 222Our framework was developed independently from [2] and posted on arXiv on the same day [35]. Nevertheless, the author’s initial write-up was very ”crude” and contained some gaps. In particular, Algorithm 1 was described in a confusing way without stating which parts should happen in parallel. Moreover, we aimed to give, an alternative to [8], construction of matching duals that was incorrect. This, however, is a known result, so in this paper we just cite [8] instead. Finally, the presentation of this paper was greatly improved with respect to [35], while keeping the original framework. Moreover, consequences for more general problems have been added.

The next problem we consider is the minimum weight -factor problem, where for a given we need to find a set of edges of minimum total cost such that for all . Typically, this problem is reduced to the perfect matching problem via vertex splitting [13, 3]. These reductions, however, do not preserve planarity. Our contribution, is to show a new planarity preserving reduction, that allows to solve the -factor problem in NC.

The following implication of this result was rather surprising (at least for the author). We show that both the maximum cardinality and maximum weight bipartite planar matching problem can be efficiently reduced to the minimum non-bipartite planar matching problem. Thus implying the first known NC algorithm for finding maximum weight matching and maximum cardinality matching in bipartite planar graphs. We note that prior to this result there have been no tools or ideas indicating that this problem could have an solution in NC. One reason for this is the applicability of Kasteleyn’s result to the perfect matching problem only. Pfaffian orientations fail for maximum size matchings. Moreover, our reduction preserves the size of the graph, thus any further development for weighted perfect matching in planar graphs will imply similar results for maximum weight bipartite matchings. There seem to be no easy way to extend this result to non-bipartite case, and we note that finding NC algorithms for this problem remains open. Still, we report partial progress on this problem by showing the first time PRAM algorithm.

Finally, we consider directed flow networks where capacity of edges is given by a polynomially bounded capacity function and vertex demand is given by polynomially bounded demand function . Our aim is to compute a min-cost flow that obeys edge capacities and satisfies all vertex demands. We give the first known NC algorithm for this problem resolving the long standing open problem from [29]. This results is further extended to finding maximum multiple-source multiple-sink flow in planar graphs.

Related Work

The key result that allowed development of NC algorithms for the perfect matching problems in planar graph is Kasteleyn’s idea [24]. He showed that the problem of counting perfect matchings in planar graphs is reducible to determinant computation. Thus [7] implied an NC algorithm checking whether a planar graph contains a perfect matching. In [39] this result was extended to -free graphs. Counting, however, does not allow to construct a perfect matching. The first algorithm for constructing perfect matchings was given in [29] but only in the bipartite case. Another solution that is based on different principles was developed in [27]. A partial solution for the non-bipartite case was given in [25] where an algorithm for computing half integral solution was shown. Finally, the problem has been solved for non-bipartite planar graphs independently in [2] and here. The result of [2] extends to weighted case as well. In comparison, our paper gives a simpler algorithm for constructing a perfect matchings in NC than the one in [2]. Moreover, we show several nontrivial extension of this results, e.g., to cardinality bipartite matching.

When allowing randomization (i.e., when considering RNC complexity) the problem can be solved even in general non-planar graphs [23, 16, 32, 33]. All of these Monte Carlo algorithms can be changed into Las Vegas ones using [22]. Similarly, matching problems can be solved for a special graph class which polynomially bounded number of matchings [20, 1]. However, these results do not extend to the case of superpolynomial number of matchings or alternatively superpolynomial number of even length cycles.

Finally, we note that we are unaware of any previous parallel deterministic algorithms for weighted non-bipartite problems like minimum perfect matching or -factor problems. Bipartite versions of these problem have some solutions that require at least polynomial time [12, 17, 18].

2 Preliminaries

denotes an -vertex, embedded, undirected graph. This embedding partitions the plane into maximal open connected sets and we refer to the closures of these sets as the faces of . The number of faces is denoted by . For a subset of vertices , denotes all edges having . We write for , for and .

The linear programming formulation of the minimum perfect matching problem and its dual is as follows 

[9]. An odd set

has odd size;

is the collection of odd subsets of of size .

LP of minimum prefect matching LP of the dual prolem

The variables in primal indicate when an edge is included in the solution. The dual problem has variables for each vertex and for each odd set .

Moreover, a graph is factor critical if for all after removing the graph has a perfect matching. A laminar family is a collection of subsets of such that for every pair either , or , or . We use the existence of the following dual.

Lemma 1 (implicitly in [9]).

There exists an optimal dual solution that:

  1. the set system forms a laminar family,

  2. for each with , the graph denoted by obtained by contracting each set to a point is factor critical.

An optimum dual solution satisfying the above conditions is a critical dual solution. A set such that is a blossom w.r.t. . An important idea that is used in almost all algorithms for weighted matching is that after computing the dual we can work with a non-weighted problem. This non-weighted problem is defined in the following way: leave only tight edges in the graph, i.e., there is equality in (*); find a perfect matching respecting all blossoms , i.e., such that for all we have . By duality slackness any matching obtained this way is a minimum perfect matching.

Laminar family of sets is equipped with a natural parent-child relation and can be seen as a forrest. We assume this tree is rooted at and call the resulting tree laminar tree. We note that given a laminar family it is straightforward to deduce the parent-child relation, i.e., parent of a set is the minimal set containing , whereas children of are maximal sets contained in . Hence, whenever working with a laminar family we assume that the laminar tree is available as well as it can be easily computed in NC. A useful property of this view is that tree has a vertex separator, i.e., there exists a vertex such that the size of every connected component of is at most .

Basic NC Algorithms

Our algorithm builds upon the following NC algorithms for computing:

  • components and spanning forrest of an undirected graphs [37, 6],

  • paths in a directed graph – this can be done by repetitive matrix squaring,

  • maximal independent set in a graph [26],

  • a vertex separator of a tree – by computing the numbers of vertices in each subtree using any of the standard techniques [30, 38].

Consider a graph with an edge weight function . For a vertex we denote by the graph . If has an even number of vertices then denotes some minimum almost perfect matching in , i.e., a minimum weight matching that misses exactly one vertex. If has an odd number of vertices then denotes some minimum perfect matching in . is not defined in unique way, but its weight is. In our algorithms we will only use these weights that can be computed using standard techniques as shown in Appendix A.

Corollary 2.

For a graph with edge weights we can in NC:

  • for a given vertex , compute the weight ,

  • for a given edge , check whether is allowed, i.e., belongs to some minimum perfect matching.

Observe that the set of allowed edge is a subset of tight edges. Hence, when we remove all not allowed edges only tight edges are left in the graph.

Let us now state the following implication of the results in [8]. Basically, assuming that all are given, Algorithm 5 from [8] gives an NC procedure for computing the blossoms of the critical dual solution. For the completeness of the presentation we have included this simple algorithm in Appendix C.

Lemma 3 (based on Lemma 6.19 [8]).

Let be undirected connected graph where edge weights are given by and where every edge is allowed. Given all values for , the blossoms of the critical dual solution can be computed in NC.

Algorithm 5 from [8] actually constructs a critical dual with an additional property which is called balanced. Intuitively, in a balanced dual the root of the laminar tree is a central vertex of this tree as well. For formal definition see [8] or see [14] for an alternative definition of canonical dual. In short words, balanced duals are unique. Thus when one constructs them in parallel as all processors construct the same solution, and the algorithm can be implemented in NC.

3 The High Level Idea: Cycles and Blossoms

This section aims to introduce two core ideas of our algorithm that allow us to reduce the size of the graph for the recursion, as well as a high level idea that reveals around them. We will first give an algorithm for finding a perfect matching in a graph. However, we will view the problem as weighted and seek minimum perfect matching. This algorithm will be extended to weighted case in Section 7. The weighed view is useful as we will find even length cycles in the graph and introduce weights on them. These weights will either cause some edges to become not allowed, or induce a blossom as shown by the following lemma.

To make it more precise we say that a cycle in graph is semi-simple if it contains an edge that appears on only once. By we denote an arbitrary such edge on .

Lemma 4.

Consider with edge weight function . Let be an even semi-simple cycle in . Let and let for all . Then, either some edge of is not allowed or some edge of is in for some blossom .


Assume by a contradiction that all edges of are allowed and there is no blossom intersecting . Hence, by complimentary slackness conditions we have that for all edges . In particular, for the edge we need to have , whereas for all other edges we have . Now consider edge which is next to . By subtracting equalities for edge and we obtain . If and are not equal to we have . In general, we have for any two vertices at even distance along path . And for any two vertices at odd distance along path . Note that the distance from to along is odd, so we obtain , what leads to contradiction. See Figure 6 a) for an illustration. ∎

Blossoms are natural objects to recurse on, as by duality slackness there must be exactly one edge of any perfect matching that belongs to for any blossom . Thus, in the recursion, we can find an almost perfect matching outside of , an almost perfect matching inside of and then combine them by matching one edge in – see Section 6. However, having an edge in does not directly guarantee that the size of the graph reduces in the recursion. We need the following stronger observation for this.

Lemma 5.

Consider with edge weight function . Let be an even semi-simple cycle in . Let and let for all . Then there exist edges , such that and .


For contradiction assume that no edge of is in – the other case is symmetric. Hence, there can only be vertices in such that its both incident edges and on are in . In such a case we have and . Thus , i.e., the contribution of when subtracting these equalities cancels. See Figure 6 b) for illustration. Thus does not contribute anything to the telescoping sum along and we reach similar contradiction as in the previous lemma. ∎

Hence, when recursing on the inside of the blossom or on the outside of the blossom we reduce the graph size as well. However, to obtain an NC algorithm we need to reduce the size of the graph by a constant factor, so we need to have edge disjoint even cycles. The following lemma, that was implicitly proven in [25], becomes handy now.

Lemma 6.

In a -connected planar graph with faces we can find edge disjoint even semi-simple cycles in NC.

A simplified proof of this lemma is given in Appendix B. Intuitively, the proof of this lemma puts faces into pairs that are incident. Now, either a pair contains an even face and thus this face is semi-simple, or both faces are odd. In the later case we can built an even semi-simple cycle by walking around both faces.

The above lemma shows that to have many even semi-simple cycles we just need to guarantee that the graph has many faces. Let us say that a planar graph is simplified, if there are no degree vertices and no two vertices of degree are incident. The next lemma shows that such graphs have many faces.

Lemma 7.

Let be a simplified planar graph with a perfect matching, then has at least faces.


By Euler’s formula , where is the number of edges, and is the number of faces. Let be the set of degree vertices in . Consequently, the vertices in have degree at least . As has a perfect matching and no two degree vertices are incident, all vertices in need to be matched to vertices in , i.e., . By using this inequality we have.

By plugging this inequality into Euler’s formula we obtain . ∎

Thus a simplified graph has many faces and many edge disjoint even cycles. We can assign weights to each of these cycles separately. This way either many edges become not allowed, or there are many blossoms containing edges inside. The main technical part of the algorithm is to handle family of blossoms. The algorithm has the following steps.

  1. Simplify the graph as shown in Section 4. First, we take care of degree vertices, by removing not allowed edges using Corollary 2 and matching independent edges. Next, we contract paths composed of degree vertices. Finally, we find perfect matchings in each connected component separately. Due to removal of not allowed edges each connected component is -connected as well.

  2. Using Lemma 6 we find many edge disjoint even length cycles. We assign weights to even cycles using Lemma 4 and we remove not allowed edges. Next, we find blossoms of the critical dual using Lemma 3. These steps are described in Section 5.

  3. Finally, we recurse on a critical dual as explained in Section 6, where we show how to construct a perfect matching that respect all blossoms in the dual. This construction is recursive and calls back step 1 for subgraphs of that do not have any blossoms.

The recursion depth in this procedure is as either there edges become not allowed, or there are many blossoms. In the second case for each blossom there is an edge inside and an edge outside of it – see Figure 2 a). In the case when we have many blossoms we observe that they divide the graph into regions and each lowest level recursive call goes to one of these regions, i.e., we recourse on inside and outside of some blossom as long as there are some blossoms intersecting the current subgraph. As visualized on Figure 2 b) there are many edges that are not incident to each region, as one of the edges from each pair needs be outside of this region. Hence the size of each of these regions decreases by a constant factor with respect to the original graph. This will be proven more formally in Section 5 where we analyze the running time of the algorithm.

4 Simplifying the Graph

The first ingredient of our algorithm is the following entry procedure that simplifies the graph and assures that we are working with -connected graphs.

1:Remove all not-allowed edges from .
2:Add independent edges to and remove them from .
3:for all paths composed out of degree vertices do In parallel
4:     if  has odd length then
5:         remove and connect vertices incident to with an edge .
6:     else
7:         contract to a single vertex .      
8:Compute connected components of
9:for all components of  do In parallel
10:     find perfect matching using Algorithm 2.
11:Extend matching on paths of degree vertices.
12:return .
Algorithm 1 Simplifies graph and seeks perfect matchings on its -connected components.

The following lemma proves the correctness of the above algorithm.

Lemma 8.

Algorithm 1 executes Algorithm 2 on a simplified -connected graph.


We first observe that after removing not allowed edges, an edge incident to a vertex of with degree needs to belong to a perfect matching. Moreover, is independent. Hence, after matching such independent edges all vertices have degree or higher. Now note that the manipulation of the path does not change degrees of other vertices. In the algorithm such path is either replaced by an edge, or single vertex – see Figure 3. Hence, afterwards degree vertices are independent. Thus is simplified and its all connected components are simplified as well.

Now, for contrary assume that a connected component is not -connected, i.e., there exists an articulation point . Consider connected components obtained from after removal of . Only one of them can be matched in the perfect matching to . Thus only this one has odd number of vertices. The remaining components must have even number of vertices and no perfect matching can match them to . Hence, their edges incident to are not allowed. However, all not allowed edges were removed by the algorithm, so we reach a contradiction. ∎

In the final step of the algorithm we need to expand all paths that were replaced during the execution of Algorithm 1. Observe that the matching in the simplified graph can be extended to the matching in the orginal graph in a straight-forward way. If was odd, then depending on whether is matched we either match even or odd edges on . If was even, then has degree and it can be matched in one of two possible ways. In these two cases the matching can be extended to the whole path.

5 The Main Routine

Algorithm 2 implements the main procedure of the algorithm. First, we find even semi-simple cycles and introduce weights on them. Next, in order to reduce the size of the graph we remove not allowed edges. We then find blossoms of the critical dual solution with respect to these weights and call Algorithm 4 to find a perfect matching that respects all blossoms.

1:Find a set of edge disjoint even semi-simple cycles using Lemma 6.
2:Set for all .
3:for all  do In parallel
4:     Set .
5:Remove all not-allowed edges from .
6:Compute blossoms of a critical dual with respect to using Lemma 3.
7:Compute a matching that respects using Algorithm 4.
8:Return .
Algorithm 2 Finds a perfect matching in a connected graph . If the graph is not connected we call the procedure for each component separately.

6 Finding a Perfect Matching that Respects a Family of Blossoms

Let be a graph and let be a matching in . An alternating path is a path in such that edges on alternate between matched and unmatched. Assume that is factor critical (inside of a blossom) and that is an almost perfect matching that misses vertex . We start by showing how using we construct an almost perfect matching for any . To this end, we need to find a simple alternating path starring in and ending in . Denote by a weight function assigning to edges in and to edges not in .

Lemma 9.

Let be the minimum almost perfect matching in with respect to , then is the length of the shortest alternating path with respect to from to .


Observe that the symmetric difference contains an alternating path with respect to that needs to start at and end at . The weight of this path is equal to the number of edges from on it. As this path is alternating the number of edges of is the same. Thus minimizing we minimize the length of an alternating path with respect to from to . ∎

Now, we want to construct a graph that will represent all shortest alternating paths from with respect to . will be a layered graph, where layer contains vertices at distance from — the distance is measured along alternating paths. For each , let contain two copies and of . We define for all , and for all . We add edges of to only if they connect two consecutive layers given by – see Figure 4. Every shortest alternating path from is contained in by Lemma 9. Alteratively, if a path in represents a simple path in then it is a shortest alternating path in . However, there are path in that do not correspond to simple paths in , i.e., they contain both and for some – see Figure 4 b). Nevertheless, as every vertex in is reachable via alternating path, we can modify in such a way that only path corresponding to simple path in remain. This is done using Algorithm 3.

1:For all compute .
2:Let be a graph where has two copies and .
3:For all set .
4:For all set .
5:Add edges of to only if they connect vertices in consecutive layers .
6:for all  do In parallel
7:     for all  on some - path in , where ,  do In parallel
8:         if there exists - path avoiding in  then
9:              remove all edges entering but the edge on .               
10:Return any path from to in .
Algorithm 3 Finds an alternating path with respect to in from a vertex to vertex .

The correctness of this algorithm is established by the next lemma.

Lemma 10.

Let be a factor critical graph and let be an almost perfect matching missing vertex . An almost perfect matching missing vertex can be found in NC using Algorithm 3.


We first observe that the removal of edges entering from does not affect reachability from , as the path from to is left in the graph. Now, by contradiction, assume that at the end of the algorithm there is a path in that contains both and for some . Without loss of generality assume precedes . As contains all simple alternating paths, there exists an - path avoiding . Hence, the edge of entering the first shared vertex with was removed by the algorithm – see Figure 4 b).333The graph constructed in this algorithm can be seen as an extended version of generalized shortest path tree [11]. Alternatively, such tree could be constructed using Algorithm 5 from [8]. This, however, would result in a slightly more complicated solution.

The next algorithm constructs a perfect matching that respects a family of blossoms. Here, we explicitly consider as a tree , i.e., the vertices of are sets in whereas edges in represent child parent relationship. See Figure 5 for an example and an illustration of recursion. It calls Algorithm 1 that handles the case without blossoms. The next theorem argues about the correctness of this algorithm.

Lemma 11.

Algorithm 4 finds a perfect matching respecting . The recursion depth of the internal calls of the algorithm to itself is .


We need to argue that can be extended to a perfect matching in the whole graph. Consider a child blossom of . By Lemma 3 we know that is factor-critical, so there exists almost perfect matching in that together with forms a perfect matching. This matching differs from by a single alternating path. Moreover, note that after contraction of a given blossom all nonintersecting blossoms remain blossoms and the graph remains planar, so we can continue recursing on subtrees of . As we recurse on a vertex separator of a tree the size of the subtrees decreases by a constant factor. ∎

Lemma 11 leads to the correctness of Algorithm 2 and Algorithm 1 as well.

Theorem 12.

Algorithm 1 finds a perfect matching in .

1:if  then
2:     Return matching computed by Algorithm 1 on .
3:Let be a vertex separator of .
4:Begin In parallel with the next loop
5:     Let be the graph with all children of contracted.
6:     Let be with children of removed.
7:     Recurse on to obtain matching .
9:for all children of in  do In parallel
10:     Let be with all vertices not in contracted to a vertex denoted by .
11:     Let be subtree of rooted at .
12:     Recurse on to obtain matching .
13:for all children of in  do In parallel
14:     Remove from vertex and let be the resulting free vertex in .
15:     Let be the edge of incident to .
16:     Let be the endpoint of in after expanding .
17:     Apply to an alternating path from to found using Algorithm 3
18:Return .
Algorithm 4 Computes a perfect matching of respecting blossoms .

We now can turn our attention to arguing about the running time of our algorithm. In this section we are going to quantify progress related to perturbing weights on each semi-simple cycle.

Lemma 13.

The number of edges in decreases by a constant factor when recursing to Algorithm 1 from Algorithm 2 via Algorithm 4.


By Lemma 6 and Lemma 7 after graph simplification we have even semi-simple cycles in the graph . Now, by Lemma 4 for each semi-simple cycle, either one edge becomes not-allowed, or there exists a blossom that intersects this cycle. Hence, either edges become not-allowed, or we have cycles intersected by some blossom. Lemma 5 implies that for each such intersection there exists an edge inside and an edge outside – see Figure 2 a). Consider a plane embedding of and draw boundaries of each blossom in this plane, thus dividing the plane and graph into regions . The outside of each region contains at least one edge from and , i.e., there are edges not incident to a region – see Figure 2 b). We note that when we recurse to Algorithm 1 from Algorithm 4, we recurse onto some region with parts of not in contracted to vertices. This graph contains only edges incident to a region , so it does not contain edges. By Euler’s formula the total numer of edges is , so when recursing on each region it decreases by a constant factor. ∎

By Lemma 11 and 13 the recursion depth in Algorithm 2 is thus:

Corollary 14.

A perfect matching in a planar graph can be computed in NC.

7 Minimum Perfect Matching

So far we have assumed that the graph is unweighed and we have coped with the problem of constructing any perfect matching. However, our approach is versatile enough to handle weighted case in a rather straightforward way using Algorithm 5.

Remove all not allowed edges from .
Compute blossoms of a critical dual with respect to using Lemma 3.
Find a perfect matching respecting using Algorithm 4.
Return .
Algorithm 5 Finds a minimum perfect matching in with respect to the edge weight function .

Hence, we obtain the following.

Lemma 15.

A minimum perfect matching in a planar graph with edge weight function can be computed in NC.


Observe that all allowed edges in need to be tight. By complimentary slackness conditions a perfect matching that is composed out of allowed edges and that respects all blossoms is a minimum perfect matching. ∎

8 Minimum -Factors

Let be a multi-graph, i.e., we allow parallel edges as well as self-loops. For a function , an -factor is a set of edges such that for every . Without loss of generality we assume that any edge has multiplicity at most . A minimum -factor is an -factor with minimum weight .

The usual approach to -factor problems is by vertex-splitting [36, 13, 3], but these reductions do not preserve planarity. Here, we provide planarity preserving vertex splitting. In particular, we show how to replace each vertex with a planar gadget , such that perfect matchings in the resulting graph correspond to -factors in the original graph.

The gadget is parameterized by the degree of a vertex and its value. In order to work, the gadget needs to have interface vertices ordered in a circular order on its outside face. We require that for every subset of the graph has a perfect matching when , whereas has no perfect matching when .

The construction of is done recursively – see Figure 7 a). We start the recursion for , and let be a set of independent vertices, where all of them form the interface. The graph is defined from with interface in the following way:

  • add vertices and connect to both and for all ,

  • add vertices and connect with for all .

  • is the interface of .

We note that has vertices and edges. Hence, by exchanging each vertex with such gadget we obtain a graph of polynomial size. Moreover, if the graph is weighted, we set weights of edges in all gadgets to . This way the weight of the resulting perfect matching is equal to the weight of the -factor.

Lemma 16.

Let be a planar multigraph with edge weight function . For a function , minimum -factor can be computed in NC.


Take graph and replace each vertex with gadget connecting incident edges to its interfaces. The resulting graph has vertices and the minimum perfect matching in it corresponds to minimum -factor in . Applying Lemma 15 to this graph finishes the proof. ∎

We note that maximum -factor (or prefect matching) can be computed by using redefined weight function .

9 Maximum Bipartite Matching

Let be a bipartite planar graph with edge weight function . Algorithm 6 computes a maximum matching in graph , i.e., a matching of maximum total weight. A -factor is an -factor when for all .

Create a multigraph from by taking two copies of each edge .
Add a self loop of weight for each .
Compute a maximum -factor in .
Remove all self loops from .
for all even length cycles in  do In parallel
     Remove every second edge from .
for all edges taken twice in  do In parallel
     Remove one copy of from .
Return .
Algorithm 6 Finds a maximum matching in a bipartite graph with edge weight function .

Keep in mind that is bipartite, so cannot contain odd length cycles (besides the self-loops), so processing them is not needed in the above algorithm. Note that is not bipartite as it contains self loops.

Lemma 17.

A maximum matching in a planar bipartite graph with edge weight function can be computed in NC.


As for all , we can apply Lemma 16 to obtain -factor in NC. Because is bipartite, after removal of self-loops contains only even cycles or edges taken twice. Thus the algorithm constructs a matching out of it. The weight of is equal to half the weight of , as both ways of choosing edges from even length cycle need to have the same weight. To prove optimality of assume there exists a matching with bigger weight. Take twice and add self loop to all free vertices. This would give an -factor with bigger weight than . ∎

By setting for all , we can compute maximum size matching in a bipartite graph. We can make the above reduction of maximum bipartite matching to maximum (non-bipartite) perfect matchings slightly stronger by guaranteeing that the size of the resulting graph remains . The only requirement is to first reduce the maximum degree of a graph to using standard reduction (see e.g., [31]). In this way -factor gadgets will have constant size and the resulting graph has size.


  • [1] Manindra Agrawal, Thanh Minh Hoang, and Thomas Thierauf. The polynomially bounded perfect matching problem is in NC2. In Proceedings of the 24th Annual Conference on Theoretical Aspects of Computer Science, STACS’07, pages 489–499, Berlin, Heidelberg, 2007. Springer-Verlag.
  • [2] Nima Anari and Vijay V. Vazirani. Planar graph perfect matching is in NC, 2017. arXiv:arXiv:1709.07822.
  • [3] R.P. Anstee. A polynomial algorithm for b-matching: An alternative approach. IPL, 24:153–157, 1987.
  • [4] A. Borodin, S. Cook, and N. Pippenger. Parallel computation for well-endowed rings and space-bounded probabilistic machines. Information and Control, 58(1):113 – 136, 1983.
  • [5] G. Borradaile, P. N. Klein, S. Mozes, Y. Nussbaum, and C. Wulff-Nilsen. Multiple-source multiple-sink maximum flow in directed planar graphs in near-linear time. In 2011 IEEE 52nd Annual Symposium on Foundations of Computer Science, pages 170–179, Oct 2011.
  • [6] K.W. Chong and T.W. Lam. Finding connected components in time on the erew pram. Journal of Algorithms, 18(3):378 – 402, 1995. doi:
  • [7] L. Csanky. Fast parallel matrix inversion algorithms. SIAM Journal on Computing, 5(4):618–623, 1976.
  • [8] Marek Cygan, Harold N. Gabow, and Piotr Sankowski. Algorithmic applications of Baur-Strassen’s Theorem: Shortest cycles, diameter, and matchings. J. ACM, 62(4):28:1–28:30, September 2015.
  • [9] Jack Edmonds. Maximum matching and a polyhedron with 0,1-vertices. Journal of Research National Bureau of Standards-B.,, 69B:125–130, 1965.
  • [10] Jittat Fakcharoenphol and Satish Rao. Planar graphs, negative weight edges, shortest paths, and near linear time. Journal of Computer and System Sciences, 72(5):868 – 889, 2006. Special Issue on FOCS 2001.
  • [11] H. N. Gabow and P. Sankowski. Algebraic algorithms for b-matching, shortest undirected paths, and f-factors. In 2013 IEEE 54th Annual Symposium on Foundations of Computer Science, pages 137–146, Oct 2013.
  • [12] Harold Gabow and Robert Tarjan. Almost-optimum speed-ups of algorithms for bipartite matching and related problems. In

    Proceedings of the Twentieth Annual ACM Symposium on Theory of Computing

    , STOC ’88, pages 514–527, New York, NY, USA, 1988. ACM.
  • [13] Harold N. Gabow. An efficient reduction technique for degree-constrained subgraph and bidirected network flow problems. In Proc. of STOC’83, pages 448–456, 1983.
  • [14] Harold N. Gabow. A combinatoric interpretation of dual variables for weighted matching and f-factors. Theor. Comput. Sci., 454:136–163, October 2012.
  • [15] Harold N. Gabow and Robert E. Tarjan. Faster scaling algorithms for network problems. SIAM Journal on Computing, 18(5):1013–1036, 1989.
  • [16] Zvi Galil and Victor Y. Pan. Improved processor bounds for combinatorial problems in RNC. Combinatorica, 8(2):189–200, 1988.
  • [17] A. V. Goldberg, S. A. Plotkin, and P. M. Vaidya. Sublinear-time parallel algorithms for matching and related problems. In [Proceedings 1988] 29th Annual Symposium on Foundations of Computer Science, pages 174–185, Oct 1988. doi:10.1109/SFCS.1988.21935.
  • [18] A. V. Goldberg, D. B. Shmoys, S. A. Plotkin, and E. Tardos. Interior-point methods in parallel computation. In Proceedings of the 30th Annual Symposium on Foundations of Computer Science, SFCS ’89, pages 350–355, Washington, DC, USA, 1989. IEEE Computer Society.
  • [19] MichałHańćkowiak, MichałKaroński, and Alessandro Panconesi. On the distributed complexity of computing maximal matchings. In Proceedings of the Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’98, pages 219–225, Philadelphia, PA, USA, 1998. Society for Industrial and Applied Mathematics.
  • [20] T. M. Hoang. On the matching problem for special graph classes. In 2010 IEEE 25th Annual Conference on Computational Complexity, pages 139–150, June 2010.
  • [21] Mark Jerrum. Two good counting algorithms, pages 1–10. Birkhäuser Basel, Basel, 2003.
  • [22] Howard J. Karloff. A Las Vegas RNC algorithm for maximum matching. Combinatorica, 6(4):387–391, 1986.
  • [23] Richard M. Karp, Eli Upfal, and Avi Wigderson. Constructing a perfect matching is in random NC. Combinatorica, 6(1):35–48, 1986.
  • [24] P. W. Kasteleyn.

    Dimer statistics and phase transitions.

    Journal of Mathematical Physics, 4(2):287–293, 1963.
  • [25] Raghav Kulkarni and Meena Mahajan. Seeking a Vertex of the Planar Matching Polytope in NC, pages 472–483. Springer Berlin Heidelberg, Berlin, Heidelberg, 2004.
  • [26] M Luby. A simple parallel algorithm for the maximal independent set problem. In Proceedings of the Seventeenth Annual ACM Symposium on Theory of Computing, STOC ’85, pages 1–10, New York, NY, USA, 1985. ACM.
  • [27] Meena Mahajan and Kasturi R. Varadarajan. A new NC-algorithm for finding a perfect matching in bipartite planar and small genus graphs (extended abstract). In Proceedings of the Thirty-second Annual ACM Symposium on Theory of Computing, STOC ’00, pages 351–357, New York, NY, USA, 2000. ACM.
  • [28] Gary L. Miller. Finding small simple cycle separators for 2-connected planar graphs. Journal of Computer and System Sciences, 32(3):265 – 279, 1986.
  • [29] Gary L. Miller and Joseph (Seffi) Naor. Flow in planar graphs with multiple sources and sinks. SIAM Journal on Computing, 24(5):1002–1017, 1995.
  • [30] Gary L. Miller and John H. Reif. Parallel tree contraction part 1: Fundamentals. In Silvio Micali, editor, Randomness and Computation, pages 47–72. JAI Press, Greenwich, Connecticut, 1989. Vol. 5.
  • [31] Marcin Mucha and Piotr Sankowski. Maximum matching in planar graphs via Gaussian elimination. 12’th Annual Euroepan Symposium on Algorithms, accepted, 2004.
  • [32] K. Mulmuley, U.V. Vazirani, and V.V. Vazirani. Matching is as easy as matrix inversion. In STOC ’87: Proceedings of the nineteenth annual ACM conference on Theory of computing, pages 345–354. ACM Press, 1987.
  • [33] Piotr Sankowski. Processor efficient parallel matching. In Proc. of SPAA’05, pages 165–170, 2005.
  • [34] Piotr Sankowski. Faster dynamic matchings and vertex connectivity. In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’07, pages 118–126, Philadelphia, PA, USA, 2007. Society for Industrial and Applied Mathematics.
  • [35] Piotr Sankowski. Planar perfect matching is in NC, 2017. arXiv:arXiv:1709.07869.
  • [36] A. Schrijver. Combinatorial Optimization - Polyhedra and Efficiency. Springer-Verlag, 2003.
  • [37] Y. Shiloach and Uzi Vishkin. An parallel connectivity algorithm. Journal of Algorithms, 3:57 – 67, 1982.
  • [38] R. E. Tarjan and U. Vishkin. Finding biconnected componemts and computing tree functions in logarithmic parallel time. In 25th Annual Symposium onFoundations of Computer Science, 1984., pages 12–20, Oct 1984.
  • [39] Vijay V. Vazirani. Nc algorithms for computing the number of perfect matchings in -free graphs and related problems. Information and Computation, 80(2):152 – 164, 1989.

Appendix A Proof of Corollary 2

Consider a planar graph and a sign function for edges. Let us define a signed adjacency matrix of graph to be the matrix such that:

Theorem 18 (Kasteleyn [24]).

There exists a function such that is equal to the number of perfect matchings in a planar graph . Such function is called Pfaffian orientation.

Let us explain shortly the idea behind this theorem. Consider the definition , where is the set of all element permutations and denotes a sign of a permutation. Each term in can be seen as a set of edges in . This term will contribute non-zero to the determinant only if all cycles in have even length. If contains an odd cycle we can reverse signs on this cycle obtaining a term that will cancel out. As shown in [21]

, there is a bijection between ordered pairs of perfect matchings and all possible sets

that contain cycles of even length, i.e., non-zero terms in the determinant. The above theorem holds because for Pfaffian orientation all these terms have the same sign.

In our algorithms we will never directly need the number of matchings, but we need this idea to compute the weight of a minimum perfect matching. Let be integral edge weight function. We define a signed weighted adjacency matrix of graph to be the polynomial matrix such that:

where is the variable of the polynomial. The terms of correspond to pairs of perfect matching and in each term the power of will correspond to the sum of their weights. Hence, the terms in of minimum degree needs to correspond to pairs of minimum weight perfect matchings. Hence, we obtain the following.

Corollary 19.

For a Pfaffian orientation , the degree of the minimum degree term of in is equal to twice the weight of minimum weight perfect matching in .

The determinant of matrix with univariate polynomials of degree can be computed in NC as shown in [4].444The exact statement of the theorem in [4] limits the degree to

, but we can always pad the matrix with

’s on the diagonal to make its size equal to the degree. Hence, we obtain the following.

Corollary 20.

Given a planar graph and a weight function the weight of minimum perfect matchings in can be computed in NC.

Now let us argue how to realize Corollary 2. In order, to check whether an edge is allowed we just need to check whether , where is the minimum perfect matching in , and is the minimum perfect matching using edge . We have that , where is the minimum perfect matching in , i.e., in with both endpoints of removed. Finally, let us describe how to compute . If is odd, then is simply a minimum perfect matching of . Otherwise, when is even, we take the minimum of over all , where is a minimum perfect matching of .

Appendix B Finding Edge Disjoint Even Semi-Simple Cycles

In this section we assume to be working with a -connected planar graph . It is a standard assumption that implies that all faces of are simple. The main artifacts, that will be useful here, are double faces defined in the following way.555Double faces correspond to Building Block 3 or 4 in [25].

Definition 21.

Double face is a pair of two simple faces and , , connected by a simple path possibly of length . The faces can be incident and even share edges. In such a case, contains a single vertex that is shared by both faces.

If any of the faces of the double face is of even length then it immediately gives an even semi-simple cycle. The next lemma argues about the case when both faces are odd.

Lemma 22.

Let be an odd double face of , i.e., both faces are of odd length, then there exists an even semi-simple cycle in .


First, let us consider the case when and share an edge, and let be an edge of that does not belong to . Staring from walk along in both directions till you encounter vertices and that belong to both and . Let be that part of containing . Let and be the parts of that end at and . Because has odd length and have different parity, e.g., has odd length, whereas has even length. If has odd length we obtain odd cycle by joining it with . Otherwise, joining with gives an odd cycle. In any case this cycle contains edge – see Figure 6 c).

Second, let us consider the case when and do not share an edge. In this case we can construct an odd length semi-simple cycle by walking along , and along both directions of . This cycle is semi-simple, and we can take any edge of or as . ∎

Let us now show how to find double faces in a graph. The dual of is a multigraph having a vertex for each face of . For each edge in , there is an edge in between the vertices corresponding to the two faces of adjacent to . We identify faces of with vertices of and since there is a one-to-one correspondence between edges of and edges of , we identify an edge of with the corresponding edge in .

The next algorithm matches faces of the graph into double faces – see Figure 1. The idea is to use a spanning tree of the dual graph of . In such a spanning tree we pair together two children of a node, or we pair a child with its parent. In the first case, we have a path connecting two children, whereas in the second case two faces share an edge. Using such pair, we can match every face, but the root if the number of faces is odd. Then we take maximal set of double faces that are edge disjoint. In Lemma 24 we show that there are such faces.

1:Find a spanning tree of the dual graph and root it at arbitrary vertex .
2:For all compute the number of vertices in the subtree of rooted at .
3:for all  do In parallel
4:     Let .
5:     if  is odd then
6:         Let be any child in .
7:         Mark as a double face where is any vertex shared by and .
8:         .      
9:     Order according to the order around .
10:     Mark pairs of consecutive children together with path of that connects them as a double face .
11:Construct a graph where vertices are marked double faces and edges denote which double faces share an edge.
12:Find maximal independent set of vertices in and return it.
Algorithm 7 Given graph where all faces are simple, computes a set of edge disjoint double faces.
Figure 1: Figure a) shows a planar graph together with a spanning tree of the dual graph. Figure b) shows a paring of faces constructed by Algorithm 7. Figure c) presents a cut-open graph as constructed in the proof of Lemma 24 – each double face corresponds to a face in this graph.
Lemma 23 (Lemma 3 from [27]).

A planar graph with faces contains a set of edge disjoint faces.

Lemma 24.

The maximal independent set of vertices in is of size , i.e., Algorithm 7 finds edge disjoint double faces.


Consider the graph and all the marked double faces. Let us construct a new graph by converting double faces into faces in the following way. If and share some edges we remove these edges. Otherwise, we cut the graph open along joining and into single face – see Figure 1 c). By the construction this graph has at least faces that correspond to double faces in . The face might have remained not assigned to any double face. By Lemma 23 we know that contains edge disjoint faces. Finally, by Lemma 7 we know that . This ends the proof. ∎

This implies Lemma 6.

Appendix C Finding Blossoms

In this section we show how to find a laminar family of blossoms that forms a critical dual. Algorithm 8 is essentially a restatement of Algorithm 5 from [8]. The only difference is that in [8] the algorithm is stated as processing values in increasing order to save on sequential work. However, here we process each value independently in parallel.

We have to note that this algorithm actually constructs a critical dual with an additional property which is called balanced.666For formal definition see [8] or see [14] for alternative definition of canonical dual. The take out note is that this property makes the dual unique and explains why this algorithm can be implemented in NC in a straightforward way.

1:For each edge set .
2:Let be the set of all different values . Let .
3:for each  do In parallel
4:     Let be the set of connected components of the graph .
5:     Add the nontrivial components of to .
6:return .
Algorithm 8 Given all the values , finds the blossoms of a balanced critical dual in the graph where all edges are allowed.
Lemma 25 (Lemma 6.19 [8]).

Let be undirected connected graph where edge weights are given by and where every edge is allowed. Given all values for , Algorithm 8 finds a blossoms of a balanced critical dual solution.

Appendix D Maximum Non-Bipartite Matching

In this section we will turn our attention to the most challenging problem – maximum size non-bipartite matching, where we will show an time algorithm. Thus solving this problem in NC remains an intriguing open problem. We note that so far no time deterministic parallel algorithm for this problem was known. We will first observe that Algorithm 3 can be adopted to the case when graph is not factor critical, i.e., consider arbitrary almost perfect matching in . For all , we redefine as:

Similarly, for all , where . The following is immediate consequence of the proof given in Section 6.

Corollary 26.

Let be a graph and let be an almost perfect matching in . An almost perfect matching , if it exists, can be found in NC using Algorithm 3.

This gives rise to the following algorithm that uses NC procedure for finding -planar separators [28].

1:if  is a single vertex then
2:     Return
3:Split the graph into two parts and using planar separator .
4:Recurse on and to find maximum size matching and .
5:Let be the set of free vertices.
6:For each add a new node .
7:Add edge to and .
8:for all  do Sequentially
9:     Remove and from .
10:     if there exists an alternating path from to any vertex in  then
11:         apply to
12:     else
13:         Readd to and to and .      
14:Remove for all .
15:Return .
Algorithm 9 Finds a maximum cardinality matching in graph .

After going up from the recursion on and there might be at most augmenting paths with respect to . Each such path needs to be incident to a different vertex from the separator.

Lemma 27.

A maximum size matching in planar non-bipartite graph can be computed in time on PRAM.

Appendix E Min-Cost Flow

This section presents an algorithm for computing min-cost planar flow. We are given a directed planar network . The edges have integral capacities given by and integral costs . Moreover, each vertex has integral demand .

We construct a bipartite graph whose maximum -factor has weight equal to the min-cost of flow in . The following vertex-splitting construction was first given by [15] (see Figure 7 c)):

  • for each place vertices in ;

  • for each add copies of edge to ;

  • for each add copies of edge to ;

  • for , if set and otherwise set and ;

  • for each copy of the edge set .

Corollary 28 ([15]).

Let be the flow network. The weight of the minimum -factor in is equal to the minimum cost of a flow in .

Observe that for we have , i.e., is polynomial. We note, that the reduction does not preserve planarity, e.g., consider a vertex od degree with in, out, in, out edges in circular order. We can overcome this problem by first reducing the degree of the graph to . This can be done by replacing a vertex of degree by a directed cycle of length and connecting each edge incident to to separate vertex on the cycle – see Figure 7 b). The capacity of the edges on should be whereas their cost is . The demand is assigned to one of the vertices of the cycle, whereas the other vertices have demand. We note that degree vertices can have only two possible configuration of incident edges, i.e., in, in, out, and in, out, out. Now in both these cases the above vertex splitting preserves planarity.

Theorem 29.

Let be a planar flow network with integral capacities , integral costs and integral demands . The minimum cost flow in can be computed in NC.

Given two vertices the min-cost -flow problem of value can be easily computed using the above theorem. And if we want to find maximum flow of minimum cost, we first need to know the max-flow value that can be either computed using [29] or using the binary search.

Appendix F Maximum Multiple-Source Multiple-Sink Flow

In this section we modify the idea from the previous section to handle the case when source and sink demands are not fixed but need to be maximized. We are given a directed planar network with integral edge capacities given by . Moreover, each vertex has integral demand . Vertices such that are called sources and we require for them . Vertices such that are called sinks and we require . For remaining vertices , i.e., when we need to have . The maximum multiple-source multiple-sink flow in is the flow that maximizes value , where is the set of all sources.

In order to solve this problem we need to combine ideas from the previous section with the ideas used for computing maximum size bipartite matching, i.e., we first multiply all the demands by and then introduce self loops on source and sink vertices. We construct a bipartite graph where maximum -factor has weight equal to the maximum multiple-sou