Polynomial time reduction from NP Complete to other problems - algorithm

Can any one clear my doubt please?
suppose I have a problem A which is known to be in NP-complete. and I have a another problem B for which we don't know the complexity class.
if I reduce A to B in polynomial time . we can say B also is in NP-Complete.
but..
if I reduce B to A in polynomial time . why can't I say B also in NP-Complete?

if I reduce A to B in polynomial time . we can say B also is in NP-Complete.
No, we can say that B is NP-hard. Completeness requires membership in NP as well, which does not follow from the assumptions.
For example, we can reduce 3SAT to the Halting Problem. The Halting Problem is not in NP (it's not even decidable).
if I reduce B to A in polynomial time . why can't I say B also in NP-Complete?
We can say that B is in NP. One algorithm for B is to use the reduction and then solve A. B might be an easy problem like "length of the input is odd".

If A is NP-complete, you can reduce any problem in NP to A. The NP-complete problems are the hardest problems in NP.
If you can reduce A to B in polynomial time, it means that B is "at least as hard as" A, because if you can solve B, then becomes easy to solve A. So, if A is NP-complete and those are (by definition) the hardest problems in NP, B is also NP-complete (assuming B is in NP, otherwise it's just NP-hard).
On the other hand, being able to reduce B to A is like being able to kill an ant with a bazooka. You obviously can do it, but it doesn't mean that killing an ant is "bazooka-complete".

Related

Are these two definitions of an NP-Complete problem equivalent?

Definition 1 (usual definition)
A problem B is NP-Complete if
B is in NP
For C in NP, C is polynomal-time reducible to B
Definition 2 (in a few documents)
A problem B is NP-Complete if
B is in NP
if B admits a polynomial-time algorithm, then all problems in NP also admit a polynomial-time algorithm
(as in "On the Inherent Intractability of Certain Coding Problems,..., Berlekamp, McEliece and Tilborg" and other documents
Definition 1 is the definition of NP-completeness you get if you define reducibility to be polynomial-time mapping reducibility (sometimes called polynomial-time many-one reducibility). That is, you’re allowed to reduce one problem to another by doing polynomial work to transform the input, then make a single call to the target problem. This is the standard definition of NP-completeness.
Definition 2 is the (nonstandard) definition of NP-completeness you get if you use polynomial-time Turing reducibility (called Cook reductions), in which you are allowed to spend polynomial time including an arbitrary number of calls to an oracle (solver) for the problem you’re reducing to.

Is polynomial reduction reversible?

Is this statement true or false : "If a problem A is polynomially reducible to a problem B, then problem B must also be polynomially reducible to A".
This is wrong, consider the reducible to relationship as its hardness is less than or equal. For example, if A is polynomially reducible to B, it means that A <= B in terms of hardness (amount of computation needed to solve it). If A is reducible to B it means that A is simpler than (or as hard as) B, which means if you can solve B you can solve A, as well.
Some supplementary information:
Any problem in P, which are problems that are simple and can be solved in polynomial time, is reducible to any problem in NP-complete (e.g. SAT). This means that problems in P are simpler than problems in NP-complete. Now, if your statement was true then problems in NP-complete would have been solved in polynomial time, which is seemingly impossible (no one has proved or disproved it). And if anybody solves it there will be chaos!!!
https://en.wikipedia.org/wiki/P_versus_NP_problem
SAT problem
A world with P=NP
Here is a (slightly edited) illustration from a very well-known graduate text on Complexity Theory (C.H. Papadimitriou, Computational Complexity). It shows what a reduction from A to B is.
A reduction from A to B is an algorithm for solving A that is composed of a translation R that maps every instance of A into an instance of B, and an algorithm for B. The translation must ensure that the answer for A(x) and for B(R(x)) is the same.
The existence of a such a translation does not guarantee that the inverse translation also exists. Intuitively the images of instances of A might form a subset of easy instances of B.
Anyone can easily suggest simple examples of problems where reduction in one direction does not guarantee a reduction in the other direction. For instance, 2-SAT is trivially reducible to SAT, yet 2-SAT is solvable in polynomial time, while SAT is NP-complete.
This is false. Consider the following problem:
Given a finite automaton, does it halt on a given input?
The answer to this problem happens always to be yes since all deterministic finite automata halt on all inputs. However, this problem is polynomial-time reducible to the following problem:
Given a Turing machine, does it halt on a given input?
The answer to this problem happens to be undecidable in the general case. This is the halting problem. However, if we had an oracle for this problem, we could certainly use it to answer the first question, albeit much less efficiently:
Produce a Turing machine equivalent to the DFA
Use the oracle to determine whether the Turing machine halts.
The halting problem for Turing machines, however, is not polynomial-time reducible to the halting problem for DFAs.

What are NP-Intermediate problems?

Assuming P != NP
The euler diagram shows a part not part of P and NP-complete. I read on wikipedia that this set is called NP-Intermediate.
Euler Diagram
I have some doubts as to how are NPI problems defined?
An NP-intermediate problem is a decision problem that
is in NP (that is, "yes" answers can be verified in polynomial time),
is not in P (that is, there is no polynomial-time algorithm for solving the problem), and
is not NP-complete.
That last criterion can be stated in a number of different ways. One way to say this is that there is no polynomial-time mapping reduction from SAT to that particular problem.
These problems are primarily of theoretical interest right now because we don't know if any NP-intermediate problems exist - if we could find one, we'd have a problem in NP that's not in P, meaning that P ≠ NP! However, they're interesting because if we can prove that P ≠ NP, then we know that there are some problems in NP that are too hard to be solved in polynomial time, but which aren't among the "hardest" of the hard problems in NP (the problems that are NP-complete).
In the event that P = NP, then there would not be any NP-intermediate problems because you couldn't have a problem in NP but not in P. If P ≠ NP, then Ladner's theorem guarantees at least one NP-intermediate problem exists, but does so by specifically constructing a problem that is highly artificial and designed solely to be NP-intermediate in that case. Right now, with a few exceptions (notably the graph isomorphism problem), all the problems we know of in NP are either squarely in P or known to be NP-complete.

example of reduction a polynomial decision to an NP-complete

I know if I reduce an NP-complete problem to a unknown problem P then I'm sure that P is itself NP-complete. And I know if I reduce a Problem P to an NP-complete problem there is no conclusion. So I want to give an example to show that we can reduce a Polynomial solvable problem P to an NP-complete one.
If I reduce an NP-complete problem to a unknown problem P then I'm
sure that P is itself NP-complete
No, this is not well formulated. If an NP-complete problem A is reducible to a problem P all we can say is that any problem in NP is reducible to P. To say that P is NP-complete we need to know additionally that P is itself in NP.
What you probably intended to say was
If I reduce an NP-complete problem to some a unknown problem P in NP then I'm
sure that P is itself NP-complete
Now to your original question.
give an example to show that we can reduce a Polynomial solvable
problem P to an NP-complete one
Consider the problem known as 2-SAT: Given a boolean formula in conjunctive normal form such that each disjunction contains at most two variables tell it if is satisfiable.
Solving this problem following an algorithm by Aspvall, Plass & Tarjan (1979) involves building an implication graph and finding all its strongly connected components. The paper proves that the formula is satisfiable if and only if the implication graph does not contain a strongly connected component that include some variable together with its negation. It also shows that this algorithm is linear in the size of the formula encoding.
So
there exists a linear algorithm for 2-SAT.
2-SAT is reducible to unrestricted boolean satisfiability problem known as SAT.
This gives an example of a polynomially solvable problem (2-SAT) that is reducible to an NP-complete problem (SAT).

Np completeness - Need some clarification in reduction

I wanted some clarification in a concept.
For proving that a problem is NP complete, we use reductions.
Now suppose I have L<=L'. has the reduction to be from L to L' or can I do it it the reverse way also? i.e Can I show that if L can be solved using L', then L' is NP-complete??
I am pretty confused regarding this.
For example. for a reduction from ham cycle to ham path, we so it the backward way.
Also, I am not able to solve the problem that I have to show that "is there a path from s to t in a graph with at least k edges" by reduction from ham cycle.
Please give me a clarification and guide me with the above problem. Thanks
To show that a language L is NP-complete you actually need to prove two things, L is in NP and L is NP-hard. Usually, proving L is in NP is easy, but don't forget to do it.
The normal way of showing L is NP-hard is to show, in effect, that a polynomial-time decider for L could be used to build a polynomial-time decider for a language L' that has been proved to be NP-complete.
It has to be that way round. There are many cases of a polynomial-time decidable language L for which a polynomial time decider could be built from a polynomial time decider for an NP-complete language. For example, consider the polynomial time decidable problem of coloring a graph with two colors, vs. the NP-complete general graph coloring problem.
I gave you a hint in a comment on your question about Hamiltonian Cycle. Have you read the hint and thought about it? If so, please respond in that question.

Resources