Title: NPcomplete Problem 2
1NP-complete Problem 2
Lecture 25
- Prof. S M Lee
- Department of Computer Science
2(No Transcript)
3(No Transcript)
4Encodings An encoding "e" is a mapping from a
set S to binary strings Use encodings to map
abstract problems to concrete problems
Example - Shortest Path0101001010100101011011000
10101001010
5(No Transcript)
6(No Transcript)
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15(No Transcript)
16Hamiltonian cycle of an undirected graph G (V,
E) is a simple cycle that contains each vertex in
VA hamiltonian graph is a graph that has a
hamiltonian cycle.Let m V, it takes m!
operations to determine if G (V, E) is a
hamiltonian graph If Mary claims a graph is
hamiltonian graph and provides the vertices in
order on the hamiltonian cycle then we can verify
her claim in polynomial timeThe potential cycle
is called the certificate.
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21Why Are We Studying NP-complete Problems?
R
- Because we want to know what problems can be
solved by computers
22(No Transcript)
23(No Transcript)
24Polynomial Reductions
- NP-complete problems are known as decision
problems. This means that a specific item of
input data is accepted and depending on the
specific problem, it is required to determine if
the instance does have the property, then the
answer yes is returned if not, then the answer
no is returned
25Polynomial Reduction
- Reduction of a problem P to a problem Q problem
qs answer for t(x) must be the same as ps
answer for x
x
T
Algorithm for Q
T(x)
Yes or No answer
(an input for p)
An input for Q
26(No Transcript)
27(No Transcript)
28(No Transcript)
29A Simple Reduction
- Let the problem P be given a sequence of boolean
values, does at least one of them have the value
true - Let Q be given a sequence of integers, is the
maximum of the integer positive? - Let the transformation T be defined by
t(x1,x2,,xn)(y1,y2,,yn) where yi1 if xitrue,
and yi0 if xifalse - Clearly an algorithm to solve Q, when applied to
y1,y2,,yn, solves P for x1,x2,,xn