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 more→→3-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 Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Introduction to Propositional Logic → Introduction to Predicate Logic (First-Order Logic) → First-Order Logic Syntax → ZFC Axioms Overview → Axiom Schema of Separation → Axiom Schema of Replacement → Von Neumann Ordinals → Hereditarily Finite Sets → Recursive Definitions on Finite Sets → Well-Founded Relations and Transfinite Recursion → The Axiom of Choice and Equivalent Formulations → Axiom of Choice → Well-Ordering Theorem → Infinite Cardinal Numbers → Cantor's Theorem → Uncountability and the Diagonal Argument → The Cantor Set: An Uncountable Nowhere Dense Example → Uncountable Sets and Cantor Diagonalization → The Halting Problem → Computability Reductions → Polynomial-Time Reductions → Lower Bounds Techniques in Computational Complexity → NP-Completeness

Longest path: 92 steps · 543 total prerequisite topics

Prerequisites (10)

Leads To (15)