Now it needs to check which class of problems the Color Graph problem lies in. If it lies in then the problem will also be in as the class of problems is reducible in polynomial time to it.
The verifier for the h Color Graph problem will take the colors assigned to the vertices as the certificate.
The algorithm for the verifier will be:
= "On input
1. Test if all the colors are valid.
2. If no, reject.
3. For each vertex
Check if all adjacent vertices are colored differently.
4. If yes, accept; else reject.
The verifier takes polynomial time so the Color Graph problem is in . Following which, problems have to be shown to be polynomial time reducible to the Color Graph problem. The problem is reduced to the Color Graph problem.
An instance of the problem will haveclauses with each clause containing variables. The variable gadget will be the vertices of the graph labeled with the variables and the clause gadget will be the vertices (and their edges) added corresponding to them.
An instance of the Color Graph problem is constructed by adding all the variables and their complementsas vertices of the graph.
All the variable vertices are connected to their complements by an edge. Label the pair formed by a variable vertex and its complement as true for the variable and false for the complement.
Next, add a new set of vertices to the graph in the form of a clique (by joining each new vertex with all the other new vertices). Color these vertices with colors .
Also connect each with and except for the case when . Color one of or with the same color as the corresponding . This can be done with h+1 colors.
Thus, the Color Graph problem has been proven to be .
Consequently the problem is also in .