# A Useful List of NP-Complete Problems

### Graphs

Vertex Cover Decision Problem(VC): Given a graph G=(V,E) and a positive integer k, is there a subset V' of V of vertices which form a Vertex Cover for G with the size of V' no more than k. . (A Vertex Cover for G is a set of vertices with the property that every edge has at least one vertex from that set as an endpoint.)

Chromatic Number Decision Problem(CNDP): Given a graph G=(V,E) and a positive integer m is it possible to assign one of the numbers 1, 2, ..., m to vertices of G so that for no edge in E is it true that the vertices on that edge have been assigned the same number. (This is called the Chromatic Number Decision Problem because if you think of 1, 2, ..., m as representing distinct colors, then we are saying that we can “color” the vertices so no two vertices of the same color are connected by an edge. One of the most famous recent theorems in Mathematics was that for a graph that can be drawn on a plane with no overlapping edges four colors are sufficient to color that graph. This is usually called the four-color map theorem because one can think of a map of countries as being represented by a graph where countries are vertices and edges are drawn between any two countries which touch each other. Then the problem becomes whether you can color that map with four colors. For a planar graph, 4 colors suffice. This was proven with a very large use of computers.)

Clique Decision Problem (CDP):  Given graph G=(V,E) and a positive integer k, is there a subset V' of V such that V' contains at least k vertices and V' forms a clique. (A clique is a complete subgraph – that is, if you take that set of vertices V' then every pair of vertices in V' are connected by an edge in E. Thus, V' and those edges form a complete subgraph.)

Independent Set Decision Problem:  Given a graph G=(V,E) and a positive integer k, is there a subset V' of V of size at least k such that no two vertices in V' are connected by an edge in E. (Such a set of vertices is called an independent set for the graph.)

Hamiltonian Circuit (HCDP): Given a graph G=(V,E), does G contain a Hamiltonian Circuit. (A Hamiltonian Circuit is a Path starting in one vertex and ending in that vertex - hence a Circuit - that visits every intermediate vertex exactly once and visits every vertex in V.)

Directed Hamiltonian Circuit (DHCDP): Does directed graph G=(V,E) contain a Hamiltonian Circuit?

Hamiltonian Path Decision Problem (HPDP): Does graph G=(V,E) contain a Hamiltonian Path. (A Hamiltonian Path is a path that starts in one vertex, ends in another, and visits every other vertex in V exactly once.)

Directed Hamiltonian Path Decision Problem (HPDP): Does directed graph G=(V,E) contain a Hamiltonian Path. (A Hamiltonian Path is a path that starts in one vertex, ends in another, and visits every other vertex in V exactly once.)

Traveling Salesman Decision Problem (TSDP): Given a complete weighted graph G=(V,E) and a positive integer k, does graph G contain a Hamiltonian Circuit with total weight at most k.

Euclidean Traveling Salesman Decision Problem (ETSDP): Given a complete weighted graph G=(V,E) which satisfies the triangle inequality  and a positive integer k, is there a Hamiltonian Circuit for G with total weight less than or equal to k. (The triangle inequality says that for any three vertices v, w, and z the weight on <v,z> is less than or equal to the sum of the weights on <v,w> and <w,g>. This of course corresponds to the usual way things work in flat Euclidean Geometry.)

Graph Isomomorphism Decision Problem (GIDP): Given two graphs G=(V,E) and G'=(V',E'), is there a function f from V to V' such that f is one-to-one and onto and such that <v,w> is an edge in G if and only if <f(v),f(w)> is an edge in G'.

Subgraph Isomorphism Decision Problem: Given two graphs G=(V,E) and G'=(V',E') and a positive integer k, is there a function f from a subset V'' of V to a subset of V' which is 1-1 and such that the subgraph formed by V'' and all edges in G connecting edges in V'' is isomorphic to a subgraph of G'.

Longest Path Decision Problem: , Given a weighted graph G=(V,E) and a positive integer k, is there a simple path in G of length at least k? (Contrast this with shortest path!)

Longest Circuit Decision Problem: Given a weighted graph G=(V,E) and a positive integer k, is there a simple circuit in G of length at least k?

### Sets:

Partition Decision Problem (Partition): Given a sequence of positive integers S=m1, m2, ..., mn, is there a subsequence S' of S such that the sum of the integers in S' is equal to the sum of the integers in S-S'? (That is, can you "partion" S into two equal sum subsequences?)

3-dimensional Matching (3DM): Suppose you have three equal sized sets X, Y, and Z. Suppose we have a set of triples S a subset of XxYxZ. Is there a subset of S which contains each element of X, Y, and Z in a triple exactly once? (Notice that this is, essentially, like a 3-gender version of the marriage problem.)

Subset Sum: Given a set S of integers (both positive and negative), is there a subset S' such that the sum of the elements in S' is 0?

Set Cover Decision Problem (SCDP): Given a collection of subsets of positive integers S and a positive integer k, are there k or fewer subsets in S whose union is the union of all sets in S?

Exact Cover Decision Problem (Exact Cover): Given a collection S of subsets of X is there a subcollection S' of S such that each element of X occurs in exactly one of the subsets in S'? (Another way of saying this is: Is there a subcollection S' of S where the subsets in S' are all mutually disjoint and the union of the subsets of S' is X?)

0/1 Knapsack Problem (Knapsack): Given a set of positive integers {w1,w2,...,wn} (referred to as weights) and another set of positive integers {v1,v2,...,vn} and two positive integers W and V, can you find a subset S of the numbers 1 to n - say S={i1,i2,...,in} - such that the sum of the weights corresponding to the indices in S is no more than W and the sum of the values corresponding to the indices in S is at least V?

3-Partition: Given a set S of positive integers of size 3*m, can you divide S into m sets of 3 elements such that the sum of the numbers in each subset is equal?

Hitting Set Decision Problem (Hitting Set): Given a collection C of sets of positive integers and a positive integer k, can you find a single set S of positive integers of size at most k such that S has non-empty intersection with every set in C?

### Data Storage:

File Allocation: Given a set of m storage devices  with capacties C1, C2, ..., Cn and  a set of files of lengths L1, L2, ..., Ln, can you fit all of the files into those devices?

Bin packing: Given a set of objects of size S1, S2, ..., Sn and a positive integer  k and another positive integer V, can you fit the objects into k or fewer bins of size V?

2-tape problem: Given two storage devices of size V and a set of files of length L1, L2, ..., Ln and a positive integer M, can you allocate the files to the two devices so that the difference in length of files on the two devices is at most M?

### Sequences and Strings:

Longest Common Subsequence: Given two sequences S1 and S2 and a positive integer k, Is there a subsequence of S1 whcih is also a subsequence of S2 whose length is at least k? (For example, for the sequences abcadac and ebefagac there is a common subsequence baac.)

Shortest Common Supersequence: Given two sequences S1 and S2 and a positive integer k, is there a sequence of length at most k for which S1 and S2 are both subsequences. (For example, if the two sequences are abcadac and ebefagac, then a supersequence is aebcefagdac.)

### Database:

Boyce-Codd normal form violation: Given a set of tables in a relational database, do they violate Boyce-Codd normal form?

Conjunctive Boolean Query: Given a set of boolean queries R1(t1), ..., Rn(tn) on the tables forming database D where each Ri is a relation symbol and each ti is a tuple of variables and constants, does the conjunction of those queries evaluate to true? (I.e., is R1(t1)R2(t2)...Rn(tn) true? Note this is at least as tough as SAT.)

### Scheduling:

Job sequencing with deadlines: Given n jobs where job i has a deadline Di and a profit Pi  and a number P. Each job takes one unit time to complete. Can you find a subset i1, i2, ..., im of the numbers 1 to n such that each of the jobs j1, j2, ..., jm is processed by their deadline and such that the sum of the profits for those jobs is at least  P?

Sequencing with start times and deadlines:  Given n jobs, each with a minimum starting time, a deadline for completion, and a processing time as well as a positive integer M, can you find a way to distribute those jobs to M processors so that they all finish by their deadlines and start after their start times?

Multiprocessor scheduling: Given N jobs, each requiring a given amount of time to run t1, t2, ..., tN and P processors and a positive integer T, can you assign the jobs to the P processors in such a way that all jobs are done by time T?

Job-shop scheduling: Given jobs 1,..., N such that job j has nj activities which must be completed in order and where each activity requires 1 time unit to complete and M machines with capacity 1 job at a time and a positive integer T, can you assign the tasks for the jobs to the M machines in such a way that the order of the nj tasks is maintained for each job and such that the total time required is at most T?

Deadlock avoidance: Given a set of N jobs which share M variables, can you schedule the jobs in such a way as to avoid Deadlock?

### Games: An appropriately resized version of each of these represents an NP-complete problem.

Battleship, Master Mind, FreeCell, Minesweeper Consistency Problem, Sudoku, Tetris

### Logic:

Conjunctive Normal Forrm Satisfiability (CNFSAT or SAT): Given a logical expression in Conjunctive Normal Form (i.e., product of sums), is there an assignment to the variables which can make the expression true?

3-term Conjunctive Normal Form Satisfiability (3CNFSAT): Given a logical expression in Conjunctive Normal Form where each sum contains exactly three terms, is there an assignment to the variables which can make the expression true?

Disjunctive Normal Form Tautology (DNFTAUT): Is the logical expression in Disjunctive Normal Form (i.e., a sum of products) a tautology - i.e., true for every truth value assignment to the variables in the expression? (Note that this is the complement of SAT since the not of a CNF expression is automatically a DNF expression.)

### Code Generation:

Feasible Register Assignment: Suppose we have a program which we are compiling with N variables that require storage. Suppose we have m<N CPU registers. Suppose further we have a positive integer T. Can you determine a way to assign variables to registers throughout the running of the program so that the total running time is at most T? (Note that access and manipulation of registers is assumed to be faster than access and manipulation of things in memory.)