Lecture 27 Summary

This lecture provides an introduction to the concept of NP-completeness. It's a theoretical, challenging topic, and there are no activity slides. Since there are no activity slides, you will want to stop the video often, to allow students to respond to questions posed in the lecture, and to allow students the opportunity to ask questions of their own.



For the rest of the term, we will discuss NP completeness.

The instructor makes some announcements, including the topics for the final exam, so you might want to show this. The instructor says that NP completeness WILL be on the final exam.


Until now, we have shown what we CAN do efficiently by finding algorithms to do it. Now we will look at how to prove that you CAN'T do something efficiently. This is harder.

At 3:55, the instructor asks, "If I asked you to prove to me that you can't multiply matrices in n^2 time, how would you do it?" There is no response. You probably don't need to stop here, since the point is that there is no known proof of this.


The theory of NP-completeness is what we use to prove that things can't be done efficiently.

At 5:45, the instructor says, "if you want to become famous, prove that P=NP or P!=NP" A student comments, "What about money?" This is not important.

At 6:38, the instructor asks, "How much do you know about NP-completeness?" A discussion of specific courses at the UW follows. This is not important.





An independent set is a set of vertices with no edges between them.

At 13:40, the instructor asks, "Does this graph have an independent set of size 3?" A student responds, "Yes, the top vertex and the two bottom vertices." This is wrong, there is no idependent set of size 3 in this graph. Stop here for student response.


A certificate is an instance of what we are trying to find. So if someone asks, "Does this graph have an independent set of size 3?" and you prove that there is one by showing them the independent set, that independent set is a certificate.

At 17:56, the instructor asks, "If the graph has a Hamiltomian Circuit, how would you convince me that it does?" A student responds, "I'd show it to you." Stop here to let students respond.

At 18:20, the instructor asks, "Does this graph have a Hamiltonian Circuit?" A student responds, "Yes," and describes the Hamiltonian Circuit. Stop here to let students respond.



At 21:30, the instructor asks, "Why is this?" (referring to the text of the slide.) A student responds, "Because if we can reduce Y to X in polynomial time and we can solve X in polynomial time, then we have a polynomial-time algorithm to solve Y."

So we can use reducibility to say that if Y reduces to X then if X is easy then Y is easy. This leads into the next slide.


So we want to be able to say that if Y reduces to X, then if Y is hard, then X is hard.

At 24:15, the instructor asks, "How would we prove this?" A student responds, "If X could be solved in polynomial time, then Y could be solved in polynomial time, which contradicts our assumption." Stop here to let students respond

The instructor notes that it is a very common mistake to prove that the problem they are trying to prove is NP-complete reduces to a known NP-complete problem. This proves nothing. You must prove that the known NP-complete problem reduces to the problem they are trying to prove is NP-complete.


At 28:20, the instructor asks, "If I want to show that Z is NP-complete, what do I want to show?" The student response is hard to hear, but the instructor repeats it.


The instructor makes the point that it is interesting that an NP-complete problem exists at all. There is no reason that there should be a problem that all other problems in NP reduce to. But this is what Cook proved.



At 33:40, a student comments, "It seems very fast to go from introducing the idea of NP to finding an NP-complete problem in only 3 years." It's hard to hear but the instructor repeats it.

The word "cryptic" means "hard to understand."


Cook's theorem gives us a starting point. Once we have 1 NP-complete problem, we can use reductions to prove that other problems are NP-complete.

3-Sat is the problem of determining satisfiability of formulas in conjunctive normal form with 3 variables per clause.

A formula is "satisfiabile" if there is some assignment of truth values to the variables such that the formula evaluates to true.

The instructor shows the tree which demonstrates which NP-complete problems were used to prove which other problems were NP-complete.

The instructor refers to the "clique" problem (pronounced "cleek"). This is the problem of finding all complete subgraphs of a given graph.

The "Travelling Salesman" problem is the problem of finding the shortest path that connects all vertices in a graph, ending at the start vertex.

At 46:26, the instructor asks, "Have we discussed subset sum before?" There is no response. The instructor explains that we talked about it when we discussed the knapsack problem, and he explains how NP-complete version is different.

The take-away from today's lecture is that it's useful to know how to prove that something is NP-complete. If you are working on a problem that you know is NP-complete, you can start looking at ways to approximate, etc, instead of wasting time looking for an efficient algorithm that doesn't exist.