polynomial time reduction from a problem to a NP-complete problem - complexity-theory

I have problems to solve the following question:
If there are two problems p1 and p2, p2 is NP-complete and there is a polynomial reduction from p1 to p2, then p1 ...
a) is NP-hard but not necessarily NP-complete
b) could be in P, even if P!=NP
c) is NP-complete
d) none of the above
I think c) is correct, but I am not sure and how can I justify ist?

If there is a polynomial-time reduction from p1 to p2 it means that if you get an instance of problem p1, then you can transform it (in polynomial time) to an instance of problem p2. What does that tell us about problem p1?
Well, not very much. It means it's decidable, but it doesn't tell us a lot about its time complexity. For all we know, it might be the problem "What is 1+1?".
Had it been the other way around, then it would imply that p1 is NP-hard because otherwise we could solve p2 in polynomial time by reducing it to p1 and solving that in polynomial time.
So, since we don't know anything else about p1, the answer should be b).

Related

Eligibility for solving using Dynamic Programming

For a problem to be solved using dp, do we need both optimal substructure and overlapping subproblems to be satisfied by the problem or any one condition makes it eligible to solve using dp techniques?
If a problem P1 has optimal substructure but subproblems arent overlapping and if P2 has overlapping substructure but optimal substructure isnt satisfied, can i still solve P1 and P2 using dp?
It depends on a problem, but it seems that both P1 and P2 are a poor match for dynamic programming:
P1 - you can use DP, but you won't get any performance improvements, because the problems are not overlapping and you can't reuse solutions.
P2 - if there is no optimal substructure then having a solution to the subproblem does not you help find solution for the larger problem.

Is the NO-VERTEX-COVER in NP or not?

This is the reverse version of vertex cover problem. Consider a decision problem that asks whether, given a graph G = (V, E) and a nonnegative integer k, there does not exist a vertex cover of size no larger than k. Answer whether this problem is NP or not ? Please explain to me.
A short answer would be no (unless co-NP=NP).
Your decision problem, NO-VERTEX-COVER, is exactly the complement of the well-known VERTEX-COVER problem; the latter problem is NP-complete (and is, of course, in NP). Your problem NO-VERTEX-COVER is thus in co-NP. (Recall that a problem is in co-NP if and only if its complement is in NP.)
Because VERTEX-COVER, the complement of you problem, is NP-complete, it follows that unless co-NP=NP, the NO-VERTEX-COVER problem is not in NP. (This follows from a theorem that says that if co-NP is not equal to NP then no NP-complete problem is in co-NP.)

Is finding whether k different perfect matchings exist in a bipartite graph co-NP?

Few definitions first. The co-NP problem is a decision problem where the answer "NO" can be verified in polynomial time. The perfect matching in a bipartite graph is a set of pairs of nodes (a pair is an edge in the graph) and where every node occurs in this set exactly once.
I am given an n x n bipartite graph, and I am trying to find out if the problem of finding whether k different perfect matchings exist in the graph, where k= polynomial(n), is a co-NP problem.
Work done so far
To initially simplify the problem, I believe that if k=2, then this is a co-NP problem. I think this is true, because the bipartite graph does not have 2 different perfect matchings, if there does not exist an exchange of neighbors between 2 nodes. I define the exchange of neighbors as the following. Let G1 be the first set in the graph, and G2 be the second set in the graph. The exchange occurs when we have a subset of G1, S1={A,B}, and a second subset of G2, S2={X,Y}, where {(A,X),(A,Y),(B,X),(B,Y)} belongs to the set of edges E. I call it exchange because if A was initially matched with X, and B with Y, then when A gets paired with Y, and B with X, A and B have exchanged their neighbors. I believe that the only way to have 2 different perfect matchings is to have at least one such exchange.
Now, we can verify that no such exchange exist in polynomial time. This is true since getting all the possible subsets S1 and S2 has O(n^4) time complexity. This because we need (n choose 2) from G1 multiplied by (n choose 2) from G2, and this gives us an upper bound of n^4.
I am not sure if this is a co-NP problem, but it is NP for certain. I think you have a little mixed up the definition of "verifying an answer". In complexity theory verify an answer means that you provide a certificate that proves that your answer is correct, and such certificate may be checked (verified) in polynomial time.
For example, in the case of your problem, if you have a set k different perfect matchings, that will be a good certificate, verifying it means checking that it is indeed a set of perfect matchings in your input graph. You can check this in polynomial time by checking that all edges are in you graph and in each matching no two edges share a vertex, and all of them are different. Since the number of edges in a matching is linear, then verifying each matching can be done in polynomial time, then, since k is polynomial, we verify that property for all matchings also in polynomial time. Finaly, checking that all are different can be done in k square times something polynomial on n, yielding a polynomial complexity. So yes, your problem can be verified in polynomial time, and thus it is in NP.
Now, if you can find such certificate in polynomial time that will be proof enough that you problem is in P, and all problems in P are in NP and in co-NP. So I see two possible ways to solve this, you may prove that your problem is in P, that will yield a yes answer to your question, or you may prove that your problem is NP-complete, that will prove that your answer is no, since all NP-complete problems are not in co-NP (unless P = NP).
Any other way of proving that your problem is or is not in co-NP, might be very difficult and confusing, in fact the work you have done so far was moving towards proving that you can decide negative cases in polynomial time which is a different thing as verifying them, that would prove that it is co-NP, but because you proved that it is in P.

Complexity of Some problems in NP?

I want to summarize some problem on Complexity. Which of them can be solved in poly-time?
I) finding maximal sub complete graph of given graph = Clique Problem
II) select some elements among n objects in which value and weights
are given, such that sum of weights of selected elements is not bigger
than an specific bound and sum of value being maximum
III) finding all cycles of a graph
IV) Finding a path that visit each vertex exactly once = Determine a graph is Hamiltonian
I think IV is Hamiltonian path that is NP-Complete, III is NP-Hard and NP-Complete, II is NP-Complete, and I is NP-Complete. so 0 of these solved in poly-time.
Who can more clearer me about NP-Hard and NP-Complete of these problem in a nice way? Am I right?
As you've noted, parts (1), (2), and (4) are all famous NP-hard problems (max clique, knapsack, and Hamiltonian path). These problems are not in NP, though, because NP consists of decision problems (questions for which the answer is either "yes" or "no") and these are not decision problems.
Part (3) is more nuanced. This problem is a counting problem - the goal is to determine how many objects of some type exist - rather than a decision problem, so it can't be in NP. To the best of my knowledge, it's not really known how hard this problem is. It's known that if it can be solved in polynomial time, then P = NP (see this link for details), and the specific proof shows that it's NP-hard as well.
If P ≠ NP, then none of these can be solved in polynomial time. If any of these can be solved in polynomial time, then P = NP. They are all NP-hard.
Hope this helps!
Because I got asked about a reference, I am posting my comment as the answer:
II) select some elements among n objects in which value and weights
are given, such that sum of weights of selected elements is not bigger
than an specific bound and sum of value being maximum
This is a knapsack problem which is poly-time if weights are not a part of input size, i.e the solution is polynomial in terms of n only.
It runs in O(n * W) where W is the maximum allowed weight. Of course this can be not polynomial if W is related to n, for example if W = 2^n.
You can read about it here:
http://en.wikipedia.org/wiki/Knapsack_problem#Dynamic_programming_in_advance_algorithm
http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Dynamic/knapsackdyn.htm

How to prove that a problem is NP complete?

I have problem with scheduling. I need to prove that the problem is NP complete. What can be the methods to prove it NP complete?
To show a problem is NP complete, you need to:
Show it is in NP
In other words, given some information C, you can create a polynomial time algorithm V that will verify for every possible input X whether X is in your domain or not.
Example
Prove that the problem of vertex covers (that is, for some graph G, does it have a vertex cover set of size k such that every edge in G has at least one vertex in the cover set?) is in NP:
our input X is some graph G and some number k (this is from the problem definition)
Take our information C to be "any possible subset of vertices in graph G of size k"
Then we can write an algorithm V that, given G, k and C, will return whether that set of vertices is a vertex cover for G or not, in polynomial time.
Then for every graph G, if there exists some "possible subset of vertices in G of size k" which is a vertex cover, then G is in NP.
Note that we do not need to find C in polynomial time. If we could, the problem would be in `P.
Note that algorithm V should work for every G, for some C. For every input there should exist information that could help us verify whether the input is in the problem domain or not. That is, there should not be an input where the information doesn't exist.
Prove it is NP Hard
This involves getting a known NP-complete problem like SAT, the set of boolean expressions in the form:
(A or B or C) and (D or E or F) and ...
where the expression is satisfiable, that is there exists some setting for these booleans, which makes the expression true.
Then reduce the NP-complete problem to your problem in polynomial time.
That is, given some input X for SAT (or whatever NP-complete problem you are using), create some input Y for your problem, such that X is in SAT if and only if Y is in your problem. The function f : X -> Y must run in polynomial time.
In the example above, the input Y would be the graph G and the size of the vertex cover k.
For a full proof, you'd have to prove both:
that X is in SAT => Y in your problem
and Y in your problem => X in SAT.
marcog's answer has a link with several other NP-complete problems you could reduce to your problem.
Footnote: In step 2 (Prove it is NP-hard), reducing another NP-hard (not necessarily NP-complete) problem to the current problem will do, since NP-complete problems are a subset of NP-hard problems (that are also in NP).
You need to reduce an NP-Complete problem to the problem you have. If the reduction can be done in polynomial time then you have proven that your problem is NP-complete, if the problem is already in NP, because:
It is not easier than the NP-complete problem, since it can be reduced to it in polynomial time which makes the problem NP-Hard.
See the end of http://www.ics.uci.edu/~eppstein/161/960312.html for more.
In order to prove that a problem L is NP-complete, we need to do the following steps:
Prove your problem L belongs to NP (that is that given a solution you can verify it in polynomial time)
Select a known NP-complete problem L'
Describe an algorithm f that transforms L' into L
Prove that your algorithm is correct (formally: x ∈ L' if and only if f(x) ∈ L )
Prove that algo f runs in polynomial time
First, you show that it lies in NP at all.
Then you find another problem that you already know is NP complete and show how you polynomially reduce NP Hard problem to your problem.
Get familiar to a subset of NP Complete problems
Prove NP Hardness : Reduce an arbitrary instance of an NP complete problem to an instance of your problem. This is the biggest piece of a pie and where the familiarity with NP Complete problems pays. The reduction will be more or less difficult depending on the NP Complete problem you choose.
Prove that your problem is in NP : design an algorithm which can verify in polynomial time whether an instance is a solution.

Resources