Download presentation

Presentation is loading. Please wait.

1
Example: HP ≤ p HC Hamiltonian Path –Input: Undirected Graph G = (V,E) –Y/N Question: Does G contain a Hamiltonian Path? Hamiltonian Cycle –Input: Undirected Graph G = (V,E) –Y/N Question: Does G contain a Hamiltonian Cycle?

2
Specification of R(x) Consider any undirected graph G = (V,E) as input x R(x) will be a graph G’ = (V’, E’) where –V’ = V union {v} where v is not in V –E’ = E union {(v,w) | w in V} Argument that R(x) has polynomial size –We add exactly 1 node and |V| edges.

3
x is yes R(x) is yes Suppose graph G has a Hamiltonian Path Let this path be v 1, v 2, …, v n We now argue that v 1, v 2, …, v n, v is a Hamiltonian Cycle in G’ –First, all nodes in V’ are included exactly once above or else v 1, v 2, …, v n would not be a HP in G –Since G’ has all the edges that G has, (v i,v i+1 ) is an edge in E’ for 1 ≤ i ≤ n-1 –Finally, since E’ contains edge (v,w) for all w in V, it must be the case that E’ contains edges (v n, v) and (v,v 1 ).

4
R(x) is yes x is yes Suppose graph G’ has a Hamiltonian Cycle Let this cycle be v 1, v 2, …, v n, v We now argue that v 1, v 2, …, v n is a Hamiltonian Path in G –First, all nodes in V are included exactly once above or else v 1, v 2, …, v n, v would not be a HC in G’ –Since the only extra edges in E’ compared to E are edges involving node v, it must be the case that E contains edge (v i,v i+1 ) for 1 ≤ i ≤ n-1

5
Turing Reducibility Steve made a suggestion for an alternate reduction. Given graph G, output (n 2 ) graphs G v,w = (V,E v,w ) where –E v,w = E union {(v,w)} where v,w are nodes in V This is not a polynomial-time reduction because we are outputting (n 2 ) graphs. However, this idea can be used to show that if HC can be solved in polynomial time, then HP can be solved in polynomial time. –Run each graph G v,w through our procedure that solves HC. –If HC says yes for any one of these graphs, return yes. –Otherwise return no. This more general reduction is often called a Turing reduction. We allow ourselves to use the procedure that solves HC (or 2 ) a polynomial number of times rather than just once.

Similar presentations

© 2021 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google