Download presentation
Presentation is loading. Please wait.
Published bySusan Greer Modified over 9 years ago
1
Hamiltonian Path Problem This girl do this presentation. :) Teddy bear work along with me. Jeff help me understand the topic. Are they both cute?
2
Hamiltonian Path Problem in a Directed Graph Given a Directed Graph G, node s and t. Given a Directed Graph G, node s and t. s t Yes Hamiltonian Path is a path from s to t and go through every node in G exactly once. DHamPath DHamPath NP-Complete
3
Step 0: DHamPath NP Design poly-time algorithm Valid DHamPath (, P) which determines whether a path P is a Hamiltonian Path for. Therefore, DHamPath Therefore, DHamPath NP Check if P starts at s and end at t. All nodes in G appear in P exactly once. None appear twice in P. Go through P and check if each edge of P is in the G.
4
DHamPath P easier ≤ poly DHamPath P easier NP-Complete 3SAT Step 1: What to reduce it to
5
Step 2: What is What 3SAT Problem: Given an expression E: Does it have a satisfying assignment ? DHamPath: Given a directed graph G, s and t: Does it have a Hamiltonian Path from s to t? s t (x OR y OR z) AND (x OR w OR a) AND …
6
Given an oracle for DHAMPath, how can we solve 3SAT? Step 3: Direction of reduction & Code
7
3SAT( Expression ) = DHAMPATH( ) Step5 Oracle will do it for us Step 6 & 7 Step 8 & 9
8
Step 5: Instance Map Expression Suppose we have K variables and L clauses in the expression. From C 1 to C L in Expression From left to right in the diamond. For each clause C j, Use a pair of two adjacent nodes to represent it.... For each variable x i, we construct a variable diamond x i. Clause iClause i+1 xixi
9
Step 5: Instance Map Between each clause C j, use one spearator node to separate them.... xixi
10
Step 5: Instance Map xixi Since we have L clauses, we have 3L+1 nodes....
11
Step 5: Instance Map If we’d like to go through all nodes in variable diamond Xi EXACTLY ONCE. xixi... ONLY TWO WAYS.
12
Step 5: Instance Map We have K variable diamonds ……. x i+1 x i-1 xixi...
13
For each clause Ci,...... AND (x OR w OR a) AND … Step 5: Instance Map CiCi a CiCi... W x we use one node.
14
Step 3: Direction of reduction & Code 3SAT( Expression ) = DHAMPATH( ) Step5 Oracle will do it for us Step 6 & 7 Step 8 & 9
15
Step 6: Solution Map Sol 3sat = SolutionMap( Sol DHam )... Xi True Xi False In variable diamond X i,
16
Step 3: Direction of reduction & Code 3SAT( Expression ) = DHAMPATH( ) Step5 Oracle will do it for us Step 6 & 7 Step 8 & 9
17
Step 7: Valid to Valid Prove:A valid Sol DHam Sol 3sat is valid. Expression Yes That is, if we have a Hamiltonian Path, the expression will be true according to the mapping of variables.
18
If we have a Hamiltonian Path, it must go through every node once. So, it must go through every node in every variable diamond X i. xixi... Step 7: Valid to Valid
19
We have K diamonds …….... Step 7: Valid to Valid
20
Hamiltonian Path must go through each clause node Ci....... AND (x OR w OR a) AND … CiCi a CiCi... W x Step 7: Valid to Valid
21
We cannot have a Hamiltonian Path like that....... AND (x OR w OR a) AND … CiCi a CiCi... W x Step 7: Valid to Valid
22
If we have Hamiltonian Path like that:... CiCi Step 7: Valid to Valid
23
... CiCi Step 7: Valid to Valid If we have Hamiltonian Path like that:
24
If there is a Hamiltonian Path, every clause nodes will belong to either one of two cases:... CiCi CiCi Step 7: Valid to Valid X i = True. xjxj xixi... AND (x i OR w OR a) AND … X j = False. CiCi... AND ( b OR x j OR a) AND … CiCi
25
Step 3: Direction of reduction & Code 3SAT( Expression ) = DHAMPATH( ) Step5 Oracle will do it for us Step 6 & 7 Step 8 & 9
26
Sol DHam Sol 3sat Expression Yes If there is a satisfiable assignment, we will have a Hamiltonian Path in. Step 8 & 9: Reverse Solution Map
27
If there is a satisfiable assignment, For each variable diamond Xi, Step 8 & 9: Reverse Solution Map... X i = True. xjxj X j = False.... We have K variables. Go through them one by one from top to bottom. It is a Hamiltonian Path.
28
For each clause Ci,... AND (x OR w OR a) AND … Step 8 & 9: Reverse Solution Map at least one variable make it true. Choose one.
29
Step 8 & 9: Reverse Solution Map... CiCi CiCi... AND (x OR w OR a) AND … a x w
30
Step 3: Direction of reduction & Code 3SAT( Expression ) = DHAMPATH( ) Step5 Oracle will do it for us Step 6 & 7 Step 8 & 9
31
Question?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.