170 likes | 363 Views
Reduction Techniques. Restriction Local Replacement Component Design. Restriction. Show that a special case of the problem you are interested in is NP-complete. For example: Long Path Problem Input: Graph G = (V,E), Integer k
E N D
Reduction Techniques • Restriction • Local Replacement • Component Design
Restriction • Show that a special case of the problem you are interested in is NP-complete. • For example: • Long Path Problem • Input: Graph G = (V,E), Integer k • Yes/No Question: Does G have a simple path of length at least k? • What special case of this problem is another problem we have considered?
Local Replacement • Make many independent (non-interacting) local changes to the structure. • Example: Reducing SAT to 3SAT • Work on each clause of the SAT instance independently as follows
Easy Cases • Suppose a clause contains k literals: • if k = 1 (meaning Ci = {z1} ), we can add in two new variables v1 and v2, and transform this into 4 clauses: • {v1, v2, z1} {v1, v2, z1} {v1, v2, z1} {v1, v2, z1} • if k = 2 ( Ci = {z1, z2} ), we can add in one variable v1 and 2 new clauses: {v1, z1, z2} {v1, z1, z2} • if k = 3 ( Ci = {z1, z2, z3} ), we move this clause as-is.
Harder Case if k > 3 ( Ci = {z1, z2, …, zk} ) we can add in k - 3 new variables (v1, …, vk-3) and k - 2 clauses: {z1, z2, v1} {v1, z3, v2} {v2, z4, v3} … {vk-3, zk-1, zk} Thus, in the worst case, n clauses will be turned into n2 clauses. This cannot move us from polynomial to exponential time.
Component Design • These are the more elaborate problems where we design complex interacting components • Examples: • Reducing 3SAT to independent set • Reducing independent set to Hamiltonian Cycle
Truth Assignment Component For each variable, we can create two vertices: … v1v1 v2v2 v3v3 vnvn If we connect a variable and its negation, we can be sure that only one of them is in the independent set. We will set our integer bound for independent set to force one vertex from each pair to be chosen.
Clause Component … v1v1 v2v2 v3v3 vnvn For each clause, we create a triangle: v1 v2 v4 v3v7 v3v4 v5v6 At most one vertex in a triangle can be in the independent set. We will set our integer bound for independent set to force one vertex from each triangle to be chosen.
Opposing literals rule C = {v1, v2, v3} , {v1, v2, v4} , {v2, v4, v5} , {v3, v4, v5} v1v1 v2v2 v3v3 v4v4 v5v5 v2 v1 v2 v3 v1v3 v2v4 v4v5 v4v5
u v v u Vertex Cover to Ham Cycle Edge Component: For every edge in the Minimum Vertex Cover problem, we create a component in the Hamiltonian Cycle Problem: u v
Observations…. u v u v u v v v u u v u There are only three possible ways that a cycle can include all of the vertices in this component. Key property: If a path enters v (u), it leaves on v’ (u’)
u v Node Selection All components that represent edges connected to node u are strung together into a chain. If there are V vertices, then we will have V of these chains, all interwoven. Choosing a node u corresponds to traversing such a chain u v w u w u u x x u
y v u w y v u w v u y w v u z x v u z v u x Vertex cover = (v,u) x z v u
y v u w y v u w v u y w v u z x v u z v u x Vertex cover = (v,w,x) x z v u
Tying the Chains Together If we want to know if its possible to cover the original graph using only k vertices, this would be the same as seeing if we can include all of the vertices using only k chains. How can we include exactly k chains in the Hamiltonian Cycle problem? We must add k extra vertices and connect each of them to the beginning and end of every chain. Since each vertex can only be included once, this allows k chains in the final cycle.