{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

note11-1x2

# note11-1x2 - HC is N PC HC is N PC We have shown HC is in N...

This preview shows pages 1–4. Sign up to view the full content.

HC is NPC HC is NPC We have shown HC is in NP . We show HC is NP -hard by showing 3SAT P HC. Let F = C 1 C 2 ∧ · · · ∧ C m be an instance of 3-SAT. It has m clauses C i ( 1 i m ) on n variables x 1 , . . . x n . Each C i contains exactly 3 literals. We need to construct a graph G = ( V , E ) so that F is satisfiable if and only if G has a HC. The construction of G from F can be done by a polynomial time algorithm. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 2 / 27 HC is NPC di d i+1 Gi ai1 ai2 ai3 air ci1 ci2 ci3 cir bi1 bi2 bi3 bir di d i+1 Gi ai1 ai2 ai3 air ci1 ci2 ci3 cir bi1 bi2 bi3 bir di d i+1 Gi ai1 ai2 ai3 air ci1 ci2 ci3 cir bi1 bi2 bi3 bir (a) Geheral view of G (b) The component Gi (c) one possible path (d) Another possible path. d1 d2 d3 dn d n+1 G1 G2 Gn c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 3 / 27

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

View Full Document
HC is NPC G consists of a series blocks G 1 , . . . G n (Fig (a)). Each G i corresponds a variable . G i is shown in Fig b, where r = 4 m . G also has other vertices and edges (to be introduced later.) There are exactly two possible paths from d i to d i + 1 which passes through all vertices in G i . One path: use the edge ( d i , a i , 1 ) (Fig (c)) . (Note that in this case, the path must pass through the edge ( a i , 4 j - 2 , a i , 4 j - 1 ) for all j = 1 , 2 , . . . .) Another path: use the edge ( d i , c i , 1 ) (Fig (d)) . (Note that in this case, the path must pass through the edge ( c i , 4 j - 2 , c i , 4 j - 1 ) for all j = 1 , 2 , . . . .) Once the first edge is chosen, the entire path is uniquely determined. c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 4 / 27 HC is NPC So there are 2 n Hamiltonian paths going through G , corresponding to 2 n possible truth assignments to the variables x i , . . . c n . If a path enters G i by ( d i , a i , 1 ) then x i is assigned 1. If a path enters G i by ( d i , c i , 1 ) then x i is assigned 0. We next describe other vertices and edges in G . G has m other vertices c i , c 2 , . . . , c m . where c j corresponds to the clause C j in F . If the clause C j contains the variable x i , we add two edges from c j to a i , 4 j - 2 and a i , 4 j - 1 . If the clause C j contains ¯ x i , we add two edges from c j to c i , 4 j - 2 and c i , 4 j - 1 . Since C j contains exactly 3 literals, the vertex c j has degree 6 in G . This completes the description of G . c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 5 / 27
HC is NPC Example F = ( x 1 ¯ x 2 x 3 ) x 1 x 2 ¯ x 4 ) n = 4 , m = 2 , r = 2 m = 8 . The graph G corresponding to F is shown below. d1 d2 d3 d4 d5 c1 c2 G1 G2 G3 G4 c Xin He (University at Buffalo) CSE 431/531 Algorithm Analysis and Design 6 / 27 HC is NPC Observation If G has a HC C , then for each vertex c j , it must be included in C this way: C enters G i through d i . travels in G i , reach a vertex a i , 4 j - 2 (or c i , 4 j - 2 ). travels to c j , then returns to a i , 4 j - 1 (or c i , 4 j - 1 ).

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 13

note11-1x2 - HC is N PC HC is N PC We have shown HC is in N...

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

View Full Document
Ask a homework question - tutors are online