Hamiltonian Cycle Problem

advertisement
The P vs NP question is a question in complexity theory, the study of "computational
complexity" of problems. A “problem” is a yes-no question of the form, "Does x have the
property P?", and a solution to the problem is a program that takes the input x and determines
correctly whether or not x has that property. Complexity theory asks, for a particular property,
what is the “time complexity” of a program that can check that property. [We typically express
time complexity in big-Oh notation. For example, the time complexity of the problem "Is the
graph x connected?" is O(n), where n is the size of the graph.]
"P" and "NP" are complexity classes, which means they are a collection of problems, related
somehow by how fast their solutions are. Loosely, P is the class of all problems whose solution
is "fast". [Fast means that the solution can be found in polynomial time; the name "P" stands for
"polynomial". A program runs in “polynomial time” if the time it takes to run on an input of size
n is at most than n^k for some fixed k.] “NP” is the class of all problems whose answer can be
verified by a fast program (polynomial time). ["NP" stands for "nondeterministic polynomial".]
For example, the problem of determining whether a graph has a Hamiltonian cycle is in NP;
given a path in the graph, it is fast to verify whether or not it is a Hamiltonian cycle. However,
we don't know of any way to quickly find such a path.
It is clear that P is a subset of NP: if it is easy to find the solution to a problem, then it is also
easy to verify the solution someone gives you. The P vs NP question asks if the converse is true.
Is P a strict subset of NP, or is P equal to NP? Most computer scientists believe that P is not
equal to NP. For example, it is believed that the problem of determining whether a graph has a
Hamiltonian cycle is not in P, but it is known that it is in NP.
The significance of the P vs NP problem is that there is a broad class of problems that are known
to be in NP, but are believed to not be in P. For example, the problem of a breaking a particular
cryptographic protocol typically lies in NP, because given a solution (i.e., the private key to the
protocol), it is easy to verify whether it is correct or not. However, we hope that breaking these
cryptographic protocols is not a problem in P -- otherwise they could be broken quickly, because
problems in P have fast solutions.
1. Does P mean easy? fast? feasible?
2. What would be the consequences (positive and negative) of a proof that P = NP?
3. What would be the consequences (positive and negative) of a proof that P  NP?
Hamiltonian Cycle Problem
Input: Graph G = (V, E)
Problem: Does an ordering of the vertices along the edges exist such that each vertex is visited
exactly once?
1. Does a Hamiltonian cycle exist in the above graph? Can you find one?
2. What is the “input size” for the above problem?
3. Can you come up with an algorithm that solves the problem for a general graph? If so, please
describe your algorithm. What is the time complexity of your algorithm?
4. Can you come up with an algorithm that verifies a solution to the above problem? If so, please
describe your algorithm. What is the time complexity of your algorithm?
Download