Is 3-SAT polynomially equivalent to INDEPENDENT-SET [closed] - algorithm

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I know that 3-SAT is polynomially reducable to INDEPENDENT-SET problem.
Now is an INDEPENDENT-SET problem polynomially reducable to 3-SAT problem ? Thus are these problems polynomially equivalent?
I think it is, as every instance of INDEPENDENT-SET problem according to me can be represented in 3-SAT ( in some cases after adding a few extra edges ). However I am not clear about this understanding of mine.
Please help me our here.

Yes, the independent set problem can be reduced to 3SAT in polynomial time. The decision problem "given a graph G and number k, is there an independent set in G of size at least k?" is in NP (do you see why?). Since 3SAT is NP-complete, all problems in NP are polynomial-time reducible to it, and therefore the independent set problem is reducible to it.
Hope this helps!

Related

How can you compute the smallest number of queens that can be placed to attack each uncovered square? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
This is a variant question from the Elements of Programming Interviews and doesn't come with a solution.
How can you compute the smallest number of queens that can be placed to attack each uncovered square?
The problem is about finding a minimal dominating set in a graph (the queen graph in your case http://mathworld.wolfram.com/QueenGraph.html), this more general problem is NP-Hard. Even if this reduction (on this specific kind of graphs) is unlikely to be NP-Hard, you may expect to not be able to find any efficient (polynomial) algorithm and indeed as up today nobody find one.
As an interview question, I think an acceptable answer would be a backtracking algorithm. You can add small improvements like always stop the search if you already put (n-2)-queens on the board.
For more information and pseudo-code of the algorithm and also more sophisticated algorithms I would suggest to read:
Fernau, H. (2010). minimum dominating set of queens: A trivial programming exercise?. Discrete Applied Mathematics, 158(4), 308-318.
http://www.sciencedirect.com/science/article/pii/S0166218X09003722
The simplest way is probably exhaustive searching with 1,2,3... queens until you find a solution. If you take the symmetries of the board into account you will only need ~10^6 searches to confirm that 4 queens is not enough (at that point you could use the same search until you find a solution for 5 queens or alternately, use a greedy algorithm for 5 queens to find a solution faster).

Is there any NP example that we can get an answer in polynomial time? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I just read NP and P on wikipedia, I have two questions:
Can we solve an NP example in polynomial time ?
Is there any NP example that we can get an answer in polynomial time?
Disclaimer: This answer focuses on the practical aspects of dealing with the fact that there are problems for which no polynomial-time algorithm is known. To give an answer that is precise from a theoretical point of view, the terminology used in the question is not clear enough.
There are two meanings of NP in computer science that are easily mixed up.
(1) NP as the class of NP complete problems:
For none of these problems, a polynomial algorithm has been found so far. It has been proven that if such an algorithm is found for one of these problems, each of them can be solved in polynomial time. The standard example for NP completeness is the Travelling Salesman problem.
(2) NP as a property of an algorithm that requires exponential time:
Any NP algorithm can be solved for small sizes N. The issue is just that the number of calculations increases exponentially (i.e. very quickly) with N.
There are problems for which originally only NP algorithms have been known but for which polynomial time algorithms have been found later. Unfortunately I cannot come up with an example right now.
For many problems that have only NP solutions, there exist polynomial time algorithms that produce good approximations of the optimal solutions. For many applications this is sufficient.

Some inference about NP [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
this is my first question on this site.
I‌ recently, study on NP. I have some confusion about this Topic, and want to propose my inference and some one verify me.
I) each NP problem can be solved in Exponential Time.
II) if P=NP then NP=NP-Complete.
III) Problem of factorization into 2-prime factor, is NP.
IV) if problem X can reduce to a known NP-Hard problem, then X must be
NP-HARD.
anyone can verify my inference and learn me?‌
I) each NP problem can be solved in Exponential Time.
Yes, this because it can be solved in polynomial time on Non Determinisitc Machine (definition of NP), and thus can be solved on a Deterministic Machine in exponential time.
II) if P=NP then NP=NP-Complete.
Yes, because if P=NP, "yes" and "no" answers for all NP problems are equivalently easy to achieve, run the polynomial time algorithm for the "yes" problem, and answer like it. Result is always correct and runs in polynomial time, assuming such a polynomial time machine exists.
III) Problem of factorization into 2-prime factor, is NP.
Yes. Given an number and its prime factorization - it is easy to verify if this is the correct answer (this is equivalent definition of problem being in NP).
IV) if problem X can reduce to a known NP-Hard problem, then X must be
NP-HARD.
No, it should be the other way around. You need to reduce a known NP-Hard Problem to X, and then you can tag X as NP-Hard.
Rememeber that every problem in NP has a reduction to SAT (Cook Levin theorem), and yet P != NP-Complete (or so we think at least)

If P=NP then how we can we say P=NP=NP-complete? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
In wikipedia I found this diagram. I don't get how under the asumption p=np we get p=np=np-complete?
Not sure this is on topic for stack overflow (Theoretical Comp Sci), but NP-hard, as correctly visualized in the diagram is "the set of problems that are at least as hard as those in NP"; this includes problems that are worse than NP in one sense or another.
NP-complete problems are those problems in NP-hard that have a reducibility relationship with specific problems that are known to be in NP. Essentially, every problem that can be converted in polynomial time or better to a problem in NP-complete is just as hard as the others.
Here are a couple good snippets from CLRS that illustrate the issue:
The class NP consists of those problems that are “verifiable” in polynomial time. What do we mean by a problem being verifiable? If we were somehow given a "certificate” of a solution, then we could verify that the certificate is correct in time polynomial in the size of the input to the problem.
Informally, a problem is in the class NPC—and we refer to it as being NP-complete—if it is in NP and is as “hard” as any problem in NP.
A decidable language L is NP-complete if:
L is in NP, and
L' can be reduced to L in polynomial time for every L' in NP.
If a language L satisfies property 2, but not necessarily property 1, we say that L is NP-hard. We also define NPC to be the class of NP-complete languages.
(I may have the L' and L backwards there, the reducibility symbol is backwards from the way it is read in English.)
So what's the point? Well, you can just solve it with set theory: NP-complete is a subset of NP, and if P=NP, then NP-complete is a subset of P (in fact, they all become equal at that point, since you can solve any of them by first changing them to something your magic P-algorithm can work on). NP-hard still includes some NP-complete problems, but there are other problems outside, which are just hard.

NP-Complete vs. NP-hard [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
If a problem A known to be NP-Complete can be reduced to another problem B in polynomial time then B is
(A) NP-Complete
(B) NP-hard
Nothing is given about problem B whether it is in NP or not. I'm confused because in Hopcraft and Ullman book there is theorem given if a NP-complete problem P1 can be reduced to problem P2 in polynomial time then P2 is NP-complete. But it also required for a problem to be NP-Complete that it should belong to NP class. Guys help in understanding this concept.
If A can be reduced to B in polynomial time all you know is that B is harder than A. In your case, if A is NP-complete, B is NP-hard.
If B also happens to be in NP then B will be NP-complete (since NP-complete means being both in NP and being NP-hard at the same time).
However, nothing stops you from reducing A to a problem that is not in NP. For example, it is trivial to reduce any problem in NP to the halting problem - a problem that is undecideable in addition to being NP-hard:
Construct the following program:
Test all possible solutions for A.
If one of them is successful halt and otherwise enter an infinite loop.
A has a solution if-and-only if that program halts
Since problem A can be reduced to problem B in polynomial time, any solution to problem B can be used to find a solution to A. Or more simply, solving A cannot be harder than solving B. Since we know A is NP-complete, which class of problems is at least as hard as NP-complete problems?
For reference you might also want to take a look at the wikipedia articles on NP-Hard (specifically the 2nd sentence), NP-Complete.
and Reduction.
If A is NP-Complete, then it is also necessarily NP. This in turns means that every potential solution for A can be verified in polynomial time, which implies that the same is true for B (since A is reducible to B in polynomial time). Hence B is NP; it doesn't have to be stated as separate condition.

Resources