Computational Complexity Lecture 25: Counting Problems in CS221, Study notes of Computational Methods

This document from the cs221 computational complexity course, taught by prof. Salil vadhan, discusses counting problems in bipartite graphs, including the #p-completeness of counting matchings and perfect matchings. The document also introduces approximate counting and its relationship to decision problems. The lecture covers theorems, proofs, and facts related to counting problems and their approximations.

Typology: Study notes

2010/2011

Uploaded on 10/28/2011

thecoral
thecoral 🇺🇸

4.5

(30)

395 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS221: Computational Complexity Prof. Salil Vadhan
Lecture 25: Counting Problems (cont.)
11/22 Scribe: Grant Schoenebeck
Contents
1 Counting Matchings 1
2 Approximate Counting 3
1 Counting Matchings
Definition 1 Amatching is a set of edges such that no two edges in the
set share a vertex. A perfect matching is a matching in which every vertex
is touched by at least one (and hence exactly one) edge.
Recall that #Pcontains all problems which amount to counting the number
of witnesses to an NP relation. Last time, we stated (without proof ):
Theorem 2 Counting the # of perfect matchings, #Perfect Match-
ings, in a bipartite graph is #P-complete.
Proof: It is equivalent to computing the permanent of a 0/1 matrix.
Now we’ll show:
Theorem 3 Counting the # of matchings (perfect or not) in a bipartite
graph G,#Matchings, is #P-complete.
Proof: Clearly it is in #Pbecause testing whether a set of a matching
is in P. We want to show that it is #P-hard. We reduce from #Perfect
Matchings via a Cook reduction. That is, given an oracle for #Match-
ings we can solve #Perfect Matchings.
1
pf3
pf4
pf5

Partial preview of the text

Download Computational Complexity Lecture 25: Counting Problems in CS221 and more Study notes Computational Methods in PDF only on Docsity!

CS221: Computational Complexity Prof. Salil Vadhan

Lecture 25: Counting Problems (cont.)

11/22 Scribe: Grant Schoenebeck

Contents

1 Counting Matchings 1

2 Approximate Counting 3

1 Counting Matchings

Definition 1 A matching is a set of edges such that no two edges in the set share a vertex. A perfect matching is a matching in which every vertex is touched by at least one (and hence exactly one) edge.

Recall that #P contains all problems which amount to counting the number of witnesses to an NP relation. Last time, we stated (without proof):

Theorem 2 Counting the # of perfect matchings, #Perfect Match- ings, in a bipartite graph is #P-complete.

Proof: It is equivalent to computing the permanent of a 0/1 matrix.

Now we’ll show:

Theorem 3 Counting the # of matchings (perfect or not) in a bipartite graph G, #Matchings, is #P-complete.

Proof: Clearly it is in #P because testing whether a set of a matching is in P. We want to show that it is #P-hard. We reduce from #Perfect Matchings via a Cook reduction. That is, given an oracle for #Match- ings we can solve #Perfect Matchings.

Say we are given a bipartite graph G that has n vertices on each side. Let

Ni = # of matchings in G consisting of exactly i edges.

So we want to compute Nn, given an oracle for #Matchings. Applying the oracle on G itself, we obtain:

#Matchings(G) =

∑^ n

i=

Ni

Now we will make oracle calls on related graphs to obtain additional equa- tions involving the Ni’s until we can solve for Nn.

We produce a new graph Gt from G by starting with G and creating n · t new vertices on the right-hand side and connecting t of the new vertices to each vertex on the left side of Gt with a new edge. Now

#Matchings(Gt) =

∑^ n

i=

Ni(t + 1)n−i

We can see this by first determining which of the old edges (edges from G) we are going to include in our set of edges for the matching, then consider the new edges. So fix a matching on G, then for each unused vertex on the left side, we can use any of the t edges that we added, or we can use none of the t new edges. Thus we have (t + 1)(number of unused vertices on the left side) matchings in Gt for each matching in G. This is just (t + 1)n−i^ where i is the number of edges used in the matching in G.

So now we can define the polynomial PG(x) =

∑n i=0 Nix n−i (^) and then we see

#Matchings(Gt) = PG(t + 1)

Lemma 4 Let F be a field and α 0 , α 1 ,... , αd ∈ F be distinct and βo, β 1 ,... , βd ∈ F. Then there exists a unique polynomial of degree ≤ d such that p(αi) = βi for i = 0, 1 , 2 ,... , d. Moreover p can be found in polynomial time.

Proof: Lagrange interpolation formula:

p(x) =

∑^ d

i=

βi

j 6 =i

(x − αi) αi − αj

Definition 6 For α ≥ 1 , an α-approximation algorithm for f : { 0 , 1 }∗^ → R is a probabilistic algorithm A such that for all x

P r [f (x) ≤ A(x) ≤ αf (x)] ≥

where the probability is taken over the coin tosses of A.

Remarks:

  • α = 1 corresponds to an exact algorithm, and thus the goal (in algo- rithm design) is to have α as close to 1 as possible.
  • The fact that the error is always above the actually answer is arbitrary and can be switched to be below be dividing the result by α.
  • The success probability of 23 can be amplified by running the algorithm many times and taking the median.

Fact 7 Approximate counting is at least as hard as decision.

f (x) = 0 ⇒ must output 0

f (x) > 0 ⇒ must output something > 0

Fact 8 Many approximate counting algorithms are known for #P-complete problems, e.g. #Matchings, #Perfect Matchings, #DNF.

Fact 9 For most natural NP relations (namely, ones which are “self re- ducible” in an appropriate sense) approximate counting is equivalent to gen- erating witnesses almost uniformly at random, and in fact this is how the above-mentioned algorithms are designed.

Fact 10 Approximate counting can always be done in probabilistic polyno- mial time with an NP-oracle (”NP-easy”). So these approximation prob- lems are unlikely to be #P-complete (by Toda).

There are examples where decision is easy but approximate counting is hard. Let #Cycles be the problem of counting the number of simple cycles (i.e. cycles without any repeated vertices) in a graph.

Theorem 11 Approximating #Cycles is NP hard (for any constant ap- proximation factor).

Proof: Reduce from Hamiltonian Cycle which is NP-complete. Given G with n vertices we want to decide if it has a simple cycle of length n. We use a common technique in which we create a new graph G′^ that “blows up” the number of simple cycles in G especially long cycles. So if there is a Hamiltonian cycle in G, there will be a lot of cycles in G′. To do this, we replace each edge in G by t − 1 new vertices and 2 · t edges. The first original vertex has two edges going from it to the first new vertex, which has two edges going from it to the second new vertex, which has two edges to the third vertex, and so on. This happens until we run out of new vertices and then we connect the last new vertex to the remaining original vertex with 2 edges.

Now any time a cycle in G uses a particular edge it now as 2t^ different ways to traverse the edge in G′. At each new vertex (and at the first original one) the path can take either of the two edges. So a cycle of length ( k in G yields 2 t

)k cycles in G′. So if G has an hamiltonian cycle, the new graph will have at least ≥ 2 t·n^ cycles (where n is the number of vertices). If G does not have a hamiltonian cycle then each cycle of G is blown up by a factor of at most 2 t·(n−1). Since G has at most nn^ cycles, G′^ has at most

nn^ · 2 t·(n−1)^ = 2t·n^ ·

nn 2 t^

cycles. So the ratio of the number of cycles in G′^ if G has a Hamiltonian cycle to the number of cycles in G′^ where G has no Hamiltonian cycles is at least 2 t·n 2 t·n^ · n n 2 t

2 t nn

Which is arbitrarily large if we let t get large. In particular, if t = n^2 (so G′^ is only polynomially larger than G), then this ratio goes to ∞. So if we could approximate the number of cycles to within a constant factor, we could decide whether G has a Hamiltonian cycle, which is NP-complete.