A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

NP-Completeness

College Depth 91 in the knowledge graph I know this Set as goal
27topics build on this
543prerequisites beneath it
See this on the map →
Algorithm Analysis and Complexity ClassesNP and Polynomial-Time Verification+8 more3-SAT and NP-Completeness via CNFApproximation Algorithms+13 more
complexity NP-complete hardness intractability

Core Idea

A problem is NP-complete if it is in NP and every problem in NP reduces to it in polynomial time — it is simultaneously the hardest class of problems in NP. If any NP-complete problem has a polynomial-time algorithm, then P = NP and all NP problems become tractable. Hundreds of natural problems from combinatorics, graph theory, logic, and optimization are NP-complete. The NP-completeness framework, introduced by Cook and Karp in the early 1970s, provides rigorous grounds for arguing a problem is computationally intractable.

How It's Best Learned

Build a mental map of NP-complete problems and their reduction relationships: SAT → 3-SAT → 3-Coloring → Clique → Independent Set → Vertex Cover. Understanding these reductions both proves completeness and reveals deep structural connections between seemingly unrelated problems.

Common Misconceptions

Explainer

Before NP-completeness, theoretical computer scientists had a troubling collection of practically important problems — Boolean satisfiability, graph coloring, traveling salesman, protein folding — that seemed hard but could not be proven hard in any absolute sense. The theory of NP-completeness, introduced by Cook and Karp in the early 1970s, gave these problems a rigorous shared status.

Recall that NP is the class of decision problems whose solutions can be *verified* in polynomial time. You may not know how to find a solution quickly, but given a candidate solution, you can check it fast. A problem X is NP-complete if it satisfies two conditions: (1) X is in NP, and (2) every other problem in NP reduces to X in polynomial time. The second condition is the powerful one — it means X is at least as hard as every problem in NP simultaneously.

Polynomial-time reductions are the mechanism. A reduction from problem A to problem B is a polynomial-time transformation that converts any instance of A into an instance of B with the same yes/no answer. If every NP problem reduces to X, and you could solve X in polynomial time, you could solve all of NP in polynomial time — i.e., P = NP. The Cook-Levin theorem established SAT as the first NP-complete problem by showing that any NP computation can be encoded as a Boolean formula. From there, Karp (1972) showed 21 additional natural problems were NP-complete by chaining reductions: SAT → 3-SAT → 3-Coloring → Clique → Vertex Cover → and so on.

The standard proof strategy for a new problem Y follows a two-step template: show Y is in NP (exhibit a polynomial verifier), then reduce a known NP-complete problem to Y in polynomial time (showing Y is at least as hard). Notice the direction: you reduce the known-hard problem *to* Y, not Y to the known-hard problem. Getting this direction wrong is a common source of errors.

A critical clarification: NP-completeness does not mean a problem is unsolvable or that no algorithm exists. Exact algorithms that explore the full solution space run in exponential time, but they exist. The practical consequence is that for large inputs, exact solutions are infeasible — but approximation algorithms, parameterized algorithms, and special-case analyses often deliver good results in practice. NP-completeness closes off the search for a fast general-purpose solver; it does not close off useful computation.

Practice Questions 3 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraIntroduction to Propositional LogicIntroduction to Predicate Logic (First-Order Logic)First-Order Logic SyntaxZFC Axioms OverviewAxiom Schema of SeparationAxiom Schema of ReplacementVon Neumann OrdinalsHereditarily Finite SetsRecursive Definitions on Finite SetsWell-Founded Relations and Transfinite RecursionThe Axiom of Choice and Equivalent FormulationsAxiom of ChoiceWell-Ordering TheoremInfinite Cardinal NumbersCantor's TheoremUncountability and the Diagonal ArgumentThe Cantor Set: An Uncountable Nowhere Dense ExampleUncountable Sets and Cantor DiagonalizationThe Halting ProblemComputability ReductionsPolynomial-Time ReductionsLower Bounds Techniques in Computational ComplexityNP-Completeness

Longest path: 92 steps · 543 total prerequisite topics

Prerequisites (10)

Leads To (15)