# How many Hamiltonian circuits are there in a complete graph with n vertices? [duplicate]

This question already has an answer here:

How many Hamiltonian circuits are there in a complete, undirected and simple graph with $n$ vertices?

The answer written in my book is: $$\frac{\left(n-1\right)!}{2}$$

What is the combinatorial explanation to this?

My best shot was to try to count for each size of Hamiltonian circuit (triangles, quadrilaterals, pentagons and so on), how many of each there is, and to sum them. So I tried to count for each amount of edges the amount as possibilities, to complete it to the mentioned shapes.

I mean for n vertices, I choose any 2 vertices (that's an edge) and for each other vertex by connecting from each vertex from my edge by new edges, I can create a triangle, which is a Hamiltonian circle of size 3 and so on. But there are a lot of repeats and that's a mess.

Maybe I didn't get the point at all, because the expression: $$\frac{\left(n-1\right)!}{2}$$

seems to be to me no more than the amount of Euler circles (each vertex degree is 2) which I order in a circle, so $(n-1)!$ is the possibilities to order $n$ different elements in a circle and divide by 2, because of the reflection.

Isn't a Hamiltonian circuit in such a graph an $n$-cycle, so it could be triangle, quadrilateral, and so on?

## marked as duplicate by hardmath, user147263, Stefan Mesken, Semiclassical, Daniel W. FarlowMar 8 '16 at 0:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Do you mean total Hamiltonian cycles of any size, or Hamiltonian cycles over the whole graph? – Ian Mar 7 '16 at 14:18
• @Ian: Hamiltonian cycles are over the whole graph by definition. – Shahab Mar 7 '16 at 14:35
• @Shahab That's the definition I'm familiar with, but the OP seems to be suggesting something else: counting sizes of different cycles. – Ian Mar 7 '16 at 14:59
• You should have checked definitions. A Hamiltonian circuit (or cycle) visits every vertex exactly once before returning to its starting point. An Eulerian circuit visits every edge exactly once in the graph before returning to the starting point. – hardmath Mar 7 '16 at 16:51

## 1 Answer

Any arrangement of the $n$ vertices yields a Hamiltonian cycle. In fact we may group the $n!$ possible arrangements in groups of $2n$ as one may choose any of the $n$ vertices to start from and any of the two directions to list the vertices in. It follows that there are precisely $\frac{n!}{2n}$ distinct Hamiltonian cycles. The result follows.

Further edit: Sketch of a more formal argument:

1. Let $A=\{(v_1,\dots,v_n):v_i\in V(G),v_i\ne v_j\mbox{ for } i\ne j\}$ be the set of all arrangements of the $n$ vertices. Show that $|A|=n!$.

2. Show that each $(v_1,\dots,v_n)$ yields a Hamiltonian cycle and all Hamiltonian cycles arise in this manner. (Many of these cycles are duplicates of each other.)

3. Consider an relation on $A$: $(v_1,\dots,v_n)\sim(w_1,\dots,w_n)$ if and only if $(v_1,\dots,v_n)$ and $(w_1,\dots,w_n)$ correspond to the same cycle. Prove that this is an equivalence relation.

4. Observe that each equivalence class will have precisely $2n$ elements. (Work out the case $n=5$ by hand)

5. Conclude that there are $n!/2n$ equivalence classes. Hence conclude there are $(n-1)!/2$ Hamiltonian cycles.

• didn't understand too good for the dividing by 2n. the dividing by 2 because of 2 direction can be chosen (and our case is undirected) and dividing by n for each points of start? And why this cases are considered as same Hamiltonian circle (so you divide by it) ? Aren't they different ? – Ilya.K. Mar 7 '16 at 14:13
• @Ilya.K.: I have included sketch of a more formal argument. If something is not clear please ask. Dividing by 2 followed because for example the cycle abcd is the same as adcb, and dividing by n is required because abcd is the same as bcda, cdab, dabc. Hence for each cycle abcd we have 8 duplicates. – Shahab Mar 7 '16 at 14:33