Canonical Complete Problems
SAT, graph problems, Subset Sum, and reusable patterns in NP-completeness reductions.
Goals
- Navigate the standard reduction network instead of memorizing isolated problem names.
- Match logical choice, graph compatibility, routes, cuts, colors, and arithmetic to suitable gadgets.
- Keep decision and optimization versions separate.
- Analyze binary encodings and distinguish polynomial from pseudo-polynomial algorithms.
1. The canonical network
Cook–Levin gives the starting point:
From 3SAT, clause/consistency gadgets lead to Independent Set and CLIQUE; complement and set identities connect CLIQUE, Independent Set, and Vertex Cover. Other branches lead to coloring, Hamiltonian path/cycle, Subset Sum, and Max-Cut. Hamiltonian Cycle leads naturally to the decision version of TSP; Subset Sum connects to Partition and, with stronger packing gadgets, Bin Packing.
Canonical reduction map
An arrow is a theorem, not an analogy. Each requires a computable mapping, an iff proof, and a polynomial encoding bound.
2. SAT and 3SAT
SAT asks whether a Boolean formula has a satisfying assignment. 3SAT restricts input to CNF in which each clause has exactly (or, by convention, at most) three literals. SAT belongs to NP because an assignment is a certificate.
Converting an arbitrary formula to an equivalent CNF by distributivity can cause exponential blowup. The correct polynomial reduction introduces a variable for each subformula and clauses enforcing consistency—Tseitin-style encoding. Long CNF clauses are then split equisatisfiably. For example,
can become
The new formula need not be logically equivalent over the enlarged variable set; it must be equisatisfiable. Any satisfying assignment to the old clause extends to suitable , and any satisfying extended assignment implies at least one original literal is true.
3. Independent Set, CLIQUE, and Vertex Cover
For graph :
- IS asks whether there are at least pairwise nonadjacent vertices.
- CLIQUE asks whether there are at least pairwise adjacent vertices.
- VC asks whether at most vertices touch every edge.
All three are in NP by listing the chosen vertices and checking the relevant pairs or edges.
Complement-graph equivalence
Map to , where for distinct ,
Then
Constructing takes time in a standard representation. Loops are excluded; forgetting “distinct vertices” changes the definition.
Independent set versus vertex cover
The identity
gives
Proof. If an edge had both endpoints in , would not be independent; hence every edge has an endpoint outside . Conversely, if covers every edge, no edge can have both endpoints in .
The full 3SAT→IS construction and iff proof appear in the reductions lesson. Combining it with these equivalences yields NP-completeness of all three problems.
Mini-example
In the path , is independent, so its complement is a vertex cover. In the complement graph, is a clique. Parameters change for VC but not for CLIQUE.
4. Coloring
-COLOR asks whether vertices can be assigned one of colors so adjacent vertices differ. A color vector is a polynomial certificate. For , BFS decides the problem by testing bipartiteness; for every fixed , the problem is NP-complete.
A reduction from 3SAT to 3-COLOR typically creates a fixed palette triangle named True, False, and Base. Variable gadgets force a choice between True and False, while clause gadgets are colorable exactly when at least one incident literal carries True. The exact clause gadget matters: a drawing that “looks constrained” is not a proof. One must show both how every satisfying assignment extends to a coloring and how every legal coloring decodes a satisfying assignment.
Do not silently vary . “3-COLOR” and “COLORING with in the input” are different languages, though both are NP-complete.
5. Max-Cut
Decision MAX-CUT receives and asks whether some partition has at least crossing edges. The optimization version asks for the maximum number (or weight) of crossing edges. NP-completeness claims concern the decision language.
A partition is a certificate; count crossing edges in polynomial time. In a triangle, every cut crosses at most two edges, and placing one vertex on one side and two on the other achieves two. Thus is yes and is no.
Reductions to Max-Cut use edges as rewards for opposite truth values. Heavy or replicated edges can pin reference vertices or dominate auxiliary choices. If weights are used, their binary sizes and the conversion to an unweighted instance must be analyzed; replacing weight by parallel structures is polynomial only when itself is polynomially bounded.
6. Hamiltonian problems and TSP
Hamiltonian Path asks for a simple path visiting every vertex exactly once; Hamiltonian Cycle requires returning to the start. A certificate is an ordering of vertices. Verify uniqueness and each consecutive edge, plus the closing edge for a cycle.
Standard reductions use variable tracks that can be traversed in two directions, representing truth values, and clause detours reachable only from a track corresponding to a satisfied literal. The invariant is global: a Hamiltonian traversal must choose one consistent track per variable while visiting every clause gadget.
The directed and undirected variants require different gadgets. A proof must name which variant is the source and target.
Hamiltonian Cycle to decision TSP
Given an unweighted graph , form the complete graph on with
Set budget . If has a Hamiltonian cycle, its edges give a tour of weight . Conversely, every tour has exactly edges, each of weight at least one; a tour of weight at most must use only weight-one edges and therefore is a Hamiltonian cycle in .
The construction has edges and tiny weights, so it is polynomial. This proves hardness of the decision language “is there a tour of weight at most ?” Membership in NP follows by listing the tour and adding binary weights.
7. Subset Sum and numeric encodings
SUBSET-SUM receives nonnegative binary integers and asks whether
A certificate is an -bit selection vector. Binary addition is polynomial in total bit length.
3SAT → Subset Sum
The instance
is yes because . With target , exhaustive inspection is not a complexity proof; it only settles this tiny instance.
No-carry encodings
The reduction from 3SAT assigns digit columns to variables and clauses. Numbers representing choosing literal or place controlled digits in the variable column and in clauses where that literal occurs. Additional slack numbers fill clause columns. The target asks for one truth choice per variable and enough clause contribution to certify at least one satisfied literal.
Choose a base larger than the maximum possible column sum. Then no carries occur, and decimal-looking arithmetic decomposes into independent column constraints. If there are polynomially many columns and each digit has constant range, every generated number has polynomially many bits:
The proof must establish this bound; merely displaying huge integers is not enough.
Pseudo-polynomial dynamic programming
The familiar table indexed by target values runs in time. With encoded in binary, can be exponential in , so this is pseudo-polynomial, not polynomial in input length. If values are unary encoded or polynomially bounded, the interpretation changes. Encoding is therefore part of the theorem.
8. Partition and Bin Packing
PARTITION asks whether the numbers can be split into two groups of equal sum. For total , odd is immediately no; when is even, it asks for a subset summing to . This shows the structural relation to Subset Sum, but a many-one hardness proof from arbitrary Subset Sum needs a balancing construction; writing target reverses the easy direction or handles only a special case.
Complete reduction from Subset Sum to Partition
Take a SUBSET-SUM instance and let . Reject trivial malformed or out-of-range cases separately; if , emit a fixed no-instance. Otherwise add
The new multiset has total
so each side of a partition must sum to . If original numbers with sum exist, place them together with on one side; their sum is . Conversely, neither side can reach using only original numbers, whose total is , and cannot fit together on one side. Thus one side contains exactly one of . If it contains , its original numbers sum to . If it contains , they sum to , so the complementary original numbers sum to . This proves the iff.
The generated values are at most . Their bit lengths are , and is at most the total input bit length plus . Computing the sums and printing the two numbers is polynomial. This is the encoding analysis that turns the arithmetic identity into a valid reduction.
BIN PACKING decision receives item sizes, bin capacity , and number of bins , and asks whether all items fit into at most bins. A certificate assigns each item to a bin; verify every capacity sum.
Partition is the two-bin special structure when total size is exactly . Stronger NP-hardness results for Bin Packing use problems such as 3-PARTITION, whose instances force exactly three items per bin through size bounds. This distinction matters: a pseudo-polynomial algorithm for weakly NP-complete numeric problems does not contradict strong NP-hardness.
Mini-example: items fit into two bins of capacity as and . Items have total , so the same two-bin instance is immediately no.
For the Subset-Sum instance with , , so add and . The Partition total is and each side needs . The subset joins , while forms the other side.
9. Small cut and coloring gadgets
A useful Max-Cut micro-gadget is a length-two path . If and lie on the same side, placing on the other side cuts both edges; if they lie on opposite sides, at most one edge is cut. Thus the gadget rewards equality of the terminals by two versus one. A direct edge , by contrast, rewards inequality. Weighted combinations of these two effects express Boolean constraints, provided the proof sets a threshold that leaves no slack for violating a required gadget.
For coloring, a triangle forces three different colors. Once its vertices are named , connect a variable vertex to so it can use only or ; connect a second vertex representing its negation so the pair is forced to opposite truth colors. A complete clause gadget must then forbid only the all-false combination while remaining colorable for each of the other seven combinations. Checking those cases, or proving a structural invariant that covers them, is the coloring analogue of an iff proof.
These examples explain the pattern without substituting for a full reduction. Every shared auxiliary vertex and every unintended coloring or cut must be included in the reverse-direction analysis.
10. Choosing a source problem
Choose a source whose solution structure resembles the target:
- local Boolean choices and consistency: 3SAT;
- pairwise compatibility or conflict: CLIQUE/IS;
- selecting objects under exact arithmetic: Subset Sum;
- cyclic global traversal: Hamiltonian Cycle;
- partitioning by disagreement: Max-Cut;
- bounded groups and capacities: 3-Partition or Bin Packing.
The nearest-looking source is not automatically valid, but a good structural match makes the invariant and reverse proof easier.
Common mistakes
- Switching silently between decision and optimization.
- Omitting , , , capacity, or number of bins from an instance.
- Treating arithmetic operations or loops to as constant/polynomial in .
- Claiming direct CNF expansion is always polynomial.
- Giving only the intuitive direction of a gadget.
- Confusing graph complement with set complement.
- Using a directed Hamiltonian gadget for an undirected target.
- Claiming every structural relation is already a hardness reduction.
Exercises
Exercise 1 — IS→VC parameter
Prove the equivalence: has an independent set of size iff it has a vertex cover of size .
Solution
If is independent, is a cover: every edge meets . If is a cover, is independent. Sizes complement to . The reduction parameter is .
Exercise 2 — Unit-weight TSP budget
In a reduction from Hamiltonian Cycle to TSP with weight on graph edges and large weight on non-edges, why is budget correct?
Solution
A tour has edges. If all tour edges are original weight- edges, cost equals . If any edge is missing, a large weight is used and cost . Thus budget is equivalent to having a Hamiltonian cycle.
Exercise 3 — Large base in Subset Sum
Explain why a large base (e.g. ) is needed in a 3SAT→Subset Sum reduction.
Solution
A large base prevents carries across digit columns, isolating each constraint (literal/clause occurrences). With a small base, carries can create spurious sums that do not correspond to a valid assignment.
Exercise 4 — with binary
Prove that an -time Subset Sum algorithm need not be polynomial when is binary-encoded.
Solution
Input length is roughly. If , then is exponential in . This is pseudopolynomial: polynomial in the value , not in the encoding length.
Exercise 5 — After hardness: NP membership
A student proves is NP-hard but forgets . What is missing for completeness? Why is 2-COLOR not a valid NP-complete target unless ?
Solution
Missing . 2-COLOR is in (bipartiteness). If it were NP-complete then . So it is not a valid completeness target without collapsing the classes.
Summary
Canonical problems form a reduction network. Parameters, weights, and numeric encodings are common places for formal mistakes.
Guided practice
Task 1 — CLIQUE↔IS
Prove a polynomial equivalence between CLIQUE in and IS in (or vice versa) with the same .
Solution
A vertex set is a clique in iff it is independent in . The reduction builds the complement in polynomial time and keeps .
Task 2 — Choosing a source problem
When is it better to start a reduction from 3SAT versus from Vertex Cover? Give a short criterion.
Solution
Use 3SAT for logical/numeric gadgets; use VC/IS/CLIQUE when the target is graph-like with similar structure. Pick a source that is already complete and whose gadget translates directly into the target constraints.
Task 3 — Coloring encoding trap
Explain why a reduction to -COLOR must handle the exact language definition (is fixed or part of the input?) used in the course.
Solution
The language must be defined precisely. Malformed encodings, loops, or a missing parameter change the language. Completeness requires matching that definition and NP membership.
Sources
Course evidence
- Current Semester A transcript 14: graph gadgets and the Hamiltonian/TSP material used here.
- Current Semester A transcript 15: the numeric-problem material, including Subset Sum, Partition, and encoding cautions.
- Merged course summary, pp. 55–57, 64–66, and 72–75: only the graph-problem family and its reductions (including the applicable independent-set, clique, vertex-cover, coloring, and cut material).
- The Hamiltonian/TSP and Subset-Sum/Partition/Bin-Packing sections are transcript-and-textbook syntheses. They are not attributed to the merged summary.
Textbook verification
- Sipser, Introduction to the Theory of Computation, 3rd ed., §7.5, pp. 315–325: 3SAT and selected graph reductions.
- Papadimitriou, Computational Complexity, Ch. 9: canonical NP-complete graph, route, and numeric problems.
- Garey–Johnson, Computers and Intractability, Ch. 3 and the problem catalog: standard formulations, encoding qualifications, and reduction families. These references verify theorem statements; examples and organization above follow the course.
The pages this was written from
3 pages
These pages were chosen by word overlap between the text here and the page's transcription — nobody has verified them. Treat them as a lead to check, not a citation.
Lecture 8 · page 3בעית החתך המרבי ובעיות צביעהShared wordsצד · ובצד · שתיים · קליקה · False · חוצות
Lecture 13 · page 2המשך בעיות NP קשותShared wordsBin · Packing · מופע · האריזה · Partition · תא
Lecture 25 · page 3תרגיליםShared wordsשאליה · מבודדים · הכיוונים · שניהם · רכיב · true