Title: Perfect Matchings in Bipartite Graphs
1Perfect Matchings in Bipartite Graphs
An undirected graph G(U?V,E) is bipartite if
U?V? and E?U?V.
A 1-1 and onto function fU?V is a perfect
matching if for any u?U, (u,f(u))?E.
2Finding Perfect Matchings is Easy
Matching as a flow problem
3What About Counting Them?
- Let A(a(i,j))1?i,j?n be the adjacency matrix of
a bipartite graph G(u1,...,un?v1,...,vn,E),
i.e. -
- The number of perfect matchings in the graph is
permanent
sum over the permutations of 1,...,n
4Cycle-Covers
- Given an undirected bipartite graph
G(u1,...,un?v1,...,vn,E), the corresponding
directed graph is G(w1,...,wn,E), where
(wi,wj)?E iff (ui,vj)?E. - Definition Given a directed graph G(V,E), a
set of node-disjoint cycles that together cover V
is called a cycle-cover of G. - Observation Every perfect matching in G
corresponds to a cycle-cover in G and vice-versa.
5Three Ways To View Our Problem
- 1) Counting the number of Perfect Matchings in a
bipartite graph. - 2) Computing the Permanent of a 0-1 matrix.
- 3) Counting the number of Cycle-Covers in a
directed graph.
6P - A Complexity Class of Counting Problems
- L?NP iff there is a polynomial time decidable
binary relation R, s.t.
some polynomial
- f ?P iff f(x) y R(x,y) where R is a
relation associated with some NP problem. - We say a P function is P-Complete, if every P
function Cook-reduces to it. - It is well known that SAT (i.e - counting the
number of satisfying assignments) is P-Complete.
7On the Hardness of Computing the Permanent
- Claim Val79 Counting the number of
cycle-covers in a directed graph is P-Complete. - Proof By a reduction from SAT to a
generalization of the problem.
8The Generalization Integer Permanent
2
- Activity an integer weight attached to each edge
(u,v)?E, denoted ?(u,v). - The activity of a matching M is
?(M)?(u,v)?M?(u,v). - The activity of a set of matchings S is
?(M)?M?S?(M). - The goal is to compute the total activity.
3
1
2
2
3
2
1
9Integer Permanent Reduces to 0-1 Permanent
the rest of the graph
We would have loved to do something of this
sort...
1
2
1
10Integer Permanent Reduces to 0-1 Permanent
the rest of the graph
So instead we do
11- But this is really cheating!
- The integers may be exponentially large, but we
are forbidden to add an exponential number of
nodes!
12The Solution
the rest of the graph
...
13What About Negative Numbers?
- W.l.og, let us assume the only negative numbers
are -1s. - We can reduce the problem to calculating the
Permanent modulo (big enough) N of a 0-1 matrix
by replacing each -1 with (N-1). - Obviously, Perm mod N is efficiently reducible
to calculating the Permanent.
14Continuing With The Hardness Proof
- We showed that computing the permanent of an
integer matrix reduces to computing the permanent
of a 0-1 matrix. - It remains to prove the reduction from SAT to
integer Permanent. - We start by presenting a few gadgets.
15The Choice Gadget
- Observation in any cycle-cover the two nodes
must be covered by either the left cycle (true)
or the right cycle (false).
16The Clause Gadget
each external edge corresponds to one literal
- Observation
- no cycle-cover of this graph contains all three
external edges. - However, for every proper subset of the external
edges, there is exactly one cycle-cover
containing it.
17The Exclusive-Or Gadget
- The Perm. of the whole matrix is 0.
- The Perm. of the matrix resulting if we delete
the first (last) row and column is 0. - The Perm. of the matrix resulting if we delete
the first (last) row and the last (first) column
is 4.
-1
-1
2
3
-1
18Plugging in the XOR-Gadget
- Observe a cycle-cover of the graph with a
XOR-gadget plugged as in the below figure. - If e is traversed but not t (or vice versa), the
Perm. is multiplied by 4. - Otherwise, the Perm. is added 0.
e
t
19Putting It All Together
- One choice gadget for every variable.
- One Clause gadget for every clause.
if the literal is x
if the literal is ?x
20Sum Up
- Though finding a perfect matching in a bipartite
graph can be done in polynomial time, - counting the number of perfect matchings is
P-Complete, and hence believed to be impossible
in polynomial time.