Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible for a graph to have a cycle that goes through all the nodes, but it does not have a Hamiltonian cycle (i.e. the cycle goes through some nodes more than once)? If yes, can anyone prove it? If not, can anyone give a counterexample?

share|cite|improve this question
up vote 7 down vote accepted

Just pick a tree which - by definition - doesn't have any simple cycle, but is connected, so you can visit all the nodes and return to the starting one but you must pass on some nodes more than once.

There are also graphs which have an Eulerian cycle (a cycle that traverses every edge exactly once) but not an Hamiltonian cycle. For example pick a graph made with two triangles having one vertex in common.

share|cite|improve this answer
Indeed for the first kind (a closed walk), any connected graph is sufficient. – Luke Mathieson Nov 6 '12 at 0:23
ahh thanks! i wonder why that didn't come to me... – Aden Dong Nov 6 '12 at 3:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.