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.

Sec. 17.2 Hard Problems 551x 1x 1x 1x2x 2x 3x 3C 1C 3C 2Figure 17.6 The graph gener<strong>at</strong>ed from Boolean expression B = (x 1 +x 2 )·(x 1 +x 2 +x 3 )·(x 1 +x 3 ). Literals from the first clause are labeled C1, <strong>and</strong> literals fromthe second clause are labeled C2. There is an edge between every pair of verticesexcept when both vertices represent instances of literals from the same clause, ora neg<strong>at</strong>ion of the same variable. Thus, the vertex labeled C1:y 1 does not connectto the vertex labeled C1 : y 2 (because they are literals in the same clause) or thevertex labeled C2:y 1 (because they are opposite values for the same variable).where k i is the number of literals in Clause c i . We will transform this to aninstance of K-CLIQUE as follows. We build a graphG = {v[i, j]|1 ≤ i ≤ m, 1 ≤ j ≤ k i },th<strong>at</strong> is, there is a vertex in G corresponding to every literal in Booleanexpression B. We will draw an edge between each pair of vertices v[i 1 , j 1 ]<strong>and</strong> v[i 2 , j 2 ] unless (1) they are two literals within the same clause (i 1 = i 2 )or (2) they are opposite values for the same variable (i.e., one is neg<strong>at</strong>ed<strong>and</strong> the other is not). Set k = m. Figure 17.6 shows an example of thistransform<strong>at</strong>ion.B is s<strong>at</strong>isfiable if <strong>and</strong> only if G has a clique of size k or gre<strong>at</strong>er. B beings<strong>at</strong>isfiable implies th<strong>at</strong> there is a truth assignment such th<strong>at</strong> <strong>at</strong> least oneliteral y[i, j i ] is true for each i. If so, then these m literals must correspondto m vertices in a clique of size k = m. Conversely, if G has a clique ofsize k or gre<strong>at</strong>er, then the clique must have size exactly k (because no twovertices corresponding to literals in the same clause can be in the clique)<strong>and</strong> there is one vertex v[i, j i ] in the clique for each i. There is a truthassignment making each y[i, j i ] true. Th<strong>at</strong> truth assignment s<strong>at</strong>isfies B.We conclude th<strong>at</strong> K-CLIQUE is N P-hard, therefore N P-complete. ✷

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

Saved successfully!

Ooh no, something went wrong!