Soptq

Soptq

Probably a full-stack, mainly focusing on Distributed System / Consensus / Privacy-preserving Tech etc. Decentralization is a trend, privacy must be protected.
twitter
github
bilibili

Vertex Cover Problem NP-Complete Proof

Vertex Cover Problem (Vertex Cover) is described as follows: Given <G,k><G,k>, where GG is an undirected graph, the question is whether there exists a set of vertices VV, V<=k\lvert V \rvert <= k, such that every vertex in VV covers all the edges in GG. That is, every edge in GG has at least one endpoint in VV. In the example below, <A,B><A,B> is a set that satisfies this condition because each of the 4 edges in the graph is connected to at least one point in <A,B><A,B>.

To prove its NP-completeness, we first prove that it is an NP problem. Given a GG and a VV, we only need to traverse each edge in GG and check if it is connected to a point in VV to determine the correctness of VV. 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:

{C=C1C2CnCi=xaixbixci\begin{cases} C = C_1 \cap C_2 \cap \cdots \cap C_n \\ C_i = x_a^i \cup x_b^i \cup x_c^i \end{cases}

Given a 3-SAT expression, we perform the following operations:

  1. Connect each of the three variables in each cluster.
  2. Connect inconsistent same variables in different clusters. Inconsistent means that if there are two different clusters with the same variable xaix_a^i and xajx_a^j, if xaix_a^i is true, then xajx_a^j is false; if xaix_a^i is false, then xajx_a^j is true.

In this way, we convert a 3-SAT boolean expression into a graph, where k=2nk = 2n and nn is the number of clusters in the boolean expression. For example, if a 3-SAT boolean expression is:

C=(x+y+z)(x+y+z)(x+y+z)(x+y+z)C=(x+y+z) \cdot (\overline{x}+\overline{y}+\overline{z}) \cdot (x+\overline{y}+z) \cdot (\overline{x}+y+\overline{z})

Then, according to the above rules, the graph constructed for C1C_1 is:

Now, let's prove two statements:

(1) If a 3-SAT problem has a solution, then the converted graph GG also has a solution to the Vertex Cover problem. Since we have a solution to the 3-SAT problem, i.e., C=1C = 1, 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 VV, and in total we have 2n2n 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 xx is true or false, it will be connected to x\overline{x}). Therefore, GG satisfies k=2nk = 2n as long as the corresponding 3-SAT problem is satisfied.

(2) If a Vertex Cover problem <G,k><G, k> has a solution, then the converted 3-SAT problem also has a solution. We can reverse the transformation of <G,k><G,k> into a boolean expression using the above rules, and set the variables corresponding to the vertices in GG that do not belong to VV 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.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.