# HW10 Complexity_ver2..

```Math/CS 262
Spring 2011
Homework #10
(Due Monday, May 2nd by 4p)
1. Satisfiability and 3-Sat
NOTE: 3-Sat is NP
If we assume 𝑛 variables and 𝑚 clauses in a 3-Sat instance. If it takes
𝑘 steps to verify that a clause is satisfied then it just takes 𝑘𝑚 steps to
verify whether a given guess satisfies all the clauses.
a. A “brute force” approach to 3-Sat would work through all possible truth
assignments to the Boolean variables to try to find one that satisfies all
the clauses.
If each truth assignment takes 𝑘𝑚 steps to verify whether it satisfies,
how many steps would this approach take to find there is no satisfying
truth assignment?
b. Now let 𝑣 represent the number of variables, and 𝑐 represent the
number of clauses in a Satisfiability instance. Further, assume that the
largest size clause has size 𝑠. What is a bound on the size of the 3-Sat
instance our transformation produces? (Can you bound the number of
variables and clauses produced?) For the transformation to be valid,
each of these must be bounded by a polynomial in 𝑣 and 𝑐.
2. Graph 3-Color: Assume the instance is a graph with 𝑣 vertices and 𝑒 edges.
NOTE: Graph 3-Color is NP
If it takes 𝑘 steps to verify that the two endpoints of an edge are
different colors. (𝑘 would be a fixed number.) Then it just takes 𝑘𝑒 steps to
verify whether a given guess is a valid coloring.
a. A “brute force” approach would work through all possible color
assignments (using three colors) to try to find one that represented a
valid coloring.
If each color assignment takes 𝑘𝑒 steps to verify whether it’s valid, how
many steps would this approach take to find that there is no 3-coloring?
b. Given an instance of 3-Sat with 𝑛 variables and 𝑚 clauses, what is the
size of the graph our transformation produces? (How many vertices and
edges would the graph have?) Our transformation is only valid if these
sizes are bounded by a polynomial in 𝑛 and 𝑚.
3. Consider the following three problems:
a. Set Packing
Instance:
A collection 𝐶 = {𝑐𝑖 : 1 ≤ 𝑖 ≤ 𝑛} of finite sets and a positive integer 𝐾 &lt; 𝑛.
Question:
Does C contain 𝐾 disjoint sets?
b. Exact Cover by 3 Sets
Instance:
A set 𝑆 with |𝑆| = 3𝑛 and a collection 𝐶 = {𝑐𝑖 : 1 ≤ 𝑖 ≤ 𝑘} where 𝑐𝑖 ⊂ 𝑆
and |𝑐𝑖 | = 3 for each 𝑖.
Question:
Does 𝐶 contain an exact cover? (I.e., is there a subcollection 𝐵 of 𝐶 such
that each element of 𝑆 appears in exactly one of the sets in 𝐵?)
c. 3-Dim Matching
Instance:
A complete set of triples S = W x X x Y (with |𝑊| = |𝑋| = |𝑌| = 𝑛)
and a subset A ⊆ S of “allowable” triples
Question:
Does A contain a matching? (I.e., is there a subset B of A with the property
that each element of W, X and Y appears in exactly one of the triples in B?)
Your task: Use the fact that “3-Dim Matching” is NP Hard to show that “3-Set
Exact Cover” is NP Hard. Then show “Set Packing” is NP Hard.
Hint: Use the restriction method – i.e. show that an instance of the known NP
Hard problem already is an instance of the new problem as a special case.
4. Vertex Cover
Show that “Vertex Cover” is NP hard by transforming an arbitrary instance
of “3-Sat” into an equivalent instance of “Vertex Cover”.
I suggest you use the method of “component design”. The vertex
cover examples from the last HW are intended to be a hint.
5. Partition into Triangles
Instance: a graph G = (V, E) with |𝑉| = 3𝑛.
Question:
Is there a partition of V into disjoint subsets 𝑉 = ⋃𝑛𝑖=1 𝑇𝑖 such that each
𝑇𝑖 is consists of three vertices that form a triangle in G. (In other words, all three
potential edges between the three vertices are in G.)
Show that “Partition into Triangles” is NP hard by transforming an arbitrary
instance of “Exact cover by 3 Sets” into an equivalent instance of “Partition
into Triangles”.
What follows are hints for this last problem.
Consider the following gadget:
x
y
z
In your constructed graph, the blue vertices will have no edges other than the ones
shown. The black vertices may be connected to multiple gadgets.
If all three black vertices are available then there are two ways to partition the blue
vertices of the gadget into triangles.
Triangles Choice 1: This may only be chosen if the three black vertices are available.
x
y
z
Triangles Choice 2: If the gadget is a piece of a bigger graph then we would also have the
following option, which excludes {x,y,z}.
x
y
z
Practice Exercise: Does the following graph have a partition into triangles?
a
b
d
e
c
f
```