

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















To prove that a problem Π is NP -complete we now just have to perform two steps:
Thousands of problems have now been shown to be NP -complete (for an early survey see Garey and Johnson). Note: If we can complete Step 2 but not Step 1, then we say that Π is NP -hard
The problem CLIQUE is in NP (the list of vertices in the clique is the certificate) To show that CLIQUE is NP -complete we shall reduce SATISFIABILITY to CLIQUE Given a formula f with clauses C 1 , C 2 ,... , Ck — For each literal x in clause Cj create a vertex — Put an edge between every pair of vertices from distinct clauses, unless they are incompatible (i.e. x and ¬x) This construction can be carried out in polynomial time The resulting graph has a clique of size k if and only if f is satisfiable (assign the value TRUE to every literal occurring in the clique)
Instance : A graph G = (V , E), and a natural number k. Question: Is there a set W ⊆ V , with |W | ≤ k, such that for each edge (i, j) ∈ E, {i, j} ∩ W 6 = ∅
The problem VERTEX COVER is in NP (the list of vertices in the clique is the certificate)
To show that VERTEX COVER is NP -complete we shall reduce SATISFIABILITY to VERTEX COVER
Given a formula f with clauses C 1 , C 2 ,... , Cm For each variable x create two adjacent vertices xf^ and xt to represent the literals x and ¬x For each clause Cj of size nj create a complete subgraph Gj with vertices connected to corresponding literals Set k = n + ∑mj= 1 (nj − 1 ) This construction can be carried out in polynomial time
At least one of each pair (xf^ , xt^ ) must be in the cover At least nj − 1 vertices from each complete graph Gj must be in the cover If the formula is satisfiable, then choose the cover by choosing each literal assigned TRUE plus all but one vertex in each Gj. (Omit a vertex which is connected to a satisfied literal.) Conversely, if a vertex cover exists, assign each Boolean variable according to whether xt^ (TRUE ) or xf^ (FALSE ) is in M. (By the choice of k, there must be one vertex in each clique which is not in M. This vertex must be adjacent to a vertex in M, hence the clause is satisfied.)
At least one of each pair (xf^ , xt^ ) must be in the cover At least nj − 1 vertices from each complete graph Gj must be in the cover If the formula is satisfiable, then choose the cover by choosing each literal assigned TRUE plus all but one vertex in each Gj. (Omit a vertex which is connected to a satisfied literal.) Conversely, if a vertex cover exists, assign each Boolean variable according to whether xt^ (TRUE ) or xf^ (FALSE ) is in M. (By the choice of k, there must be one vertex in each clique which is not in M. This vertex must be adjacent to a vertex in M, hence the clause is satisfied.)
At least one of each pair (xf^ , xt^ ) must be in the cover At least nj − 1 vertices from each complete graph Gj must be in the cover If the formula is satisfiable, then choose the cover by choosing each literal assigned TRUE plus all but one vertex in each Gj. (Omit a vertex which is connected to a satisfied literal.) Conversely, if a vertex cover exists, assign each Boolean variable according to whether xt^ (TRUE ) or xf^ (FALSE ) is in M. (By the choice of k, there must be one vertex in each clique which is not in M. This vertex must be adjacent to a vertex in M, hence the clause is satisfied.)
Instance : Collection C of subsets of a set V and a positive integer K. Question: Does S contain a hitting set for C of size K or less, that is, a subset S′^ ⊆ S with |S′| ≤ K such that S′^ contains at least one element form each subset from C?
HITTING SET is in NP (the subset S′^ is the certificate) To show that HITTING SET is NP -complete, restrict it to instances with |c| = 2 for all c ∈ C. What problem do you get then?
To show that 3-SATISFIABILITY is NP -complete we reduce SATISFIABILITY to 3-SATISFIABILITY Replace every clause
C = x 1 ∨ x 2 ∨... ∨ xk
with k > 3 by
C′^ = (x 1 ∨ x 2 ∨ y 1 ) ∧ (¬y 1 ∨ x 3 ∨ y 2 ) ∧... ∧ (¬yk− 3 ∨ xk− 1 ∨ xk )
C is satisfiable iff C′^ is, since at least one of the literals other than the ys must be TRUE.
Given a formula f with clauses C 1 , C 2 ,... , Ck For each variable x create 2 integers nxt and nxf For each clause Cj of length lj , create lj − 1 integers mj 1 , mj 2 ,... Choose t so that T must contain exactly one of each n pair and at least one from each clause This construction can be carried out in polynomial time