Title: NP-completeness
1NP-completeness
2P
The class of problems that can be solved in
polynomial time.
e.g. gcd, shortest path, prime, etc.
There are many problems that we dont know how to
solve in polynomial time.
e.g. factoring, polynomial identities, graph
colouring, etc.
3NP-completeness
4NP-completeness
5NP-completeness
6Polynomial Time Reduction
How to show that a problem R is not easier than a
problem Q?
Informally, if R can be solved efficiently, we
can solve Q efficiently.
- Formally, we say Q polynomially reduces to R if
- Given an instance q of problem Q
- There is a polynomial time transformation to an
instance f(q) of R - q is a yes instance if and only if f(q) is a
yes instance
Then, if R is polynomial time solvable, then Q is
polynomial time solvable.
If Q is not polynomial time solvable, then R is
not polynomial time solvable.
7First Example
Clique a subset of vertices S so that for every
two vertices u,v in S are joined by
an edge.
Instance A graph G(V,E) and a positive
integer k. Question Is there a clique of size
k or more for G?
Independent set a subset of vertices S so that
for every two
vertices u,v in S are joined by an edge.
Instance A graph G(V,E) and a positive
integer k. Question Is there an independent
of size k or more for G?
8First Example
Instance A set X and a size s(x) for each x
in X. Question Is there a subset X X
such that
PARTITION
SUBSET-SUM
Instance A set X and a size s(x) for each x
in X, and an integer B. Question Is there a
subset X X such that
9First Example
HAMILTONIAN CYCLE
Instance A graph G(V,E). Question Does
G contains a Hamiltonian cycle,
i.e. a cycle which visits every vertex exactly
once?
HAMILTONIAN PATH
Instance A graph G(V,E). Question Does
G contains a Hamiltonian path,
i.e. a path which visits every vertex exactly
once?
10NP
NP (Non-deterministic polynomial time) A class
of decision problems whose solutions can be
verified in polynomial time. For each yes
instance, there is a proof that can be checked in
polynomial time.
- Two equivalent definitions
- Given a solution, we can check in polynomial
time whether it is correct. - There is a non-deterministic algorithm (a magic
algorithm) that can - guess the solution and check if it is
correct in polynomial time.
P is the class of problems that we can find a
solution in polynomial time.
11Cooks Theorem
Satisfiability (SAT)
Instance A set of boolean variables and a
set of clauses. Question Is there a truth
assignment that satisfies all the clauses?
(Cook 1970) If one can solve satisfiability in
polynomial time, then one can solve all problems
in NP in polynomial time.
12NP-completeness
A problem Q is NP-complete if Q is in NP, and
if Q can be solved in polynomial time gt every
problem in NP can be solved in polynomial time.
Then Q is the hardest problem in NP.
Cooks theorem (1970) SAT is NP-complete.
- To show a problem Q is NP-complete
- show that Q is in NP
- show that an NPc problem lt Q
133-SAT
Instance Collection C c1, c2, , cm of
clauses on a set U of variables
such that ci 3 for all 1 lt i lt
m. Question Is there a truth assignment for
U that satisfies all the clauses in C?
SAT lt 3SAT
14Vertex Cover
Vertex cover a subset of vertices S so that for
every edge (u,v), at
least one of u and v belongs to S.
Instance A graph G(V,E) and a positive
integer k. Question Is there a vertex cover
of size k or less for G?
3SAT lt VERTEX COVER
15Clique
Clique a subset of vertices S so that for every
two vertices u,v in S are joined by
an edge.
Instance A graph G(V,E) and a positive
integer k. Question Is there a clique of size
k or more for G?
VERTEX COVER lt CLIQUE
163D Matching
Instance A set M W x X x Y, where W, X,
and Y are disjoint sets
having the same number q of elements. Question
Does M contains a matching, a subset M M
such that Mq and no two
elements of M agree in any coordinate?
3SAT lt 3DM
17Partition
Instance A set X and a size s(x) for each x
in X. Question Is there a subset X X
such that
3DM lt PARTITION
18Hamiltonia Cycle
Instance A graph G(V,E). Question
Does G contains a Hamiltonian cycle,
i.e. a cycle which visits every vertex
exactly once?
VERTEX COVER lt HAMILTONIAN CYCLE
19Techniques
- Restriction
- Show that a special case is already NP-complete.
- Local replacement
- Replace each basic unit by a different structure.
- Component design
- Design components with specific
functionality.
20Minimum Cover
Instance Collection C of subsets of a set S,
and a positive integer k. Question Does C
contains a cover for S of size k or less, that
is, a subset C C with
C lt k and ?
3DM lt Minimum Cover
21Subgraph Isomorphism
Two graphs G1 (V1,E1) and G2 (V2,E2) are
isomorphic if
? bijection f V1 ? V2 u v in E1 iff f (u)f
(v) in E2
Instance Two graphs G (V1,E1) and H
(V2,E2). Question Does G contain a subgraph
isomorphic to H?
Clique lt Subgraph Isomorphism
22Bounded Degree Spanning Tree
A spanning tree is a connected subgraph with
V-1 edges.
Instance A graph G(V,E) and a positive
integer k. Question Is there a spanning tree
for G in which no vertex has degree gt k?
Hamiltonian path lt Bounded degree spanning tree
23Partition into Triangles
Instance A graph G(V,E) with V3q
vertices. Question Is there a partition of V
into q disjoint sets V1, V2, , Vq
of three vertices so that each Vi is a
triangle?
3DM lt Partition into Triangles
24Sequencing within Intervals
Instance A set T of jobs, each has a release
time r(t), a deadline d(t)
and a length l(t). Question Does there exist
a feasible schedule for T?
Partition lt Sequencing within Intervals
25Open Problems
Graph Isomorphism
Instance Two graphs G (V1,E1) and H
(V2,E2). Question Is G isomorphic to H?
Composite Number
Instance Given a number k. Question Is k
p x q for p gt 1 and q gt 1?
26Conclusion
Why people believe that P NP?
I can appreciate good music (being able to verify
solutions) doesnt mean that I can compose good
music (to find solutions).
(from wikipedia) "Proof by contradiction. Assume
P NP. Let y be a proof that P NP. The proof y
can be verified in polynomial time by a competent
computer scientist, the existence of which we
assert. However, since P NP, the proof y can be
generated in polynomial time by such computer
scientists. Since this generation has not yet
occurred (despite attempts by such computer
scientists to produce a proof), we have a
contradiction."
http//www.claymath.org/millennium/P_vs_NP/