GATE / CS ARCHIVE

GATE CSE 2006 / QUESTION 31

Hamiltonian cycles on a multiple of three vertices

Theory of Computation · Complexity & Reductions · Full GATE CSE 2006 paper

GATE 2006, Q31 2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Complexity & Reductions

Question 31, GATE 2006: Restrict undirected graphs G=(V,E) to |V| divisible by 3. SHAM₃ is the problem of finding a Hamiltonian cycle; DHAM₃ asks whether one exists. Which statement is true?
Options:
(A) Both DHAM₃ and SHAM₃ are NP-hard
(B) SHAM₃ is NP-hard but DHAM₃ is not
(C) DHAM₃ is NP-hard but SHAM₃ is not
(D) Neither is NP-hard
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. The vertex-count restriction does not remove NP-hardness. Reduce an undirected Hamiltonian-cycle instance by replacing each original vertex with a three-vertex path.

2. For each original edge uv, connect each endpoint of u’s path to each endpoint of v’s path. The middle vertices have degree 2, so any Hamiltonian cycle must traverse each replacement path; contracting the paths recovers a Hamiltonian cycle of the original graph.

3. Conversely any original cycle expands through all paths. The new graph has 3|V| vertices.

4. Therefore decision DHAM3 is NP-hard; a polynomial search algorithm that returns a cycle or reports none would decide it, so SHAM3 is NP-hard as well, A.

5. Teaching check: The middle vertex in each three-vertex replacement path has degree two, forcing both its incident edges into any Hamiltonian cycle. Hence the whole path acts as one original vertex when contracted. This gives an explicit polynomial reduction rather than assuming a divisibility restriction preserves hardness.

Original paper, page 4