We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
NP Complete Graph Problems
Summary
We show that we can reduce from 3SAT to Independent Set, then from IS to Clique and Vertex Cover.
Contents
Independent Set
For an undirected graph G=(V,E), a subset of vertices S is an independent set if no edges are contained in S
- i.e
The challenge is to find the maximum IS
The Max IS problem is not known to be in NP since there’s no way to verify the max size in polynomial time.
Change input to include a goal g such that the size of S is at least g
IS in NP
Given input G,g and solution S, in time we can check all pairs , and in O(n) time check size of S is at least g.
Reduce 3SAT to IS
Consider 3SAT input f with variables and clauses , we’ll define a graph G and set g = m
For each clause , create vertices
There will be two types of edges
- Clause edges
- Variable edges
Clause
IS S has at most 1 vertex per clause. Since g=m, a 3SAT solution has exactly 1 vertex per clause.
We could take 1 vertex per sub-graph and create an assignment
This leads to
Since we have a contradiction, we need to create new edges from any
These new edges (yellow in above) are variable edges
Example
Corresponds to x = F, y = F, w = F, and z has no constraints
Correctness
f has a satisfying assignment G has an independent set of size at least g
Forward Claim
Consider a satisfying assignment for f.
For each clause c, take 1 of the satisfied literals
- add corresponding vertex to S
S has 1 vertex per clause and not both . This corresponds to not having any clause edges nor any variable edges, so S is an IS.
Reverse Claim
Take an independent set S of size at least g.
S has 1 vertex per clause
- set corresponding literal to True
- every clause is satisfied
No contradictory literals since we added edges
S is a valid assignment that satisfies every clause.
Clique
Clique
A fully connected subgraph
For a graph G=(V,E), a subset of vertices S is a clique if
Input: Undirected graph G and goal g
Output: where S is a clique of size at least g if it exists, NO otherwise
Clique in NP
Given input (G,g) and S
- , check that
- , trivially, down to
Reduce IS to Clique
Clique is opposite of IS.
Given an input for IS,
S is a clique in S is an IS in
Given an input for IS, be input to the clique problem.
If we get a solution S for clique, return S for IS. If we get NO, return NO.
Vertex Cover
For a graph G, a subset of vertices S is a vertex cover if every edge is touching at least one vertex in S.
Input: G and budget b
Output: Vertex cover S of size at most b, if one exists, NO otherwise
VC in NP
Given input (G,b) and solution S,
- , check x and/or y are in S
- O(n + m)
- Check that S is at most size of b
- O(n)
Reduce IS to VC
Claim: is a VC is an IS
Forward Claim
Take vertex cover S
is an IS
Reverse Claim
Take an IS
S covers every edge