Questions tagged [np]

NP ("nondeterministic polynomial") is a complexity class of decision problems that can be solved by a nondeterministic Turing machine in polynomial time. Equivalently, it is the set of decision problems for which an answer can be verified in polynomial time by a deterministic Turing machine.

NP (nondeterministic polynomial-time) is a complexity class of decision problems that can be solved by a nondeterministic Turing machine in polynomial time. Equivalently, it is the set of decision problems for which an answer can be verified in polynomial time by a deterministic Turing machine.

For example:

  • 3-Colorability: Given a graph, can each vertex be colored red, green, or blue so that no two neighboring vertices have the same color?
  • Hamiltonian Cycle: Given a graph, is there a cycle that visits each vertex exactly once?
  • Traveling Salesperson: Given a set of n cities, and the distance between each pair of cities, is there a route that visits each city exactly once before returning to the starting city, and has length at most T?
  • Maximum Clique: Given a graph, are there k vertices all of which are neighbors of each other?
  • Subset Sum: Given a collection of integers, is there a subset of the integers that sums to exactly

References

466 questions
8
votes
1 answer

P=NP: What are the most promising methods?

I know that P=NP has not been solved up to now, but can anybody tell me something about the following: What are currently the most promising mathematical / computer scientific methods that could be helpful to tackle this problem? Or are there even…
phimuemue
  • 30,699
  • 8
  • 74
  • 109
7
votes
2 answers

Maximum Independent Set Algorithm

I don't believe there exists an algorithm for finding the maximum independent vertex set in a bipartite graph other than the brute force method of finding the maximum among all possible independent sets. I am wondering about the pseudocode to find…
user1084113
  • 890
  • 2
  • 14
  • 29
7
votes
1 answer

Finding a subset which satisfies a certain condition

I have several arrays of numbers (each element of the array can only take a value of 0 or 1) like this v1: 1; 0; 0; 1; 1; v2: 0; 1; 0; 0; 1; v3: 1; 1; 0; 1; 0; v4: 1; 0; 0; 1; 0; v5: 1; 1; 0; 1; 1; v6: 1; 1; 0; 1; 1; I wish to find subsets…
Neo
  • 1,544
  • 2
  • 15
  • 27
7
votes
1 answer

How to find pattern groups in boolean array?

Given a 2D array of Boolean values I want to find all patterns that consist of at least 2 columns and at least 2 rows. The problem is somewhat close to finding cliques in a graph. In the example below green cells represent "true" bits, greys are…
Serge
  • 1,381
  • 1
  • 19
  • 38
7
votes
3 answers

Complete Weighted Graph and Hamiltonian Tour

I ran into a question on a midterm exam. Can anyone clarify the answer? Problem A: Given a Complete Weighted Graph G, find a Hamiltonian Tour with minimum weight. Problem B: Given a Complete Weighted Graph G and Real Number R, does G have a…
user4559497
7
votes
1 answer

Implementing a backtrack search with heuristic?

I'm getting quite interested in search algorithms and backtrack programming. For now, I have implemented Algorithm X (see my other post here: Determine conflict-free sets? ) to solve an exact cover problem. This works very well but I'm now…
user26372
  • 279
  • 1
  • 2
  • 14
7
votes
2 answers

Is "house coloring with three colors" NP?

Consider the problem described here (reproduced below.) Can some better known NP-complete problem be reduced to it? The problem: There are a row of houses. Each house can be painted with three colors: red, blue and green. The cost of painting…
user977476
6
votes
2 answers

How is 2-CNF SAT is in P, while 3-CNF SAT is in NPC?

I am really confused why 2-CNF SAT is in P, while 3-CNF SAT is in NPC. I Read CLRS, and I understand how they prove 3-CNF SAT is in NPC. Can't I use the same reducibility from SAT to 2-CNF-SAT to prove 2-CNF-SAT is in NPC. I don't understand why…
Rave
  • 775
  • 4
  • 14
  • 28
6
votes
2 answers

Confusion about NP-hard and NP-Complete in Traveling Salesman problems

Traveling Salesman Optimization(TSP-OPT) is a NP-hard problem and Traveling Salesman Search(TSP) is NP-complete. However, TSP-OPT can be reduced to TSP since if TSP can be solved in polynomial time, then so can TSP-OPT(1). I thought for A to be…
6
votes
1 answer

Complete Weighted Graph G, Finding Weights and one Machine

I read a lot about Complete Weighted Graph and Hamiltonian Tour topics in this site that asked by one of users, ask a lots of staff in my university, but couldn't get to a good answer, I change an important part of this question as follows:…
user4249446
6
votes
1 answer

NP-Complete? Optimal graph embedding for a graph with specific constraints

I have a grid based graph, where nodes and edges occupy cells. Edges can cross, but cannot travel on top of each other in the same direction. Lets say I want to optimize the graph so that the distance covered by edges is minimized. I am currently…
ddriver1
  • 703
  • 9
  • 16
6
votes
5 answers

NP-Complete VS NP-Hard

I am trying to understand the difference between NP-Complete and NP-Hard. Below is my understanding An NP-Hard problem is one that is not solvable in polynomial time but can be verified in polynomial time. An NP-Complete problem is one that is…
kayfun
  • 1,005
  • 4
  • 13
  • 26
6
votes
1 answer

Double exponential problems?

Are there any significant problems in computer science that can only be solved in double exponential time ? And if they exist then to which class of problems do they belong ?
Nikunj Banka
  • 10,091
  • 15
  • 68
  • 105
5
votes
4 answers

What makes an NP-hard problem not to be an NP-complete problem?

I am having confusion about NP-hard problems. Some NP-hard problems are in NP which are called NP-Complete and some are not in NP. For ex : Halting problem is only NP-hard, not NP-complete. But why it is not NP-complete ? I mean what property should…
Happy Mittal
  • 3,477
  • 11
  • 41
  • 58
5
votes
1 answer

What is a "Natural" NP-Complete prob?

I think I have a pretty decent understanding of NP-Complete, NP-Hard, etc. in general, but all of a sudden, stumbling upon some literature, I found someone saying a "natural" NP-complete problem -- explicitly with those quotes. I didn't understand…
vawd_gandi
  • 85
  • 5
1
2
3
31 32