Vertex Cover Problem (Vertex Cover) is described as follows: Given , where is an undirected graph, the question is whether there exists a set of vertices , , such that every vertex in covers all the edges in . That is, every edge in has at least one endpoint in . In the example below, is a set that satisfies this condition because each of the 4 edges in the graph is connected to at least one point in .
To prove its NP-completeness, we first prove that it is an NP problem. Given a and a , we only need to traverse each edge in and check if it is connected to a point in to determine the correctness of . Obviously, this process can be completed in polynomial time, so the Vertex Cover problem is an NP problem.
Next, to prove that it is an NP-hard problem, we reduce 3-SAT to the Vertex Cover problem. The form of 3-SAT is as follows:
Given a 3-SAT expression, we perform the following operations:
- Connect each of the three variables in each cluster.
- Connect inconsistent same variables in different clusters. Inconsistent means that if there are two different clusters with the same variable and , if is true, then is false; if is false, then is true.
In this way, we convert a 3-SAT boolean expression into a graph, where and is the number of clusters in the boolean expression. For example, if a 3-SAT boolean expression is:
Then, according to the above rules, the graph constructed for is:
Now, let's prove two statements:
(1) If a 3-SAT problem has a solution, then the converted graph also has a solution to the Vertex Cover problem. Since we have a solution to the 3-SAT problem, i.e., , then for each cluster in this 3-SAT, at least one variable is true. We take the other two variables in each cluster as members of the Vertex Cover problem , and in total we have members. Since each cluster in the graph forms a triangle, selecting two vertices from the three vertices of the triangle will definitely cover all the edges of the triangle. On the other hand, for each variable, it is connected to the same variable in a different cluster that is inconsistent with it. So as long as the 3-SAT problem has a solution, for each variable, regardless of its value, it will definitely be connected to the inconsistent same variable (for example, regardless of whether is true or false, it will be connected to ). Therefore, satisfies as long as the corresponding 3-SAT problem is satisfied.
(2) If a Vertex Cover problem has a solution, then the converted 3-SAT problem also has a solution. We can reverse the transformation of into a boolean expression using the above rules, and set the variables corresponding to the vertices in that do not belong to to true. Then the 3-SAT problem will be true.
In conclusion, we have reduced the 3-SAT problem to the Vertex Cover problem. Therefore, the Vertex Cover problem is NP-complete.