HAMPATH
- Input: An undirected graph $G$ and 2 nodes $s, t$
> HAMCYCLE
- Question: Does G contain a Hamiltonian path from $s$ to $t$?
- Input: A undirected graph $G$ and a nodes $s$
- Question: Does $G$ contain a Hamiltonian cycle starting at $s$?
I wish to show HAMCYCLE is NP-hard. I'll show this by doing $HAMPATH \leq_p HAMCYCLE$ since HAMPATH is known to be NP-complete.
Reduction is as follows: $(G, s, t) \to (G', s')$ where $s' = s$ and for $G'$ I will add one edge from $t$t to $s'$.
This is polynomial time because we are adding only an edge.s
If $(G, s, t) \in HAMPATH$, then we know there is a Hamiltonian path from $s$ to $t$, our graph $G'$ will be $(s', \dots, t)$ but since we addedif theres a edge from $t$ to $s'$hampath then
$(s', \dots, t, s')$, the reduction shows there a cycle, thus $(G',s') \in HAMCYCLE$.hamcycle
Now doing the converse, if $(G', s') \in HAMCYCLE$ then there exist a Hamiltonian cycle from $(s', ..., s')$ that visits every node and comes back to $s'$ meaning there istheres a node $t$ right before $s$ to make thishamcycle then clearly theres a Hamiltonian path, thus $(G, s, t) \in HAMPATH$.hampath
Above is my entire attempt. I was wondering if I could call on $t$ in my reduction since its not used as a input in HAMCYCLE?