11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

550 Chap. 17 Limits to Comput<strong>at</strong>ionExample 17.2 In this example, we make use of a simple conversion betweentwo graph problems.Theorem 17.2 VERTEX COVER is N P-complete.Proof: Prove th<strong>at</strong> VERTEX COVER is in N P: Simply guess a subsetof the graph <strong>and</strong> determine in polynomial time whether th<strong>at</strong> subset is in facta vertex cover of size k or less.Prove th<strong>at</strong> VERTEX COVER is N P-hard: We will assume th<strong>at</strong> K-CLIQUE is already known to be N P-complete. (We will see this proof inthe next example. For now, just accept th<strong>at</strong> it is true.)Given th<strong>at</strong> K-CLIQUE is N P-complete, we need to find a polynomialtimetransform<strong>at</strong>ion from the input to K-CLIQUE to the input to VERTEXCOVER, <strong>and</strong> another polynomial-time transform<strong>at</strong>ion from the output forVERTEX COVER to the output for K-CLIQUE. This turns out to be asimple m<strong>at</strong>ter, given the following observ<strong>at</strong>ion. Consider a graph G <strong>and</strong>a vertex cover S on G. Denote by S ′ the set of vertices in G but not in S.There can be no edge connecting any two vertices in S ′ because, if therewere, then S would not be a vertex cover. Denote by G ′ the inverse graphfor G, th<strong>at</strong> is, the graph formed from the edges not in G. If S is of sizek, then S ′ forms a clique of size n − k in graph G ′ . Thus, we can reduceK-CLIQUE to VERTEX COVER simply by converting graph G to G ′ , <strong>and</strong>asking if G ′ has a VERTEX COVER of size n − k or smaller. If YES, thenthere is a clique in G of size k; if NO then there is not.✷Example 17.3 So far, our N P-completeness proofs have involved transform<strong>at</strong>ionsbetween inputs of the same “type,” such as from a Boolean expressionto a Boolean expression or from a graph to a graph. Sometimes anN P-completeness proof involves a transform<strong>at</strong>ion between types of inputs,as shown next.Theorem 17.3 K-CLIQUE is N P-complete.Proof: K-CLIQUE is in N P, because we can just guess a collection of kvertices <strong>and</strong> test in polynomial time if it is a clique. Now we show th<strong>at</strong> K-CLIQUE is N P-hard by using a reduction from SAT. An instance of SATis a Boolean expressionB = C 1 · C 2 · ... · C mwhose clauses we will describe by the not<strong>at</strong>ionC i = y[i, 1] + y[i, 2] + ... + y[i, k i ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!