3
Information Processing Letters 70 (1999) 95–97 On the sets of perfect matchings for two bipartite graphs Arnold Rosenbloom 1 Department ofComputer Science, University of Toronto, Toronto, Ontario, Canada M5S 1A4 Received 1 August 1998 Communicated by S.G. Akl Abstract This short note discusses the complexity of determining containment for the set of witnesses for some NP problems. For matching we settle an open problem by describing a simple algorithm to determine whether the set of perfect matchings of one bipartite graph is contained in the set of perfect matchings of another bipartite graph. As a consequence we arrive at a simple algorithm to determine whether the set of perfect matchings of two bipartite graphs is identical. 1999 Published by Elsevier Science B.V. All rights reserved. Keywords: Computational complexity; Circuit complexity; Matching 1. Introduction Any language L in NP can be characterized as L = x : 5y ( |y | 6 p(|x |) ) R(x,y) where R is polytime computable and p is a fixed polynomial depending on L. For any such R as above, one can consider f(x) = y : |y | 6 p(|x |) R(x,y) . The class of such functions is denoted #P. A natural question related to problems in #P and NP, is whether two instances of a given problem have the same set or number of witnesses, in otherwords whether y : |y | 6 p(|x 1 |) R(x 1 ,y) = y : |y | 6 p(|x 2 |) R(x 2 ,y) or y : |y | 6 p(|x 1 |) R(x 1 ,y) = y : |y | 6 p(|x 2 |) R(x 2 ,y) . 1 Email: [email protected]. For the NP-complete problem SAT [1] we are asking whether two CNF formulae have the same set of satisfying truth assignments. For bipartite perfect matching, we are asking whether two bipartite graphs have the same set of perfect matchings. Finally, one can ask whether the set of witnesses for one problem is contained in the set of witnesses for another (i.e., y : |y | 6 p(|x 1 |) R(x 1 ,y) y : |y | 6 p(|x 2 |) R(x 2 ,y) ). 2. General answers Theorem 2.1. If L ={x : 5y(|y | 6 p(|x |))R(x,y)} is an NP-complete problem then {(x 1 ,x 2 ): x 1 and x 2 have the same set of witnesses under R} is a coNP- complete language. Proof. The complementary problem, that of finding a witness for x 1 which is not a witness for x 2 , is NP- complete. It is easily in NP, just guess a potential 0020-0190/99/$ – see front matter 1999 Published by Elsevier Science B.V. All rights reserved. PII:S0020-0190(99)00046-0

On the sets of perfect matchings for two bipartite graphs

Embed Size (px)

Citation preview

Page 1: On the sets of perfect matchings for two bipartite graphs

Information Processing Letters 70 (1999) 95–97

On the sets of perfect matchings for two bipartite graphs

Arnold Rosenbloom1

Department of Computer Science, University of Toronto, Toronto, Ontario, Canada M5S 1A4Received 1 August 1998

Communicated by S.G. Akl

Abstract

This short note discusses the complexity of determining containment for the set of witnesses for some NP problems. Formatching we settle an open problem by describing a simple algorithm to determine whether the set of perfect matchings of onebipartite graph is contained in the set of perfect matchings of another bipartite graph. As a consequence we arrive at a simplealgorithm to determine whether the set of perfect matchings of two bipartite graphs is identical. 1999 Published by ElsevierScience B.V. All rights reserved.

Keywords:Computational complexity; Circuit complexity; Matching

1. Introduction

Any languageL in NP can be characterized as

L= {x: ∃y(|y|6 p(|x|))R(x,y)}whereR is polytime computable andp is a fixedpolynomial depending onL. For any suchR as above,one can consider

f (x)= ∣∣{y: |y|6 p(|x|)∧R(x,y)}∣∣.The class of such functions is denoted #P. A naturalquestion related to problems in #P and NP, is whethertwo instances of a given problem have the samesetornumberof witnesses, in otherwords whether{y: |y|6 p(|x1|)∧R(x1, y)

}= {y: |y|6 p(|x2|)∧R(x2, y)

}or∣∣{y: |y|6 p(|x1|)∧R(x1, y)

}∣∣= ∣∣{y: |y|6 p(|x2|)∧R(x2, y)

}∣∣.1 Email: [email protected].

For the NP-complete problem SAT [1] we areasking whether two CNF formulae have the same setof satisfying truth assignments. For bipartite perfectmatching, we are asking whether two bipartite graphshave the same set of perfect matchings. Finally, onecan ask whether the set of witnesses for one problemis contained in the set of witnesses for another (i.e.,{y: |y|6 p(|x1|)∧R(x1, y)

}⊆ {y: |y|6 p(|x2|)∧R(x2, y)

}).

2. General answers

Theorem 2.1. If L= {x: ∃y(|y|6 p(|x|))R(x, y)} isan NP-complete problem then{(x1, x2): x1 and x2have the same set of witnesses underR} is a coNP-complete language.

Proof. The complementary problem, that of finding awitness forx1 which is not a witness forx2, is NP-complete. It is easily in NP, just guess a potential

0020-0190/99/$ – see front matter 1999 Published by Elsevier Science B.V. All rights reserved.PII: S0020-0190(99)00046-0

Page 2: On the sets of perfect matchings for two bipartite graphs

96 A. Rosenbloom / Information Processing Letters 70 (1999) 95–97

witnessy for x1 and verify that|y| 6 p(|x1|) andR(x1, y). Finally check that

¬(|y|6 p(|x2|)∧R(x2, y)).

To see that this problem is NP-hard letx2 /∈ L beany instance of our problem. Then any difference inwitnesses betweenx1 andx2 corresponds to a witnessfor x1 and sox1 ∈L. 2Theorem 2.2. Let

L= {x: ∃y(|y|6 p(|x|))R(x,y)}.Consider the languageL′ = {(x1, x2): x1 andx2 havethe samenumberof witnesses underR}. L′ is in P#P

and ifL is NP-complete thenL′ is coNP-hard.

Proof. It is clear thatL′ ∈ P#P. The proof thatL′ iscoNP-hard is as in the above theorem.2

3. Matching

Bi-partite Matching presents a particularly interest-ing example of our question. Explicitly,

Match=Instance:Vertex setV , edge setsE1 andE2 onV .

E1 andE2 determine bipartite graphs onV .Question:DoE1 andE2 have the same set

of perfect matchings?

Note that Valiant [5] established that countingthe number of perfect matchings (or computing thepermanent of a 0–1 matrix) is #P-complete. Wegive a simple algorithm for Match= which easilytranslates to a deterministic polytime algorithm (P) ora randomized NC algorithm. To do this, we give aneasy algorithm for Match⊆ defined below.

Match⊆Instance:Vertex setV , edge setsE1 andE2 onV .Question: Is the set of perfect matchings based onE1

a subset of the set of perfect matchingsbased onE2?

We note that prior to this document, no good de-terministic algorithms were known for Match= orMatch⊆. No good algorithms, randomized or other-wise, were known for Match⊆. It is possible to de-

termine membership in Match= using the randomizedpolynomial equivalence testing procedures in [4].

Note that if we consider matchings (no perfectionrequired) or maximal matchings then our problem istrivial. In either case, any edge difference betweenE1andE2 decides the problem.

Below we settle a few small issues

Lemma 3.1. Match= is at least as hard as Matching.

Proof. To solve Matching using Match=, letE2 be theempty bipartite graph on the same set of vertices.2Lemma 3.2. Every perfect matching in(V,E1) not in(V,E2) involves an edge inE1−E2.

Proof. If E ⊆ E1 is a matching in(V,E1) andE ⊆E2 then it is a matching in(V,E2). 2

Based on the above simple observation, we havethe following algorithm for Match⊆. For a graphG=(V,E) and a set of verticesU by G − U we meanthe graph that results fromG when the vertices inU are removed. Note that the incident edges are alsoremoved.

Algorithm Match⊆G= (V,E1)

for (v, v′) ∈E1−E2if G− {v, v′} has a perfect matching then

return(false)end if

end forreturn(true)

Lemma 3.3. The above algorithm forMatch⊆ is cor-rect.

Proof. If (V,E1) has a perfect matching that(V,E2)

does not, then as in the above theorem, the matchinginvolves an edge(v, v′) ∈ E1−E2. ThenG− {v, v′}contains a perfect matching and the above algorithmeventually, correctly returns false.

If the above algorithm returns false, then for some(v, v′) ∈ E1 − E2, we have thatG − {v, v′} hasa perfect matching. This perfect matching can beextended to a matching in(V,E1) not in (V,E2) byadding edge(v, v′). 2

Page 3: On the sets of perfect matchings for two bipartite graphs

A. Rosenbloom / Information Processing Letters 70 (1999) 95–97 97

We note that a simple polytime implementationof Algorithm Match⊆ involves calling a polytimesubroutine for perfect matching [3] at most|V |2/2times. A random NC circuit solving Match⊆ carriesout all the matching checks in parallel using the RNCalgorithm in [2].

Theorem 3.4. There are simpleP and RNC algo-rithms forMatch⊆ andMatch=.

Proof. (E1,E2) ∈Match= ⇔ (E1,E2) ∈Match⊆ and(E2,E1) ∈Match⊆. 2

We mention the following very interestingopenquestion. Determine the complexity of the languageof pairs of bipartite graphs(G1,G2) which have thesamenumber of perfect matchings. Unfortunately,Valiants reduction of #SAT (the number of satisfyingassignments for a 3-CNF) to Permanent does not leadto the coNP-hardness of the above language though wesuspect this to be the case. The reader can contrast thisopen question with the following theorem which doesfollow from Valiants reduction (as it appears in [3]).

In what follows,G1 andG2 are bipartite graphson the same vertex set. UNSAT is the languageof unsatisfiable 3-CNF formulae. #Match(G) is thenumber of perfect matchings inG.

Theorem 3.5. Let

L= {(G1,G2,N): #Match(G1)

= #Match(G2) modN}

thenL is coNP-hard.

Proof. We describe how to recognize an unsatisfiableCNF using Valiants reduction. We do not providedetails here but refer the reader to the proof in [3].

Let C = {c1, . . . , ck} be a 3-CNF formulae withm= 3k literal occurences. Letf be Valiants transfor-mation function then

4m ∗ (#SAT(C))= #Match

(f (C)

)mod 28m.

To determine whetherC is unsatisfiable, letD be anyunsatisfiable 3-CNF on the same variable set asC withk clauses.D can easily be constructed in polytimefrom C. Then #Match(f (D)) mod 28m = 0 and so(f (C),f (D),28m) ∈L⇔C ∈UNSAT. 2

Fig. 1. A bipartite graph with(((2 + 1)22 + 1)2 + 1)23 + 1 =27 + 26 + 24 + 23 + 1 perfect matchings. Note the gapsbetween loops and the exponents in the expression(((2 +1)22 + 1)2+ 1)23 + 1. If the number happened to be even thenthe outermost loop would be omitted.

Finally, we note that the problem of determiningwhether #Match(G1)6 #Match(G2) is probably verydifficult.

Theorem 3.6. Let

L= {(G1,G2): #Match(G1)6 #Match(G2)modN},

then#P⊆ FPL whereFP is the set of functions com-putable by a deterministic turing machine in polytime.

Proof. Determine #Match(G1) using an oracle forLby using binary search. Successively construct the ap-propriate graphG2 and check whether(G1,G2) ∈ L.Fig. 1 suggests the method of construction of a graphwith any given number of perfect matchings.2

Acknowledgements

This author thanks Allan Borodin for suggestingthis interesting question and both Allan and SteveCook for (as always) interesting discussions.

References

[1] S.A. Cook, The complexity of theorem-proving procedures, in:Proc. 3rd Ann. ACM Symposium on Theory of Computing,Shaker Heights, OH, ACM, ACM Press, NY, 1971, pp. 151–158.

[2] R. Motwani, P. Raghavan, Randomized Algorithms, CambridgeUniv. Press, Cambridge, 1995.

[3] C. Papadimitriou, Computational Complexity, Addison-Wesley,Reading, MA, 1994.

[4] J.T. Schwartz, Fast probabilistic algorithms for verification ofpolynomial identities, J. ACM 27 (1980) 710–717.

[5] L.G. Valiant, The complexity of computing the parmanent,Theoret. Comput. Sci. 8 (1979) 189–201.