Lecture 29 Summary

This is the final lecture for the course. It is also 15 minutes shorter than a normal lecture.



In this lecture, the instructor completes his discussion of NP-completeness, and gives a quick course summary.


The instructor reviews that the way that we prove that something is NP-complete is to reduce a known NP-complete problem to our problem. It is a very common mistake to get the direction on this wrong; don't reduce your problem to the known NP-complete problem!


This is an activity slide. You can stop the video at 3:40.

If necessary, you can clarify that we are looking for a reduction from Hamiltonian Circuit to Hamiltonian Path.

The instructor introduces the Hamiltonian Path problem. This problem asks for a path from a vertex s to a vertex t that visits each vertex of the graph exactly once.

At 3:40, the instructor asks, "How do we prove that the Hamiltonian Path problem is NP-complete?" There is no response. At 3:57, he asks, "The first step is to decide what problem we will reduce to Hamiltonian Path. What problem should we use?" A student responds, "Hamiltonian circuit."

At 5:06, the instructor asks, "How do we convert a Hamiltonian Circuit problem into a Hamiltonian Path problem?" A student responds, "Pretend t doesn't exist, and put any edge that goes into t into s instead." The instructor responds that this reduction is in the wrong direction.


The idea is that we choose some vertex v, and split it into two vertices, v' and v'', then add all of the edges of v to both v' and v''. We then find a Hamiltonian Path from v' to v''. This corresponds to a Hamiltonian Circuit in the original graph.


This is an activity slide. You can stop the video at 8:35.

At 8:35, the instructor asks, "How do we convert an instance for an undirected graph into an instance for a directed graph?" A student responds, "Replace every undirected edge with two directed edges, one in each direction."


This is an activity slide. You can stop the video at 10:40.

From looking at the slide, it's not very clear what the instructor is asking for. The instructor is asking how hard each of the three stated problems is. The point here is that what you fix in the problem statement and what you leave as input into the problem makes a huge difference in the complexity of the problem.

At 10:44, the instructor asks, "How hard is the first problem?" A student responds, "Easy. The answer is yes." Another student comments, "Only if there is a vertex that doesn't have a self-loop."

At 11:19, the instructor asks, "How hard is the second problem?" A student responds, "If the graph has fewer than 7 vertices, we can say no." The instructor responds, "OK, assume the graph has size larger than 7." There is a pause. Then the instructor asks, "How many candidates for an independent set of size 7 are there?" The instructor answers his own question: "n choose 7." So we could write a program that was just 7 nested loops that iterated over all possible sets of 7 vertices, and this would be an O(n^7) algorithm. Thus this problem is in P.

At 13:10, the instructor asks, "Is there a polynomial-time algorithm for finding an independent set of size 1000?" A student responds, "Yes, it's just O(n^1000)"


This problem is NP-complete even if you fix k=3.

At 14:49, the instructor asks, "What about 2-coloring?" A student responds, "This is bipartite graph." You should stop here to let students respond.

The instructor notes that there are a lot of problems that are in P if n=2, but NP-complete if n=3.


The instructor notes that we had a Dynamic Programming algorithm for subset-sum even though subset-sum is NP-complete. This is because the Dynamic Programming algorithm is not necessarily a polynomial-time algorithm. The Dynamic Programming algorithm is only efficient if W is not large.


The instructor gives the idea behind the reduction to subset sum.


The word "succinct" means small or short.


"Asymmetry" means uneven or unbalanced.

At 21:25, the instructor asks, "How would you prove that a graph doesn't have a Hamiltonian Circuit?" A student responds, "Write down all possible circuits." The instructor notes that this would take exponential time. You should stop here.

The point here is that if you have a solution to an NP-complete problem, it's easy to prove that it's a solution. It's hard to show that there is no solution to an NP-complete problem.

The instructor says that there is a class called Co-NP where the opposite is true; it's easy to prove that there isn't a solution and hard to prove that a solution is valid.

At 23:15, a student asks for an example of a problem in Co-NP. The instructor responds with "Not-Hamiltonian" and "Tautology". A tautology is a logical formula that is always true.


Since no one has proven that P != NP, it is possible that there are polynomial-time algorithms for NP-complete problems.

At 25:20, the instructor asks, "What grounds do we have to claim that NP-Complete problems can't be solved in polynomial time?" The instructor answers his own question. You may want to stop here.

At 26:29, a student comments "This was bothering me. We do all of these reductions, but if someone found an efficient algorithm for one of these problems, the whole thing collapses." The instructor repeats the point.

At 27:37, a student asks, "Is there a proof by smart people?" This isn't important.


The instructor discusses the final. The instructor says that things that were in the lecture but not the book could be on the exam, and things from the homework that weren't in the lecture could be on the exam, but things that were just in the book will not be on the exam.