NP-Completeness Proofs - West Virginia...

136
Outline NP-Completeness Proofs Matt Williamson 1 1 Lane Department of Computer Science and Electrical Engineering West Virginia University Graph Theory, Packing, and Covering Williamson NP-Completeness Proofs

Transcript of NP-Completeness Proofs - West Virginia...

Outline

NP-Completeness Proofs

Matt Williamson1

1Lane Department of Computer Science and Electrical EngineeringWest Virginia University

Graph Theory, Packing, and Covering

Williamson NP-Completeness Proofs

Outline

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Outline

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

MAX BISECTION

ProblemGiven a graph G = (V , E), we are looking for a cut S, V − S of size K or more such that

|S| = |V − S|. Note that if |V | = n is odd, then the problem is trivial.

Example

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

MAX BISECTION

ProblemGiven a graph G = (V , E), we are looking for a cut S, V − S of size K or more such that

|S| = |V − S|. Note that if |V | = n is odd, then the problem is trivial.

Example

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

MAX BISECTION (contd.)

LemmaMAX BISECTION is NP-complete.

Proof.We modify a given instance of Max Cut so that the constraint |S| = |V − S| is easy to satisfy. This

gives us a solution if and only if the instance of MAX CUT does. The trick is to add |V | completely

disconnected nodes to G. We can make a bisection and add the new nodes between the two

sections to get |S| = |V − S| to get the result.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

MAX BISECTION (contd.)

LemmaMAX BISECTION is NP-complete.

Proof.We modify a given instance of Max Cut so that the constraint |S| = |V − S| is easy to satisfy. This

gives us a solution if and only if the instance of MAX CUT does. The trick is to add |V | completely

disconnected nodes to G. We can make a bisection and add the new nodes between the two

sections to get |S| = |V − S| to get the result.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

MAX BISECTION (contd.)

LemmaMAX BISECTION is NP-complete.

Proof.We modify a given instance of Max Cut so that the constraint |S| = |V − S| is easy to satisfy. This

gives us a solution if and only if the instance of MAX CUT does. The trick is to add |V | completely

disconnected nodes to G. We can make a bisection and add the new nodes between the two

sections to get |S| = |V − S| to get the result.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

BISECTION WIDTH

ProblemThis is the same problem as Max Bisection except we want a bisection size at most K . We can say

this would be the minimum bisection.

Example

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

BISECTION WIDTH

ProblemThis is the same problem as Max Bisection except we want a bisection size at most K . We can say

this would be the minimum bisection.

Example

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

BISECTION WIDTH (contd.)

TheoremBISECTION WIDTH is NP-complete.

Proof.Given a graph G = (V , E) where |V | = 2n is an even number, we can see that we have a bisection

of size K or more if and only if the complement of G has a bisection of size n2 − K .

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

BISECTION WIDTH (contd.)

TheoremBISECTION WIDTH is NP-complete.

Proof.Given a graph G = (V , E) where |V | = 2n is an even number, we can see that we have a bisection

of size K or more if and only if the complement of G has a bisection of size n2 − K .

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH

ProblemGiven a graph G = (V , E) and an undirected path, does it have a Hamilton path, a path visiting

each node exactly once?

TheoremHAMILTON PATH is NP-complete.

ProofWe reduce 3SAT to this problem. We will first need to express the properties of 3SAT as graph

elements.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH

ProblemGiven a graph G = (V , E) and an undirected path, does it have a Hamilton path, a path visiting

each node exactly once?

TheoremHAMILTON PATH is NP-complete.

ProofWe reduce 3SAT to this problem. We will first need to express the properties of 3SAT as graph

elements.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH

ProblemGiven a graph G = (V , E) and an undirected path, does it have a Hamilton path, a path visiting

each node exactly once?

TheoremHAMILTON PATH is NP-complete.

ProofWe reduce 3SAT to this problem. We will first need to express the properties of 3SAT as graph

elements.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH

ProblemGiven a graph G = (V , E) and an undirected path, does it have a Hamilton path, a path visiting

each node exactly once?

TheoremHAMILTON PATH is NP-complete.

ProofWe reduce 3SAT to this problem. We will first need to express the properties of 3SAT as graph

elements.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

FalseTrue

Choice between true and false

Consistency: all x and ¬x have opposite values, can use xor gadget

Restriction of at most three literals/clause

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

ObservationSuppose we have made sure that each side of a triangle is traversed by a Hamilton path if and only

if the corresponding literal is false. Then at least one literal is true, since otherwise all three sides

are traversed and there is no Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

ObservationSuppose we have made sure that each side of a triangle is traversed by a Hamilton path if and only

if the corresponding literal is false. Then at least one literal is true, since otherwise all three sides

are traversed and there is no Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

1x1 x2 x3true

false

2

3

Example: (x1 ∨ x2 ∨ x3) ∧ (¬x1 ∨ ¬x2 ∨ x3) gives graph whereblack nodes make up large clique and are connected

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

Proof.We can get a Hamilton path if and only if we have a satisfying truth assignment. Starting at node 1,one of the two parallel edges for each choice must be traversed. The nodes connected by the xorgadgets will also be traversed. Since the black nodes are a large clique, we can connect theremaining black nodes and traverse to nodes 2 and 3. This path provide a satisfying truthassignment.

Given a satisfying truth assignment, we can create a Hamilton path starting at node 1.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

Proof.We can get a Hamilton path if and only if we have a satisfying truth assignment. Starting at node 1,one of the two parallel edges for each choice must be traversed. The nodes connected by the xorgadgets will also be traversed. Since the black nodes are a large clique, we can connect theremaining black nodes and traverse to nodes 2 and 3. This path provide a satisfying truthassignment.

Given a satisfying truth assignment, we can create a Hamilton path starting at node 1.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

Proof.We can get a Hamilton path if and only if we have a satisfying truth assignment. Starting at node 1,one of the two parallel edges for each choice must be traversed. The nodes connected by the xorgadgets will also be traversed. Since the black nodes are a large clique, we can connect theremaining black nodes and traverse to nodes 2 and 3. This path provide a satisfying truthassignment.

Given a satisfying truth assignment, we can create a Hamilton path starting at node 1.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

Proof.We can get a Hamilton path if and only if we have a satisfying truth assignment. Starting at node 1,one of the two parallel edges for each choice must be traversed. The nodes connected by the xorgadgets will also be traversed. Since the black nodes are a large clique, we can connect theremaining black nodes and traverse to nodes 2 and 3. This path provide a satisfying truthassignment.

Given a satisfying truth assignment, we can create a Hamilton path starting at node 1.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON PATH (contd.)

Proof.We can get a Hamilton path if and only if we have a satisfying truth assignment. Starting at node 1,one of the two parallel edges for each choice must be traversed. The nodes connected by the xorgadgets will also be traversed. Since the black nodes are a large clique, we can connect theremaining black nodes and traverse to nodes 2 and 3. This path provide a satisfying truthassignment.

Given a satisfying truth assignment, we can create a Hamilton path starting at node 1.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON CIRCUIT

ProblemGiven an undirected graph G = (V , E), can we create a Hamilton circuit, a cycle visiting each node

exactly once and returning to the starting node?

CorollaryHAMILTON CIRCUIT is NP-complete.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON CIRCUIT

ProblemGiven an undirected graph G = (V , E), can we create a Hamilton circuit, a cycle visiting each node

exactly once and returning to the starting node?

CorollaryHAMILTON CIRCUIT is NP-complete.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON CIRCUIT (contd.)

Proof.

s t

v

GHamilton

Path

Given an instance of graph G containing a Hamilton path, we add a new node v that is connected

to all other nodes in G. We simply connect the last node of the Hamilton path to v , and then

connect to the first node in the path, creating a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

HAMILTON CIRCUIT (contd.)

Proof.

s t

v

GHamilton

Path

Given an instance of graph G containing a Hamilton path, we add a new node v that is connected

to all other nodes in G. We simply connect the last node of the Hamilton path to v , and then

connect to the first node in the path, creating a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST PATH

ProblemGiven an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

(visiting each vertex no more than once) path with K or more edges?

CorollaryLONGEST PATH is NP-complete.

Proof.We reduce from HAMILTON PATH. Given an instance of HAMILTON PATH in graph G′, let

K = |V | − 1. We have a simple path of length K if and only if G′ contains a Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST PATH

ProblemGiven an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

(visiting each vertex no more than once) path with K or more edges?

CorollaryLONGEST PATH is NP-complete.

Proof.We reduce from HAMILTON PATH. Given an instance of HAMILTON PATH in graph G′, let

K = |V | − 1. We have a simple path of length K if and only if G′ contains a Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST PATH

ProblemGiven an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

(visiting each vertex no more than once) path with K or more edges?

CorollaryLONGEST PATH is NP-complete.

Proof.We reduce from HAMILTON PATH. Given an instance of HAMILTON PATH in graph G′, let

K = |V | − 1. We have a simple path of length K if and only if G′ contains a Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST PATH

ProblemGiven an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

(visiting each vertex no more than once) path with K or more edges?

CorollaryLONGEST PATH is NP-complete.

Proof.We reduce from HAMILTON PATH. Given an instance of HAMILTON PATH in graph G′, let

K = |V | − 1. We have a simple path of length K if and only if G′ contains a Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST PATH

ProblemGiven an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

(visiting each vertex no more than once) path with K or more edges?

CorollaryLONGEST PATH is NP-complete.

Proof.We reduce from HAMILTON PATH. Given an instance of HAMILTON PATH in graph G′, let

K = |V | − 1. We have a simple path of length K if and only if G′ contains a Hamilton path.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST CIRCUIT

LONGEST CIRCUIT

Given an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

circuit, a circuit visiting each vertex no more than once, with K or more edges?

CorollaryLONGEST CIRCUIT is NP-complete.

Proof.We reduce from HAMILTON CIRCUIT. Given an instance of HAMILTON CIRCUIT, if the graph contains

a Hamilton circuit, let K = |V |, where |V | is the number of nodes in the path. Then we have a

simple circuit of length K if and only if the graph contains a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST CIRCUIT

LONGEST CIRCUIT

Given an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

circuit, a circuit visiting each vertex no more than once, with K or more edges?

CorollaryLONGEST CIRCUIT is NP-complete.

Proof.We reduce from HAMILTON CIRCUIT. Given an instance of HAMILTON CIRCUIT, if the graph contains

a Hamilton circuit, let K = |V |, where |V | is the number of nodes in the path. Then we have a

simple circuit of length K if and only if the graph contains a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST CIRCUIT

LONGEST CIRCUIT

Given an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

circuit, a circuit visiting each vertex no more than once, with K or more edges?

CorollaryLONGEST CIRCUIT is NP-complete.

Proof.We reduce from HAMILTON CIRCUIT. Given an instance of HAMILTON CIRCUIT, if the graph contains

a Hamilton circuit, let K = |V |, where |V | is the number of nodes in the path. Then we have a

simple circuit of length K if and only if the graph contains a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST CIRCUIT

LONGEST CIRCUIT

Given an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

circuit, a circuit visiting each vertex no more than once, with K or more edges?

CorollaryLONGEST CIRCUIT is NP-complete.

Proof.We reduce from HAMILTON CIRCUIT. Given an instance of HAMILTON CIRCUIT, if the graph contains

a Hamilton circuit, let K = |V |, where |V | is the number of nodes in the path. Then we have a

simple circuit of length K if and only if the graph contains a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

LONGEST CIRCUIT

LONGEST CIRCUIT

Given an undirected graph G = (V , E) and a positive integer K ≤ |V |, does G contain a simple

circuit, a circuit visiting each vertex no more than once, with K or more edges?

CorollaryLONGEST CIRCUIT is NP-complete.

Proof.We reduce from HAMILTON CIRCUIT. Given an instance of HAMILTON CIRCUIT, if the graph contains

a Hamilton circuit, let K = |V |, where |V | is the number of nodes in the path. Then we have a

simple circuit of length K if and only if the graph contains a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

TSP (D)

ProblemThis is the decision version of TSP. Given n cities 1, ..., n, a nonnegative integer distance dij

between any two cities i and j, and an integer bound B, can we find a tour (visiting each city exactly

once and returning to the starting city) of length at most B?

CorollaryTSP (D) is NP-complete.

Proof.We reduce HAMILTON CIRCUIT to this problem. Given an instance of a graph G, we create G′ as

follows: We first make G′ complete. We let dij = 0 if edge (i, j) is in G. Otherwise, we let dij = 1.

We solve for TSP (D). If the cost of the tour is 0, then we have a Hamilton circuit.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING

ProblemWe want to color the vertices of a graph with three colors such that no two adjacent nodes have the

same color.

Theorem3-COLORING is NP-complete.

ProofThis is a simple reduction from NAE3SAT. We are given a set of clauses C1, ..., Cm, each with

three literals, involving the variables x1, ..., xn , and are asked whether there is a truth assignment

on the variables such that no clause has all literals true or all literals false. We can construct

triangles and use all three colors on the nodes. For each variable xi , we have a triangle [a, xi ,¬xi ]

where all of the triangles share the node a. Each clause Ci is represented by triangle [Ci1, Ci2, Ci3],

where we have an edge connecting Cij with a node that represents the j th literal of Ci . We say that

G can be colored with {0, 1, 2} if and only if the given instance of NAE3SAT is satisfiable.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

¬x1 x1 x2 ¬x2 x3 ¬x3 ¬x4 x4

a

1

0 2

0 1 1 0 1 0 0 1

Construction for ... ∧ (x1, ¬x2, ¬x3) ∧ ...

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

BisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

3-COLORING (contd.)

Proof.Suppose the graph is 3-colorable. Let node a have color 2, and for each i either xi or ¬xi is colored

1 and the other 0. If xi is 1, it is true, otherwise it is false. If all literals were true, then the

corresponding triangle cannot be colored since 1 cannot be used. The same applies when all

literals are false. This means there must be at least one literal true and one literal false. Therefore,

NAE3SAT is satisfiable. Suppose we have a satisfying truth assignment. We color node a with 2

and the variable triangles in the way that reflects the truth assignment. For any clause, we can pick

two literals in it with opposite truth values and color the true literal 1 and the false literal 0. Let the

third node be 2.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING

ProblemSuppose we are given sets B, G, and H (boys, girls, and homes), each containing n elements and a

ternary relation T ⊆ B x G x H. We are asked to find a set of n triples in T , no two of which have a

component in common. In other words, each boy is matched to a different girl and each couple has

a home of its own.

Example

B H G

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

TheoremTRIPARTITE MATCHING is NP-complete.

Proof.We reduce 3SAT to it. For each variable xi , we construct a choice-consistency gadget. Let k be the

maximum number of occurrences of x and ¬x (i.e max{occ(xi ), occ(¬xi )}). We have k boys, k

girls, and 2k homes in this gadget. For each clause C, we construct a new triple (b, g, h) where h

is one of the literals in C, not joined by another triple. Suppose we have m clauses. Since

occ(xi ) + occ(¬xi ) ≤ 2ki , we have 3m ≤ |H|, where |H| is the number of homes. This means

there are at least 3m homes. The number of boys (or girls) is |H2 + m ≤ |H|. Introduce l more boys

and girls such that |B| = |G| = |H|. For each of the l boys and girls, add |H| triples that connect to

all homes.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

TRIPARTITE MATCHING (contd.)

h1

h2

h3

h4

h5

h6

h7

h8b1

g1

b2g2b3

g3

b4

g4

The choice-consistency gadget.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET COVERING

ProblemWe are given a family F = {S1, ..., Sn} of subsets of finite set U, and a budget B. We want a set of

B sets whose union is U.

CorollarySET COVERING is NP-complete.

Proof.This is a generalization of TRIPARTITE MATCHING. U can be partitioned into three equal sets B, G,

and H where each set in F contains one element from each.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET COVERING

ProblemWe are given a family F = {S1, ..., Sn} of subsets of finite set U, and a budget B. We want a set of

B sets whose union is U.

CorollarySET COVERING is NP-complete.

Proof.This is a generalization of TRIPARTITE MATCHING. U can be partitioned into three equal sets B, G,

and H where each set in F contains one element from each.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET COVERING

ProblemWe are given a family F = {S1, ..., Sn} of subsets of finite set U, and a budget B. We want a set of

B sets whose union is U.

CorollarySET COVERING is NP-complete.

Proof.This is a generalization of TRIPARTITE MATCHING. U can be partitioned into three equal sets B, G,

and H where each set in F contains one element from each.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET COVERING

ProblemWe are given a family F = {S1, ..., Sn} of subsets of finite set U, and a budget B. We want a set of

B sets whose union is U.

CorollarySET COVERING is NP-complete.

Proof.This is a generalization of TRIPARTITE MATCHING. U can be partitioned into three equal sets B, G,

and H where each set in F contains one element from each.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET PACKING

ProblemWe are given a family of subsets of a set U and a goal K . We want to see if there are K pairwise

disjoint sets in the family.

CorollarySET PACKING is NP-complete.

Proof.This is also a generalization of TRIPARTITE MATCHING. We partition U into three sets: B, G, and H.

We also let K = 3 and select one set from each of the partitions.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET PACKING

ProblemWe are given a family of subsets of a set U and a goal K . We want to see if there are K pairwise

disjoint sets in the family.

CorollarySET PACKING is NP-complete.

Proof.This is also a generalization of TRIPARTITE MATCHING. We partition U into three sets: B, G, and H.

We also let K = 3 and select one set from each of the partitions.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET PACKING

ProblemWe are given a family of subsets of a set U and a goal K . We want to see if there are K pairwise

disjoint sets in the family.

CorollarySET PACKING is NP-complete.

Proof.This is also a generalization of TRIPARTITE MATCHING. We partition U into three sets: B, G, and H.

We also let K = 3 and select one set from each of the partitions.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET PACKING

ProblemWe are given a family of subsets of a set U and a goal K . We want to see if there are K pairwise

disjoint sets in the family.

CorollarySET PACKING is NP-complete.

Proof.This is also a generalization of TRIPARTITE MATCHING. We partition U into three sets: B, G, and H.

We also let K = 3 and select one set from each of the partitions.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SET PACKING

ProblemWe are given a family of subsets of a set U and a goal K . We want to see if there are K pairwise

disjoint sets in the family.

CorollarySET PACKING is NP-complete.

Proof.This is also a generalization of TRIPARTITE MATCHING. We partition U into three sets: B, G, and H.

We also let K = 3 and select one set from each of the partitions.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

EXACT COVER BY 3-SETS

ProblemWe are given a family F = {S1, ..., Sn} of subsets of a set U where |U| = 3m for some integer m

and |Si | = 3 for all i . We want to see if there are m sets in F that are disjoint and have U are their

union.

CorollaryEXACT COVER BY 3-SETS is NP-complete.

Proof.This is a special case of SET COVERING where the universe has 3m elements, all sets in F have

three elements, and the budget is m.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

EXACT COVER BY 3-SETS

ProblemWe are given a family F = {S1, ..., Sn} of subsets of a set U where |U| = 3m for some integer m

and |Si | = 3 for all i . We want to see if there are m sets in F that are disjoint and have U are their

union.

CorollaryEXACT COVER BY 3-SETS is NP-complete.

Proof.This is a special case of SET COVERING where the universe has 3m elements, all sets in F have

three elements, and the budget is m.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

EXACT COVER BY 3-SETS

ProblemWe are given a family F = {S1, ..., Sn} of subsets of a set U where |U| = 3m for some integer m

and |Si | = 3 for all i . We want to see if there are m sets in F that are disjoint and have U are their

union.

CorollaryEXACT COVER BY 3-SETS is NP-complete.

Proof.This is a special case of SET COVERING where the universe has 3m elements, all sets in F have

three elements, and the budget is m.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

INTEGER PROGRAMMING

ProblemGiven a system of linear inequalities, where we have n variables and integer coefficients, do we

have an integer solution?

TheoremINTEGER PROGRAMMING is NP-Complete

Proof.We reduce NAE3SAT to this problem. Suppose we have the clause (x1, x2, x3). We can set up our

linear inequalities as x1 + x2 + x3 ≤ 2, x1 + x2 + x3 ≥ 1, and xi = {0, 1} where i = {1, 2, 3}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

INTEGER PROGRAMMING

ProblemGiven a system of linear inequalities, where we have n variables and integer coefficients, do we

have an integer solution?

TheoremINTEGER PROGRAMMING is NP-Complete

Proof.We reduce NAE3SAT to this problem. Suppose we have the clause (x1, x2, x3). We can set up our

linear inequalities as x1 + x2 + x3 ≤ 2, x1 + x2 + x3 ≥ 1, and xi = {0, 1} where i = {1, 2, 3}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

INTEGER PROGRAMMING

ProblemGiven a system of linear inequalities, where we have n variables and integer coefficients, do we

have an integer solution?

TheoremINTEGER PROGRAMMING is NP-Complete

Proof.We reduce NAE3SAT to this problem. Suppose we have the clause (x1, x2, x3). We can set up our

linear inequalities as x1 + x2 + x3 ≤ 2, x1 + x2 + x3 ≥ 1, and xi = {0, 1} where i = {1, 2, 3}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

INTEGER PROGRAMMING

ProblemGiven a system of linear inequalities, where we have n variables and integer coefficients, do we

have an integer solution?

TheoremINTEGER PROGRAMMING is NP-Complete

Proof.We reduce NAE3SAT to this problem. Suppose we have the clause (x1, x2, x3). We can set up our

linear inequalities as x1 + x2 + x3 ≤ 2, x1 + x2 + x3 ≥ 1, and xi = {0, 1} where i = {1, 2, 3}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

INTEGER PROGRAMMING

ProblemGiven a system of linear inequalities, where we have n variables and integer coefficients, do we

have an integer solution?

TheoremINTEGER PROGRAMMING is NP-Complete

Proof.We reduce NAE3SAT to this problem. Suppose we have the clause (x1, x2, x3). We can set up our

linear inequalities as x1 + x2 + x3 ≤ 2, x1 + x2 + x3 ≥ 1, and xi = {0, 1} where i = {1, 2, 3}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Knapsack Problem

ProblemThis is a special case of INTEGER PROGRAMMING. Select a set of n items, where item i has positive

value vi and positive weight wi , W is denoted as the weight limit of the items that can be picked,

and a goal K . We want to pick the set of items that gives us a total value of K or more without

exceeding W .

TheoremKNAPSACK is NP-complete.

Proof.We can reduce EXACT COVER BY 3-SETS to it. We are given an instance {S1, S2, ..., Sn} of EXACTCOVER BY 3-SETS to see if there are disjoint sets among the sets that cover U = {1, 2, ..., 3m}.Think of the sets as bit vectors in {0, 1}3m . For example, 001100010 is 3, 4, 8 and 110010000 is{1, 2, 5}. Set union would be binary addition. Our goal is to find a subset that gives us all ones.

What if we have a carry? Enlarge the base such that the base is no longer 2, but n + 1. We can

now get a set of all ones if and only if there is an exact cover among {S1, S2, ..., Sn}.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Outline

1 NP-Complete Problems in Graph TheoryBisectionHamilton Path and CircuitLongest Path and CircuitTSP (D)3-Coloring

2 Sets and NumbersTripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial

TheoremAny instance of KNAPSACK can be solved in O(nW ) time, where n is the number of items and W is

the weight limit.

Proof.We let V (w , i) be the largest value attainable by selecting some of the first i items so that the totalweight is exactly w . We can use dynamic programming with each entry of the table as follows:V (w , i + 1) = max{V (w , i), vi+1 + V (w − wi+1, i)}

We start by having V (w , 0) = 0 for all w . If we encounter V (W , n) ≥ K , then the given instance of

KNAPSACK is ”yes”.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial

TheoremAny instance of KNAPSACK can be solved in O(nW ) time, where n is the number of items and W is

the weight limit.

Proof.We let V (w , i) be the largest value attainable by selecting some of the first i items so that the totalweight is exactly w . We can use dynamic programming with each entry of the table as follows:V (w , i + 1) = max{V (w , i), vi+1 + V (w − wi+1, i)}

We start by having V (w , 0) = 0 for all w . If we encounter V (W , n) ≥ K , then the given instance of

KNAPSACK is ”yes”.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial

TheoremAny instance of KNAPSACK can be solved in O(nW ) time, where n is the number of items and W is

the weight limit.

Proof.We let V (w , i) be the largest value attainable by selecting some of the first i items so that the totalweight is exactly w . We can use dynamic programming with each entry of the table as follows:V (w , i + 1) = max{V (w , i), vi+1 + V (w − wi+1, i)}

We start by having V (w , 0) = 0 for all w . If we encounter V (W , n) ≥ K , then the given instance of

KNAPSACK is ”yes”.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial

TheoremAny instance of KNAPSACK can be solved in O(nW ) time, where n is the number of items and W is

the weight limit.

Proof.We let V (w , i) be the largest value attainable by selecting some of the first i items so that the totalweight is exactly w . We can use dynamic programming with each entry of the table as follows:V (w , i + 1) = max{V (w , i), vi+1 + V (w − wi+1, i)}

We start by having V (w , 0) = 0 for all w . If we encounter V (W , n) ≥ K , then the given instance of

KNAPSACK is ”yes”.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial

TheoremAny instance of KNAPSACK can be solved in O(nW ) time, where n is the number of items and W is

the weight limit.

Proof.We let V (w , i) be the largest value attainable by selecting some of the first i items so that the totalweight is exactly w . We can use dynamic programming with each entry of the table as follows:V (w , i + 1) = max{V (w , i), vi+1 + V (w − wi+1, i)}

We start by having V (w , 0) = 0 for all w . If we encounter V (W , n) ≥ K , then the given instance of

KNAPSACK is ”yes”.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial (contd.)

ObservationNote that KNAPSACK is not polynomial because the time bound nW is not polynomial. The length of

the input is more like n log W .

DefinitionA problem is strongly NP-complete if the problem remains NP-complete if any instance of length n

is restricted to contain integers of size at most p(n), a polynomial.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

KNAPSACK is Pseudopolynomial (contd.)

ObservationNote that KNAPSACK is not polynomial because the time bound nW is not polynomial. The length of

the input is more like n log W .

DefinitionA problem is strongly NP-complete if the problem remains NP-complete if any instance of length n

is restricted to contain integers of size at most p(n), a polynomial.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SUBSET SUM

ProblemGiven a set S = {a1, a2, ..., an} and value T , is there a subset S′ ⊆ S such that

P

ai∈S′ ai = T ?

LemmaSUBSET SUM is NP-complete.

Proof.We reduce KNAPSACK to this problem. Given an instance of KNAPSACK, we have n items with

values v1, ..., vn and weights w1, ..., wn , a weight limit W and a goal K . We want to solve the

equationsP

wi xi ≤ W andP

vi xi ≥ K where xi = {0, 1}. We simply let wi = vi and W = K to

give us the equationP

wi xi = K . A solution to this instance exists if and only if a solution exists for

SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SUBSET SUM

ProblemGiven a set S = {a1, a2, ..., an} and value T , is there a subset S′ ⊆ S such that

P

ai∈S′ ai = T ?

LemmaSUBSET SUM is NP-complete.

Proof.We reduce KNAPSACK to this problem. Given an instance of KNAPSACK, we have n items with

values v1, ..., vn and weights w1, ..., wn , a weight limit W and a goal K . We want to solve the

equationsP

wi xi ≤ W andP

vi xi ≥ K where xi = {0, 1}. We simply let wi = vi and W = K to

give us the equationP

wi xi = K . A solution to this instance exists if and only if a solution exists for

SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SUBSET SUM

ProblemGiven a set S = {a1, a2, ..., an} and value T , is there a subset S′ ⊆ S such that

P

ai∈S′ ai = T ?

LemmaSUBSET SUM is NP-complete.

Proof.We reduce KNAPSACK to this problem. Given an instance of KNAPSACK, we have n items with

values v1, ..., vn and weights w1, ..., wn , a weight limit W and a goal K . We want to solve the

equationsP

wi xi ≤ W andP

vi xi ≥ K where xi = {0, 1}. We simply let wi = vi and W = K to

give us the equationP

wi xi = K . A solution to this instance exists if and only if a solution exists for

SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SUBSET SUM

ProblemGiven a set S = {a1, a2, ..., an} and value T , is there a subset S′ ⊆ S such that

P

ai∈S′ ai = T ?

LemmaSUBSET SUM is NP-complete.

Proof.We reduce KNAPSACK to this problem. Given an instance of KNAPSACK, we have n items with

values v1, ..., vn and weights w1, ..., wn , a weight limit W and a goal K . We want to solve the

equationsP

wi xi ≤ W andP

vi xi ≥ K where xi = {0, 1}. We simply let wi = vi and W = K to

give us the equationP

wi xi = K . A solution to this instance exists if and only if a solution exists for

SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SUBSET SUM

ProblemGiven a set S = {a1, a2, ..., an} and value T , is there a subset S′ ⊆ S such that

P

ai∈S′ ai = T ?

LemmaSUBSET SUM is NP-complete.

Proof.We reduce KNAPSACK to this problem. Given an instance of KNAPSACK, we have n items with

values v1, ..., vn and weights w1, ..., wn , a weight limit W and a goal K . We want to solve the

equationsP

wi xi ≤ W andP

vi xi ≥ K where xi = {0, 1}. We simply let wi = vi and W = K to

give us the equationP

wi xi = K . A solution to this instance exists if and only if a solution exists for

SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

SUBSET SUM

ProblemGiven a set S = {a1, a2, ..., an} and value T , is there a subset S′ ⊆ S such that

P

ai∈S′ ai = T ?

LemmaSUBSET SUM is NP-complete.

Proof.We reduce KNAPSACK to this problem. Given an instance of KNAPSACK, we have n items with

values v1, ..., vn and weights w1, ..., wn , a weight limit W and a goal K . We want to solve the

equationsP

wi xi ≤ W andP

vi xi ≥ K where xi = {0, 1}. We simply let wi = vi and W = K to

give us the equationP

wi xi = K . A solution to this instance exists if and only if a solution exists for

SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

BIN PACKING

ProblemWe are given N positive integers a1, a2, ..., aN (the items), and two more integers C (the capacity)

and B (the number of bins). We want to see if we can partition the numbers into B subsets, each of

which has a total sum at most C.

TheoremBIN PACKING is NP-complete.

ProofWe reduce SUBSET SUM to this problem. Given an instance of SUBSET SUM with the set

S = {a1, a2, ..., an} where a1 ≤ a2 ≤ ... ≤ an , we let S1 = {a1, ..., a⌊ n2 ⌋},

S2 = {a⌊ n2 ⌋+1, ..., an}, and T =

P

ai∈S2ai . We let B = 2 and C = T . This gives us a solution to

the BIN PACKING problem if and only if we have a solution for SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

BIN PACKING

ProblemWe are given N positive integers a1, a2, ..., aN (the items), and two more integers C (the capacity)

and B (the number of bins). We want to see if we can partition the numbers into B subsets, each of

which has a total sum at most C.

TheoremBIN PACKING is NP-complete.

ProofWe reduce SUBSET SUM to this problem. Given an instance of SUBSET SUM with the set

S = {a1, a2, ..., an} where a1 ≤ a2 ≤ ... ≤ an , we let S1 = {a1, ..., a⌊ n2 ⌋},

S2 = {a⌊ n2 ⌋+1, ..., an}, and T =

P

ai∈S2ai . We let B = 2 and C = T . This gives us a solution to

the BIN PACKING problem if and only if we have a solution for SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

BIN PACKING

ProblemWe are given N positive integers a1, a2, ..., aN (the items), and two more integers C (the capacity)

and B (the number of bins). We want to see if we can partition the numbers into B subsets, each of

which has a total sum at most C.

TheoremBIN PACKING is NP-complete.

ProofWe reduce SUBSET SUM to this problem. Given an instance of SUBSET SUM with the set

S = {a1, a2, ..., an} where a1 ≤ a2 ≤ ... ≤ an , we let S1 = {a1, ..., a⌊ n2 ⌋},

S2 = {a⌊ n2 ⌋+1, ..., an}, and T =

P

ai∈S2ai . We let B = 2 and C = T . This gives us a solution to

the BIN PACKING problem if and only if we have a solution for SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

BIN PACKING

ProblemWe are given N positive integers a1, a2, ..., aN (the items), and two more integers C (the capacity)

and B (the number of bins). We want to see if we can partition the numbers into B subsets, each of

which has a total sum at most C.

TheoremBIN PACKING is NP-complete.

ProofWe reduce SUBSET SUM to this problem. Given an instance of SUBSET SUM with the set

S = {a1, a2, ..., an} where a1 ≤ a2 ≤ ... ≤ an , we let S1 = {a1, ..., a⌊ n2 ⌋},

S2 = {a⌊ n2 ⌋+1, ..., an}, and T =

P

ai∈S2ai . We let B = 2 and C = T . This gives us a solution to

the BIN PACKING problem if and only if we have a solution for SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

BIN PACKING

ProblemWe are given N positive integers a1, a2, ..., aN (the items), and two more integers C (the capacity)

and B (the number of bins). We want to see if we can partition the numbers into B subsets, each of

which has a total sum at most C.

TheoremBIN PACKING is NP-complete.

ProofWe reduce SUBSET SUM to this problem. Given an instance of SUBSET SUM with the set

S = {a1, a2, ..., an} where a1 ≤ a2 ≤ ... ≤ an , we let S1 = {a1, ..., a⌊ n2 ⌋},

S2 = {a⌊ n2 ⌋+1, ..., an}, and T =

P

ai∈S2ai . We let B = 2 and C = T . This gives us a solution to

the BIN PACKING problem if and only if we have a solution for SUBSET SUM.

Williamson NP-Completeness Proofs

Graph-Theoretic ProblemsSets and Numbers

Tripartite MatchingSet Covering,Set Packing, and Exact Cover by 3-SetsInteger ProgrammingKnapsackPseudopolynomial Algorithms and Strong NP-Completeness

NP-Complete Reduction Hierarchy

Circuit SATSAT

3SAT

NAE3SAT

Max Cut

3 Coloring

Max Bisection

Bisection Width

MAX2SAT

Independent Coloring

Node Cover Clique

Hamilton Path

Tripartite Matching

Subset Sum

Bin Packing

Set Packing

Set CoveringExact Cover by 3 Sets

Knapsack

TSP(D)Hamilton Circuit

Longest Path

Longest Circuit

Integer Programming

Williamson NP-Completeness Proofs