lect28-npcomplete-reductions - Lecture Notes CMSC 251 Here...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture Notes CMSC 251 Here is how you might do this. Given an undirected graph G , create a directed graph G by just replacing each undirected edge { u, v } with two directed edges, ( u, v ) and ( v, u ) . Now, every simple path in the G is a simple path in G , and vice versa. Therefore, G has a Hamiltonian cycle if and only if G does. Now, if you could develop an efficient solution to the DHC problem, you could use this algorithm and this little transformation solve the UHC problem. Here is your algorithm for solving the undirected Hamiltonian cycle problem. You take the undirected graph G , convert it to an equivalent directed graph G (by edge-doubling), and then call your (supposed) algorithm for directed Hamiltonian cycles. Whatever answer this algorithm gives, you return as the answer for the Hamiltonian cycle. UHC to DHC Reduction bool Undir_Ham_Cycle(graph G) { create digraph G’ with the same number of vertices as G for each edge {u,v} in G { add edges (u,v) and (v,u) to G’ } return Dir_Ham_Cycle(G’) } You would now have a polynomial time algorithm for UHC. Since you and your boss both agree that this is not going to happen soon, he agrees to let you off. Nonhamiltonia n Ha miltonian Figure 37: Directed Hamiltonian cycle reduction. Notice that neither problem UHC or DHC has been solved. You have just shown how to convert a solution to DHC into a solution for UHC. This is called a reduction and is central to NP-completeness. Lecture 28: NP-Completeness and Reductions (Thursday, May 7, 1998) Read: Chapt 36, through Section 36.4. Summary: Last time we introduced a number of concepts, on the way to defining NP-completeness. In particular, the following concepts are important. Decision Problems: are problems for which the answer is either “yes” or “no.” The classes P and NP problems are defined as classes of decision problems. P: is the class of all decisions problems that can be solved in polynomial time (that is, O ( n k ) for some constant k ). 86 Lecture Notes CMSC 251 NP: is defined to be the class of all decision problems that can be verified in polynomial time. This means that if the answer to the problem is “yes” then it is possible give some piece of information that would allow someone to verify that this is the correct answer in polynomial time. (If the answer is “no” then no such evidence need be given.) Reductions: Last time we introduced the notion of a reduction. Given two problems A and B , we say that A is polynomially reducible to B , if, given a polynomial time subroutine for B , we can use it to solve A in polynomial time. (Note: This definition differs somewhat from the definition in the text, but it is good enough for our purposes.) When this is so we will express this as A ≤ P B....
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.

Page1 / 6

lect28-npcomplete-reductions - Lecture Notes CMSC 251 Here...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online