Questions are in black, solutions in blue.
This algorithm can be used to decide the NP-complete language 3-COLOR. Given an undirected graph, we first apply the given algorithm and determine how many colors are used in its coloring. If there are three or fewer, we know that the input graph is 3-colorable and return "true". If it has four or more colors, we return "false". We are correct in returning "false" in this case because if the optmimal number were 3 or less, the algorithm would have used at most 3*(5/4) = 3.75 colors. Since it used four or more, there cannot have been a 3-coloring. If any NP-complete language can be decided in poly-time, then P=NP. (This decision procedure uses the poly-time given algorithm and then just counts the colors in the graph and answers, which is clear in poly-time overall.)
Again, we will use the given algorithm to solve 3-COLOR in poly-time. Given an input graph G, let the graph H be two copies of G with no other edges. Give H to the given algorithm. (Since the size of H is only polynomially larger than that of G, the running time will still be polynomial in the size of G.) Suppose that G is 3-colorable. Then H is also 3-colorable. Since the coloring of H has only one vertex that is not colored correctly, at least one of the two copies of G must be entirely correct. We just check both of them and return "true" if either of then is correctly colored. Otherwise we return "false". It is clear that the extra work after the given algorithm is poly-time, and that we will return "true" iff G is 3-colorable. Since the NP-complete langauge 3-COLOR is in P under the assumption that this algorithm exists, P=NP in this case.
Let G be any input graph with n vertices and let H be the union of n separate copies of G. Clearly H is 3-colorable iff G is, and H has n2 vertices. Run the given algorithm on H to get a coloring. If G and H are 3-colorable, this coloring must have fewer than sqrt(n2) or fewer than n incorrect vertices, so at least one of the copies of G is correctly colored. Thus our decision procedure is to get this coloring, check each copy of G, and return "true" iff one of the copies is correctly colored. This is poly-time because the given algorithm takes time polynomial in n2 (hence also polynomial in n) and the extra work is clearly polynomial in the size of G. Since in this case the NP-complete language 3-COLOR is decidable in poly-time, P=NP in this case.
Here are three questions concerning this problem:
We proved on HW#4 that ITERATED-PRODUCT is in the class L. In lecture we showed that L is contained in NL (since a log-space DTM is a special case of a log-space NDTM) and that NL is contained in AC1 (because the Savitch argument puts the NL-complete problem REACH in AC1. So ITERATED-PRODUCT is in AC1.
Let m be the length of the string w. Make a binary tree of depth log(m) =
O(log n), with m leaves. Each node of this tree will hold a partial product
of some elements of w. For example, the leaves will hold w1,
w2,..., wm. The next level will hold
w1w2, w3w4, the next level's nodes
will each hold a product of four elements of w, and so on until the root holds
the final product.
At each node we must determine the required element, which is the product
of the two elements at the node's children. We must thus build a circuit
fragment that takes two group elements (coded as numbers from 1 to n) and gives
their product. To do this we must use the multiplication table given in the
read-only input, looking up the correct single entry of the table.
With a circuit, this means that we must take an OR of g2
subcircuit,
where g is the size of the group. Each subcircuit returns the product of
x and y, if the child nodes' elements are x and y, or returns 0 otherwise.
The bitwise OR of these results thus gives us the product for the x and y
that are actually the contents of the child nodes.
Since each binary multiplication is correct, the circuit gets the right
answer for ITERATED-PRODUCT. Its size is polynomial because there are O(n)
nodes, each with O(n) subcircuits of size O(log n). Its depth is O(log n)
times the depth of the circuit at one node, and these circuits have depth
O(1) each if we allow unbounded fan-in. So the whole circuit meets the
conditions to put the problem in AC1.
The unbounded fan-in is used in the circuit of Problem 2-b only in taking the OR of g2 subcircuits in each node. But if g is only O(1), then g2 is also O(1) and the gates of fan-in O(1) may be replaced by O(1) gates of fan-in 2. Since the circuit still has depth O(log n) but now has fan-in two, the problem is now in NC1.
The machine receives G, V, x, and y in its read-only input. It initializes
a variable position1 to x and a variable position2 to y. It initializes
a variable moveCount to 0, and then enters a loop.
Inside the loop, it checks whether (position1, position2) is in the set
given by V and accepts if it does. Then if moveCount is even, player 1 names
a node number z. The machine checks whether (position1, z) is in G. If it
is, it changes position1 to z, if it isn't it rejects. If moveCount is odd,
player2 names a node number z. Then if (position2, z) is in G the machine
changes position2 to z, and if not it accepts. (Since player 2 has tried to
cheat, she loses and player 1 wins in this case.)
If moveCount reaches n before the machine accepts or rejects, it then
rejects (because player 1 wins in this case).
If either player has a winning strategy in the game as described above,
that player can choose a series of nodes in the alternating Turing machine
game, depending on her opponent's moves, that will guarantee that she wins.
The ATM game thus simulates the original game.
At any point of the game, the state is given by position1, position2, and
moveCount. Following the hint, we make a table Winner indexed by all
triples
(position1,position2,count) of two positions and a move count.
We first set Winner(x,y,n) to "player2" for all x and y. Then we set
Winner(x,y,i) to "player1" for all triples where (x,y) is in V and i < n.
Now we have to fill in the other entries in the table. Starting with
moveCount n-1 and working downward, we examine each position (x,y,i) that
is not yet filled. If i is even, we look at all triples (z,y,i+1) where
(x,z) is an edge in G. We set Winner(x,y,i) to "player1" if at least one
of these is labeled "player1" or to "player2" if all the successors are
labeled "player2". If i is odd, we set Winner(x,y,i) to "player2" if there
is a triple (x,z,i+1) labeled "player2" and (y,z) an edge in G.
Once we have filled in the entire table, our output is Winner(x,y,0) for
the particular x and y given by the input.
Input: undirected graph G
for all nodes v
{mark(v) = false;}
edgeSet = empty set;
while there is an edge (x,y) with mark(x) = mark(y) = false
{edgeSet = edgeSet union {(x,y)}
mark(x) = true;
mark(y) = true;
for all nodes z adjacent to either x or y
{mark(z) = true;}
}
return edgeSet;
Explain why this nondetermistic algorithm must produce a vertex cover. What is the approximation ratio of this algorithm for the MIN-VERTEX-COVER optimization problem? (It said "MAX-VERTEX-COVER" on the assignment, sorry.)
I'm afraid that I completely messed up this problem and I'll have to
withdraw it. The algorithm above produces a set of edges,
but a vertex cover is a set of vertices. It basically doesn't
have too much to do with the vertex cover problem at all!
Last modified 11 August 2003