<p>Homework #31 sample solution:</p><p>9-15.</p><p>Problem: Hamiltonian path Input: A graph G, and vertices s and t Output: Does G contain a path which starts from s, ends at t, and visits all vertices without visiting any vertex more than once?</p><p>To prove Hamiltonian path is NP-complete, we show that Hamiltonian path is both in NP and NP-hard (by reducing Hamiltonian cycle to Hamiltonian path).</p><p>Hamiltonian path is in NP because we have a polynomial-time verifier with a path as certificate. The verifier will check if the path is a Hamiltonian path.</p><p>To show Hamiltonian path is NP-hard, we reduce Hamiltonian Cycle to it: Let G = (V, E) be a directed graph. Take any vertex u in V, let V’ = V – { v } U { v1, v2 } and</p><p>E’ = E U { (v1, u) | (v, u) in E } U { (u, v2, u) | (u, v) in E}. Let G’ = (V’, E’). It’s obvious that G’ can be constructed in polynomial time.</p><p>Claim: G has a Hamiltonian cycle iff G’ has a Hamiltonian path.</p><p>Proof of the claim is omitted here.</p>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages1 Page
-
File Size-