NP-Completeness
The hardest problems in NP, all interreducible — solve one efficiently and you solve them all.
Contents
NP-Completeness
An NP-complete problem is one of the hardest problems in NP, in a precise sense: it is in NP, and every other problem in NP can be transformed into it by an efficient (polynomial-time) reduction. These problems are the keystones of P versus NP. Find a fast algorithm for one of them and you have, automatically, a fast algorithm for all of NP — proving P = NP. Prove that one of them needs exponential time and you have proved P ≠ NP. They stand or fall together.
There are thousands of them, scattered across logic, scheduling, graph theory, number theory, and games — yet underneath they are, computationally, the same problem wearing different costumes.
Reduction: the universal translator
The magic ingredient is the polynomial-time reduction. To reduce problem A to problem B is to write an efficient translator that turns any instance of A into an instance of B with the same yes/no answer. If such a translator exists, then "B is easy" implies "A is easy" — just translate and solve.
A graph you can watch: 3-coloring
A classic NP-complete problem: can the vertices of a Graph be painted with just three colors so that no edge joins two same-colored vertices? Checking a proposed coloring is trivial — glance at every edge. Finding one means searching a space of 3^V colorings. The sketch below hunts for a valid 3-coloring of a wheel graph by trial: red edges are conflicts (endpoints clash); it keeps trying until every edge is satisfied, then locks in green.
Other faces of the same beast include the clique problem (is there a set of k mutually connected vertices?), the traveling salesman decision problem, and SAT itself. A polynomial reduction connects every one of them to all the others.
So what do we do about them?
Since (almost certainly) no fast exact algorithm exists, real systems sidestep the wall: approximation algorithms that get provably close, heuristics like Simulated Annealing and Genetic Algorithms that find good-enough answers, or solvers tuned for the easy instances that arise in practice. NP-completeness does not mean "give up" — it means "stop looking for a perfect, fast, general method, because by P versus NP it probably cannot exist."