Lecture 29: Handling NP-Complete Problems
There are two general strategies for dealing with those recalcitrant NP-complete problems. You can either take advantage of special characteristics of the problem, or you can come up with an approximate solution. In this lecture, we will be looking at the former.
Imagine what happens when you run Independent Set on a Tree:

The nodes of the indepent set are labelled in red. How do we get an independent set for a tree? Simply, choosing the leaves first is optimal:
Let T = (V, E) be a tree and v be a leaf vertex. I claim that there is a maximum size independent set that contains v. Consider a max size independent set S. If v is in S, we are done. Assume v is not in S. Let u be a parent of v. If u is not in S, we can put v in S instead to get a larger independent set. If u is in S, we can take out u and put v into S to get S’, an independent set of same size = max size.
Here is an algorithm:
Place all leaves into S
while S is not empty {
Color the leaves
Delete leaves and parents
}
You can implement this in linear time using DFS–and even if your graph is not a tree, it still may have some tree-like pieces.
Sample NP-Complete Reductions:
Given n processes and m resources:
a) Each process needs several resources at once. Is there a way for k processes to be active at the same time?
Some ideas include Set Packing, Independent Set. To do it with Set Packing, you would ask if there are k subsets of processes that don’t intersect over resources.
b) Special case of (a) where k = 2.
c) Special case of (a) where there are 2 types of resources and processes require at most one of each type.
d) Each resource is requested by at most 2 processes.
This entry was posted on Wednesday, April 6th, 2005 at 7:15 pm and is tagged with independent set, m resources, approximate solution, linear time, max size, maximum size, vertex, algorithm, graph, np, nbsp, leaves, parents. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.
Leave a Reply
Please take time to enjoy the archives: May 2005 (1) April 2005 (11) March 2005 (11) February 2005 (15) January 2005 (7)
Fresh, related resources:
- How to create fully encapsulated Domain Models
Otherwise, we?ll be continuously creating bNP complete problems/b for ourselves around software stability and correctness. Well, that?s been my experience anyway. Yoni Rapoport Says: March 19th, 2008 at 3:38 pm. Udi, b.../b - Shtetl-Optimized » Blog Archive » Australian actresses are b.../b
You are citing Democritus in your blecture/b and the ad agency is citing him as well in their ad. What the hell is the bproblem/b with that? mick Says: Comment #72 October 2nd, 2007 at 2:b29/b pm. Ha! This has been quite possibly the funniest b.../b - Free Science and Video bLectures/b Online!: Free Computer Science b.../b
Techniques such as approximation and probabilistic algorithms are studied for bhandling/b the bNP-Complete problems/b. Introduction to Algorithms. Video blectures/b: 6.064J/18.410J (MIT); Course homepage. This course teaches techniques for the b.../b - bLecture 29/b: bHandling NP-Complete Problems/b by COMS 482
bLecture 29/b: bHandling NP-Complete Problems/b. Posted in Class Notes by Elliott Back on April 6th, 2005. [Del.icio.us]. There are two general strategies for dealing with those recalcitrant bNP-complete problems/b. You can either take advantage b.../b
