Presentation on theme: "Clique Cover Cook’s Theorem 3SAT and Independent Set"— Presentation transcript:
1 Clique Cover Cook’s Theorem 3SAT and Independent Set These slides are based on the Lecture Notes by David Mount for the course CMSC 451 at the University of Maryland. The Copyright notice is as follows:Copyright, David M. Mount, 2008 Dept. of Computer Science, University of Maryland, College Park, MD, These lecture notes were prepared by David Mount for the course CMSC 451, Design and Analysis of Computer Algorithms, at the University of Maryland. Permission to use, copy, modify, and distribute these notes for educational purposes and without fee is hereby granted, provided that this copyright notice appear in all copies.
2 3-Colorability Well known to be NP-complete Given a graph G, can each of its vertices be labeled with one of 3 different colors, such that no two adjacent vertices have the same label.Arises in partitioning problems,Where two objects cannot be assigned to the same set of partitions.
3 3-Colorability Planar graphs can be colored with 4 colors Polynomial algorithmDetermining whether 3 colors are possible is “hard”No known polynomial algorithm for 3 colors.
5 CliqueGiven a graph G= (V,E) we say that a subset of vertices V' forms a clique if for every pair of vertices u, v in V', the edge (u,v) is in E.A subgraph induced by V' is a complete graph.
6 Clique Cover (CCov) problem Given a graph G = (V, E) and an integer k, can we partition the vertex set into k subsets of vertices V1, V2, V3,..., Vk such that each Vi is a clique of G andArises in applications of clusteringPut an edge between two nodes if they are similar enough to be clustered in the same group.Is it possible to cluster all the vertices in k groups?
8 How to prove CCov NP-complete? Assume that you have access to a subroutine CCov(G,k) returns true if G has a CCov of size k.Try to write a polynomial-time subroutine for 3Col(G) which is allowed to call CCov(G,k)Reduce G to (G’, k) in polynomial timeCall the subroutine for CCov(G’,k)3Col(G) if and only if CCov(G’,k)
9 3Col and CCov: what is similar? Both 3Col and CCov involve partitioning vertices into groupsCCov: into k groups3Col: into 3 color groupsFor two vertices u and v to be in the same groupIn CCov: u and v has to be adjacentIn 3Col: u and v should NOT be adjacent
10 Reduction: 3Col to CCovGiven graph G for which we want to determine 3-colorability (G is an instance of 3Col)Produce G' which is a complement of GG' is a graph on the same vertex set, but (u,v) is an edge of G' if and only if it is not an edge of GCall Ccov(G', 3)(G',3) is an instance of CCov
11 3-ColorableG’: Coverable by 3-cliquesG: 3-colorable
12 Recall: To prove a problem Q to be NP- complete, we pick a known NP-complete problem P, and show P is polynomial-time reducible to Q.We need at least one known NP-complete problem to start the ball rolling!
13 Boolean Satisfiability Theorem SAT (Boolean Satisfiability Theorem): Given a boolean formula, is there some way to assign truth values (0/1, false/true) to variables of the formula, such that the formula evaluates to true (1).A boolean formula is a logical formula which consists of variables xi and the logical operators, negation ( x ), boolean-or (x V y) and boolean-and (x Λ y)E.g.is satisfiable (evaluates to true) if x1=1, x2=0 and x3=0
14 Cook’s Theorem Cook’s Theorem: SAT is NP-complete Complicated proof Requires background infor on Turing machinesWe will not cover
15 3SAT3SAT: A restricted version of SAT which is the problem of determining whether a formula in 3-CNF is satisfiable3-CNF (3-conjunctive normal form): boolean-and of clauses where each clause is the boolean-or of exactly 3 literalsA literal is a variable or its negationE.g.
16 3SATProof of Cook’s theorem can be modified to prove that 3SAT is also NP-complete.
17 Independent Set (IS)Now that we know 3SAT is NP-complete, we can use it to prove other problems are NP- completeIndependent Set (IS): Given an undirected graph G=(V,E) and an integer k, does G contain a subset V’ of k vertices such that no two vertices in V’ are adjacent to one another.
19 Is IS NP-complete? Is IS in NP? Certificate consists of k vertices in V’Verify for each pair of vertices, u,v that there is no edge between themVerifiable in polynomial time
20 Is IS NP-complete? Is IS NP-hard? Show that some known NP-complete problem (3SAT) is reducible to IS in polynomial time.3SATyesF(G,k)ReductionISnoF: boolean formula in 3-CNF
21 3SAT IS What is to be selected? Requirements: Restrictions: 3SAT: which variables are assigned trueIS: which vertices are to be placed in V’Requirements:3SAT: Each clause must contain at least one literal whose value is trueV’ must contain at least k verticesRestrictions:3SAT: If x is assigned true then x must be false and vice versa.IS: If u is selected to be in V’, then vertices adjacent to u cannot be in V’
22 3SAT IS Given F (3-CNF), create G and set k Create one vertex in G for each literal that appears in FThe vertices are grouped into clause clusters.Assigning true to a literal from some clause corresponds to selecting a vertex to place in V’Set k to be the number of clausesForces IS to pick one vertex from each clause—thus one literal from each clause is trueconnect all vertices in the same clause cluster to each other to avoid IS selecting two literals from the same clausePut an edge between each literal and its negationTo avoid IS placing both in V’ (to avoid assigning true to both)
23 Create one vertex in G for each literal that appears in F
24 connect all vertices in the same clause cluster to each other
25 Put an edge between each literal and its negation
26 Put an edge between each literal and its negation
27 Put an edge between each literal and its negation k = 4