NPC proof

advertisement
NPC proof
Clique Problem
Instance: Given an undirected graph G = (V, E) and an integer K > 1
Question: Does G contain a clique with K or more vertices?
Vertex Cover Problem
Instance: Given an undirected graph G = (V, E) and integer K ≤ |V|
Question: Is there a subset V'  V such that |V'|  K and for each edge
in E at least one endpoint belongs to V'?
Proof:
First, we show that the vertex cover problem is in NP. Suppose that graph G and integer K are
given, and let V'  V. To prove that vertex cover is in NP we must verify if V' is a vertex cover.
First check to see of |V'| ≤ K, and then check for each edge (u, v)  E whether u  V' or v  V'.
Since the number of edges is at most O(n2), this verification can be done in polynomial time.
Reduction of the clique problem to vertex cover
Constructing an instance of vertex cover from an instance of clique.
Let G' = (V, E') denote the complement of G.
G' has the same vertex set as G, but for vertices x and y, (x, y)  E' iff (x, y)  E. Given an
instance of the clique problem, a graph G and integer K, we first find the complement G'. This is
easily done in polynomial time. The output of the reduction is the instance of vertex cover
consisting of graph G' and the integer |V| - K. To complete the proof we must show that G has a
clique of size K iff G' has a vertex cover of size |V| - K.
Suppose V'  V is a clique in G and that |V'| = K. In G', consider the set V – V'. Let (u, v)  E'.
Then (u, v)  E which implies at least one of the vertices u or v does not belong to V' since every
pair of vertices in V' is connected by an edge in E. This means that at least one of u, v is in V – V'.
Since (u, v) was an arbitrary edge in E',
V – V' is a vertex cover of G' of size |V| - K.
Conversely, suppose G' has a vertex cover W'  V where
|W'| = |V| - K. Then, for all u, v  V, if (u, v)  E', then u  W' or
v  W' or both. This implies that for all x, y  V if neither x nor y is in W' then (x, y)  E. In other
words, V – W' is a clique in G.
Download