# CMPSCI 611: Theory of Algorithms

### Questions and Answers on Homework #4

Questions are in black, answers in blue.

• Question 4.9, 20 November 2005: For 4.3c, can we have a clique on a graph that contains edges from a vertex to itself? My reduction from the problem of determining whether (G,k,b) is in C is to the problem of determining if a corresponding tuple (G',k') is in A, but in my reduction G' may have loops. Is this reduction acceptable?

Well, no, because A is a set of tuples that contain undirected graphs, and undirected graphs have no loops. But if I understand you correctly, why don't you just take your G' and make a G'' by just deleting the loops? Then G'' would have a clique of size k' iff G' does, and the reduction from (G,k.b) to (G'',k') would be a valid reduction from C to A.

• Question 4.8, 18 November 2005: It seems that in Problems 4.3c and 4.3d, we need to specify a format for the partial witnesses. Don't I need to know how a string y forms part of a witness yz, in each particular situation?

The idea here is that if the witness must be a string of a particular length, then I completely specify the partial witnesses by saying that y, as a string, must be a prefix of the witness string yz. That is, there must be a binary string z such that the concatenation of y and z is a witness string.

Perhaps an example will make this clearer. Suppose that A is the CLIQUE problem, so that B is the set of tuples (G,k,w) such that G is a graph with n vertices and w is a string of length n, with exactly k ones, specifying the vertices in a clique of G. For example, let n=6 and k=3, and suppose that {x1, x4, x6} is a clique in G. Then the witness vector for this clique would be 100101, making the partial witness vectore for this clique the empty string, 1, 10, 100, 1001, 10010, and 100101 itself.

You are right that the format of witnesses must be specified exactly before the problem makes sense. But once witnesses are specified as strings of a particular length, the notions of concatenation and prefix on strings make it completely clear what a "partial witness" is.

• Question 4.7, 16 November 2005: For Problem 4.1, I have found a reference to a method to convert a straight-line program to an equivalent CNF formula in what I think is poly-time. Could I solve 4.1 by using this to get CNF, then using the algorithm in lecture to go from CNF to 3-CNF? If so, can I just cite this source to do the first part or must I re-invent the wheel?

The problem here is that a problem with a short straight-line program could have an equivalent CNF that is exponential in length. (So your cited algorithm could not possibly be poly-time in the input -- maybe it is poly-time in the size of the CNF result.) You need a different approach that doesn't rely on an equivalent formula, just one that is satisfiable iff the original one is.

• Question 4.6, 16 November 2005: In Problem 4.1, you define circuit-SAT in terms of straight-line programs. But in other books there are alternative definitions, based on a logic gate model that seems equivalent.

May I use one of these other models to solve the problem, does it depend somehow on the straight-line model as you have defined it?

Yes, you may use the other model if it is clear what you are doing, as you say the models are entirely equivalent.

• Question 4.5, 16 November 2005: In Problem 4.1, after showing that 3-SAT is in NP, I need to find a function that takes a circuit-SAT instance and creates a 3-SAT instance that is satisfiable iff the circuit-SAT instance is satisfiable. Right so far?

Yes, exactly.

Is it helpful to think of the 3-SAT instances as being in CNF?

Yes, that's the only way to think of them, since 3-SAT is defined to be the set of satisfiable 3-CNF formulas, and 3-CNF is just CNF where there are at most three literals per clause.

• Question 4.4, 15 November 2005: In lecture notes 16 and 17, NP-hardness of X is defined in terms of a Cook reduction from X to some NP-complete problem B. Don't you mean a Cook reduction from B to X? You say that you want a poly-time algorithm to decide B with access to a hypothetical poly-time algorithm for X, isn;t this reducing B to X?

You're right, I describe the algorithm correctly but I call it a reduction from X to B when as you say it is a reduction from B to X.

• Question 4.3, 15 November 2005: I am confused about Problems 4.3(c) and 4.3(d). In (c), you ask us to show that C is Karp-reducible to B. But since A is clearly Karp-reducible to C (just ask C if the empty string is the prefix of a witness), this would imply that A, the NP-complete problem CLIQUE, is Karp-reducible to B and thus is in P. Should I be talking to the Clay Mathematics Institute if I solve this problem?

You're right, this is a mistake. I meant "Karp-reducible to A" every time I wrote "Karp-reducible to B" -- I've now corrected this.

• Question 4.2, 14 November 2005: I have a question concerning the definition of a multigraph cut in Problem 4.2. Does a cut always contain all the edges between two vertices, or could it also contain just a few of them (e.g., all edges but one, so that those two vertices remain connected. For example, consider a multigraph with vertex set {a,b,c}, two edges between a and b, and three edges between b and c. What is the size of the maximum cut in this multigraph?

Remember the definition of a cut -- it is a partition of the vertices into two sets A and B, and an edge crosses the cut if one of its endpoints is in A and the other in B. So all the edges from one vertex to another cross the cut if the two vertices are in different sets.

In your example, the maximum cut puts b in one set and both a and c in the other, cutting all five edges.

• Question 4.1, 13 November 2005: Am I completely missing something, or will a solution to 4.3(b) also be a valid solution to 4.3(a)? They are pretty much asking the same thing, except that (a) requires any y, whereas (b) requires the lexicographically first such y.

Yes, you're right -- since (b) requires a valid y iff one exists, it also solves the search problem of (a). So if you have a correct solution for (b), you may just quote it to solve (a) as long as it is clear what you are talking about.