Lecture 25
More NP-completeness
CSE 421 Autumn 2025
1
Previously…
2
-completeness
Definition: A problem is -complete if �(a) �(b) For every problem , it holds that
3
Condition (b) on its own is known as “-hardness”.
There is a poly-time reduction that maps “yes” to “yes”, and “no” to “no”.
The “first” -complete problem
Satisfiability
Theorem: Satisfiability is -complete.
4
Input: , the description of a polynomial-time algorithm and integer in unary.
Output: Whether there exists a such that and .
Proof: Two lectures ago.
3-SAT is NP-complete
5
Theorem: 3-SAT is -complete.
Input: A 3-CNF formula .
Output: “yes” if there exists a such that . “No” otherwise.
e.g.
Proof: Last lecture.
Today
6
Vertex Cover is -complete
Our task: given an instance of 3-SAT, find a way to map it to a vertex cover instance in a way that preserves “yes” and “no” instances.
Vertex Cover (decision version): On input a graph and an integer , decide if there exists a vertex cover of size (that is, a subset of vertices of size that touches every edge).
Vertex Cover is -complete
The construction:
Our task: given an instance of 3-SAT, find a way to map it to a vertex cover instance in a way that preserves “yes” and “no” instances.
Vertex Cover is -complete
The construction:
Our task: given an instance of 3-SAT, find a way to map it to a vertex cover instance in a way that preserves “yes” and “no” instances.
Assume without loss of generality that each clause has exactly 3 literals (can always duplicate a literal without changing whether is “yes” or “no” instance)
Vertex Cover is -complete
10
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
11
If it’s , then it’s by the previous slide
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
12
If it’s , then it’s by the previous slide
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
13
If it’s , then it’s by the previous slide
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
14
If it’s , then it’s by the previous slide
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
15
Equivalent to proving “no” “no”
If it’s , then it’s by the previous slide
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
16
Equivalent to proving “no” “no”
If it’s , then it’s by the previous slide
Vertex Cover is -complete
Theorem: is satisfiable iff has a vertex cover of size.
Proof:
17
Equivalent to proving “no” “no”
If it’s , then it’s by the previous slide
3-coloring is -complete
18
Input: a graph . �Output: whether there exists an assignment such that for every edge .
3-coloring is -complete
19
Goal: Map a 3-SAT formula to a graph that preserves “yes” and “no” instances
The approach:
We will develop two “gadgets”:
Let’s start by creating, for each variable , vertices labelled and
We will eventually interpret a vertex being Green as the corresponding literal being set to true.
3-coloring is -complete
20
The 1st “gadget”
3-coloring is -complete
21
The 1st “gadget”
3-coloring is -complete
22
The 1st “gadget”
3-coloring is -complete
23
The 1st “gadget”
3-coloring is -complete
The 2nd “gadget”
3-coloring is -complete
The 2nd “gadget”
25
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
Totally unclear if such a graph exists..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
The 2nd “gadget”
26
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
The same vertex T as before
The same vertex F as before
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
27
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
Recall that every literal must be colored Red or Green by the 1st gadget!�(not pictured here, but �are involved in the 1st gadget)�
3-coloring is -complete
28
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
29
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
30
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
31
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
32
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
33
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
34
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
35
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
36
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
37
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, T, F, and possibly more�auxiliary vertices that we create
3-coloring is -complete
38
The 2nd “gadget”
The same vertex T as before
The same vertex F as before
We now construct a “gadget” that maps a clause to a graph such that:�it can be colored (validly) iff at least one of vertices is colored Green.��
It turns out that this tricky little graph does the job..
The graph includes the vertices�, , , and possibly more�auxiliary vertices that we create
3-coloring is -complete
Full construction:
39
Putting it all together
3-coloring is -complete
Putting it all together
Proof that the reduction works:
40