Directory UMM :Data Elmu:jurnal:O:Operations Research Letters:Vol26.Issue2.Mar2000:

Operations Research Letters 26 (2000) 91–98
www.elsevier.com/locate/orms

The maximum number of Hamiltonian cycles in graphs
with a xed number of vertices and edges (
Ruud H. Teunter a; ∗ , Edo S. van der Poort b
a University

of Magdeburg, Faculty of Economics and Management, Department of Production and Logistics, P.O. Box 4120,
39016 Magdeburg, Germany
b ATO-DLO, Bornsesteeg 59, 6700 AA Wageningen, The Netherlands
Received 1 May 1997; received in revised form 1 September 1999

Abstract
The problem studied in this paper is that of nding the maximum number of Hamiltonian cycles in a graph with a
given number of vertices and edges. The main results are a lower bound and an upper bound, both given by closedform formulas, for the maximum number of Hamiltonian cycles in a graph with a given number of vertices and edges.
c 2000 Elsevier Science B.V. All rights reserved.

Keywords: Graphs; Theory; Traveling salesman

1. Introduction

In this paper we study the problem of determining the maximum number of Hamiltonian cycles in a graph
with a given number of vertices and edges. In other words, we consider the problem of how to choose a given
number of edges such that the number of Hamiltonian cycles in the resulting graph is as large as possible.
In the literature the problems involving the numbers of Hamiltonian cycles have mainly been considered for
3 and 4-regular graphs. In Tutte [10] it is shown that the number of Hamiltonian cycles in any cubic graph
containing a given edge is even. Sloane [8] proves that if a graph contains two edge-disjoint Hamiltonian
cycles, then there exists a third Hamiltonian cycle in this graph. Bosak [1] shows that for cubic bipartite
( When this paper was written, both authors worked at the Department of Econometrics, University of Groningen, Groningen,
The Netherlands.
∗ Correspondence address: Department of Mechanical Engineering, Industrial Management Division, Aristoteles, University of
Thessaloniki, P.O. Box 461, 54006 Thessaloniki, Greece.
E-mail addresses: [email protected] (R.H. Teunter), [email protected] (E.S. van der Poort)

c 2000 Elsevier Science B.V. All rights reserved.
0167-6377/00/$ - see front matter
PII: S 0 1 6 7 - 6 3 7 7 ( 9 9 ) 0 0 0 7 5 - 9

92

R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98


graphs the total number of Hamiltonian cycles is even. Lower bounds for the number of Hamiltonian cycles
in 4-regular graphs are given in Thomason [9]. Other authors have considered the problem of nding the
number of Hamiltonian cycles in a random graph (see e.g. Cooper and Frieze [2]).
The problem of determining the maximum number of Hamiltonian cycles in a graph is an enumeration
problem (see Garey and Johnson [4]) or counting problem (see Papadimitriou [6]). It is naturally associated
with the decision problem concerning the existence of a Hamiltonian cycle in a graph, one of the most famous
NP-complete problems. The Hamiltonian cycle enumeration problem is even more complicated. In fact, even
if P = NP, and we could tell in polynomial time whether an arbitrary graph G contains a Hamiltonian cycle,
it is not apparent that this would enable us to count the number of Hamiltonian cycles in G in polynomial
time, see Garey and Johnson [3]. We study a variant of this standard Hamiltonian cycle enumeration problem,
namely that of determining the maximum number of Hamiltonian cycles in a graph with a given number of
vertices and edges. We encountered this problem, when doing sensitivity analysis on a traveling salesman
problem (TSP), which is also closely related to the Hamiltonian cycle existence problem. Given a set of cities
1; : : : ; n and the distance d[i; j] between any pair of cities i and j, the TSP is the problem of nding a shortest
Hamiltonian cycle visiting each city exactly once (see e.g. Lawler et al. [4]). When studying sensitivity
analysis for the TSP the following graph–theoretical problem appears to be important (see Libura et al. [5]
and van der Poort et al. [7]): How many edges need to be added to a shortest Hamiltonian cycle in order to
nd a set of so-called k-best cycles. A set of cycles is called k-best if the length of any Hamiltonian cycle
in this set is at most the length of any Hamiltonian cycle outside the set. Clearly, in order to nd a set of

k-best Hamiltonian cycles, the number of added edges is at least the minimum number of edges that has
to be added in order to obtain a graph with k Hamiltonian cycles. In other words, we are interested in the
maximum number of Hamiltonian cycles in a graph with n vertices and n + a edges, for 06a6( n2 ) − n.
The organization of the paper is as follows. In Section 2 we mathematically formulate the problem and
introduce some notations. Using brute force, exact values of the maximum number of Hamiltonian cycles in
graphs with small numbers of edges are calculated in Section 3. It is also shown that the maximum number
of Hamiltonian cycles in (sparse) graphs for which the number of edges is less than 1.5 times the number
of vertices, only depends on the number of edges in that graph and not on the number of vertices. Lower
and upper bounds of the maximum number of Hamiltonian cycles, both given by closed-form formulas and
valid for any number of edges and vertices, are derived in Sections 4 and 5. We end with a comparison of
the lower and upper bounds and give some conclusions and directions for future research.

2. De nitions
For n¿3, consider the complete graph Kn = (Vn ; En ) with the vertex set Vn = {1; : : : ; n} and the edge set
En = {{i; j}: i; j ∈ V; i 6= j}. Denote mn = |En |. Any subset of En that forms a cycle containing each vertex
in Vn exactly once is called a Hamiltonian cycle in the graph Kn . Denote by Hn the set of all Hamiltonian
cycles in Kn .
For any A ⊆ En , the number of Hamiltonian cycles in Kn being contained in A is denoted by nA , i.e.
nA = |{H ∈ Hn : H ⊆ A}|
and n (a), for a = 0; 1; : : : ; mn − n, is de ned as the maximum number of Hamiltonian cycles that can be found

over all sets A ⊆ En with |A| = n + a, i.e.
n (a) = max{ nA : A ⊆ En ; |A| = n + a}:
Fig. 1 shows a graph with six vertices and the corresponding set of Hamiltonian cycles for the edge set
A = {{1; 2}; : : : ; {5; 6}; {6; 1}; {1; 4}; {2; 5}; {3; 6}}. It will be shown in Section 3 that 6 (3) = 6A = 6.

R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98

93

Fig. 1. Graph with the corresponding set of Hamiltonian cycles.

Let A ⊆ En and U ⊆ Vn . Then E(A; U ) denotes the set of edges in A that are incident to two vertices in U ,
i.e.
E(A; U ) := {{v; w} ∈ A: v; w ∈ U };
and, for any vertex u ∈ U; Eu (A; U ) denotes the set of edges in A that are incident to u and another vertex
in U , i.e.
Eu (A; U ) := {{u; w} ∈ A: w ∈ U } ⊆ E(A; U ):
Let A ⊆ En . A path P in A is a set of adjacent edges in Kn . The length of a path is de ned as the cardinality
of the edge set. Any path P with end-vertices u and v is contracted into a single edge (or vertex) when P is
replaced by a single new edge {u; v} (or vertex), and all other vertices and edges in P and all edges adjacent to

‘intermediate’ vertices of P are deleted. In the reverse operation, any single edge {u; v} can be expanded into
a path P of length k by introducing k − 1 new vertices v1 ; : : : ; vk−1 and k edges {u; v1 }; {v1 ; v2 }; : : : ; {vk−1 ; v}.
3. The maximum number of Hamiltonian cycles in a graph
The following lemma shows, for a given a, that for n suciently large we have that n (a) is constant.
Lemma 1. For n ¿ 2a it holds that n (a) = 2a+1 (a).
Proof. We rst show that n+1 (a)¿ n (a) for n ¿ 2a. Let A be such that |A| = n + a and nA = n (a). Clearly,
A contains a Hamiltonian cycle, so that every vertex is incident to at least two edges in A. There are at
least n − 2a ¿ 0 vertices that are incident to exactly two edges in A. By expanding any edge incident to one
of these vertices into a path of length 2, we obtain a graph with n + 1 vertices and the same number of
Hamiltonian cycles as the original graph. Hence, n+1 (a)¿ n (a) for n ¿ 2a.
A
= n+1 (a).
Next we show that n+1 (a)6 n (a) for n ¿ 2a − 1. Let A be such that |A| = n + 1 + a and n+1
There are at least n + 1 − 2a ¿ 0 vertices that are incident to exactly two edges in A. By contracting an
edge incident to such a vertex into a single vertex we obtain a graph with n vertices and at least the same
number of Hamiltonian cycles as the original graph. Hence, n (a)¿ n+1 (a) for n ¿ 2a − 1. This proves that
n (a) = 2a+1 (a) for n ¿ 2a.
It follows from Lemma 1 that the maximum number of Hamiltonian tours is not obtained in very sparse
graphs. In the remainder of the paper we therefore focus on determining n (a) for n and a such that n62a+1.


94

R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98
Table 1
Lower bounds and upper bounds for 10 (a)
a

5
10
15
20
25
30
35

Lower bounds

n (a)

LB-2


LB-1

1
11
168
1709
10441
48210
181440

1
24
361
2280
12256
51644
181440

Upper bound

UB

12

181440

24
384
2430
10368
33600
86400
181440

Unfortunately, we are not able to derive a closed-form expression for n (a). Hence, we resort to deriving
lower and upper bounds.
4. Lower bounds for n (a)
First, we prove a lemma that allows us to recursively determine a lower bound for n (a − 1), given a lower
bound for n (a).
Lemma 2. Let g := ⌈2(n + a)=n⌉. For all a¿1 it holds that

g−2
n (a):
n (a − 1)¿
g
Proof. Let A be such that |A| = n + a and nA = n (a). By de nition of g, there is a vertex, say v, that is
incident to k¿g edges in A. Since each Hamiltonian cycle in A contains two edges incident to v, on average
each of the k edges incident to v is contained in 2 nA =k Hamiltonian cycles. Hence, at least one of these k
A\{e}
edges, say e, is contained in at most 2 nA =k62 nA =g Hamiltonian cycles. So, n (a − 1)¿ n
¿ nA − (2=g) nA =
A
[(g − 2)=g] n = [(g − 2)=g] n (a).
Using Lemma 2 and n (mn − n) = 12 (n − 1)! it is possible to recursively nd lower bounds for n (mn − n);
n (mn − n − 1); : : : ; n (1). Simply start with the exact lower bound n (mn −n) = 21 (n − 1)! and, given the lower
bound for n (a), derive in each step a lower bound for n (a − 1) using Lemma 2. The resulting lower bound
is denoted by LB-1. In Table 1 the lower bound LB-1 is given for n = 10, and several values of a. A less
accurate lower bound, given by a closed-form formula, is found by replacing ⌈2(n + a)=n⌉ in Lemma 2 with
2(n + a)=n, and using this same recursive argument. This leads to a lower bound LB-2 presented in Theorem
3. Lower bound LB-2 is also given in Table 1.
Theorem 3. For all a¿1 holds that

(n + a)! (mn − n)!
1
:= LB-2:
n (a)¿ (n − 1)!
2
a!
mn !
Proof. The continuous function f(x) := (x − 2)=x; x ¿ 2, is monotonically increasing in x. Therefore,
Lemma 2 gives that for all a¿1 it holds that
⌈2(n + a)=n⌉ − 2
(2(n + a)=n) − 2
a
n (a)¿
n (a) =
n (a):
n (a − 1)¿
⌈2(n + a)=n⌉
2(n + a)=n
n+a


R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98

95

Applying this result repeatedly and using n (mn − n) = 12 (n − 1)! gives
n (a) =

n (mn − n − 1)
n (a) n (a + 1)
···
n (mn − n)
n (a + 1) n (a + 2)
n (mn − n)

¿

a+1
mn − n 1
a+2
···
(n − 1)!
n+a+1n+a+2
n + mn − n 2

=

(n + a)! (mn − n)!
1
(n − 1)!
:
2
a!
mn !

5. Upper bounds for n (a)
Similar to the derivation of the lower bounds in the previous subsection, Lemma 2 could be used to derive
a recursive upper bound for n (a), that is valid for all values of a and n. This is omitted, since a better upper
bound is derived in the remainder of this subsection. We proceed as follows. First, it is shown that n (a)
is bounded above by the solution of an integer programming problem. Then, an upper bound for n (a) is
derived by solving this integer programming problem.
Lemma 4. Let U ⊆ Vn ; with 26|U |6n − 1; and let A ⊆ En . Let pU be any path incident to all vertices in
U with endpoint u ∈ U . Then pU can be extended to at most


n−|U |
X




n−|U

Y|
si = |E(A; (Vn \ U ) ∪ {u})|;
max
si : i=1
(1)




 i=1

si ∈ {0; : : : ; i} for all i ∈ {1; : : : ; n − |U |}
Hamiltonian cycles.
Proof. The proof is by backward induction on |U |. We rst show that this lemma holds for all U with
|U | = n − 1. In those cases pU is a path of length n − 2. Without loss of generality, let U = {1; 2; : : : ; n − 1}
and let vertices 1 and n−1 be the endpoints of path pU . Clearly, pU can be extended to exactly 1 Hamiltonian
cycle if the edges {1; n} and {n − 1; n} are both contained in A. Otherwise, pU cannot be extended to any
Hamiltonian cycle. We show that (1) is a correct upper bound in both these cases. If the edge {n − 1; n} is
contained in A, then (1) gives that
max{s1 : s1 = |E(A; (Vn \ U ) ∪ {u})| = |{{n − 1; n}}| = 1; s1 61} = 1:
Otherwise, (1) gives that
max{s1 : s1 = |E(A; (Vn \ U ) ∪ {u})| = |{∅}| = 0; s1 61} = 0:
Hence, this lemma is correct for all U with |U | = n − 1.
Next, assume that this lemma holds for all U with |U |=l+1; : : : ; n−1, where 26l6n−2. Now take any set
U of cardinality l. Hence, pU is a path of length l − 1. By de nition, there are exactly |Eu (A; (Vn \ U ) ∪ {u})|
ways to extend any path pU , incident to all vertices in U and with endpoint u ∈ U , by adding an edge in
A incident to u. Clearly, |Eu (A; (Vn \ U ) ∪ {u})|6|Vn \ U | = n − |U |, since there are n − |U | vertices left to
visit. Since we assumed that this lemma holds for all U with |U | = l + 1; : : : ; n − 1, each such path, resulting

96

R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98

from adding an edge in A incident to u, can be extended to at most


n−|U |−1
X





n−|U
Y|−1
si = |E(A; Vn \ U )|;
si : i=1
max





 i=1
si ∈ {0; : : : ; i} for i ∈ {1; : : : ; n − |U | − 1}

Hamiltonian cycles. By de nition it holds that

E(A; Vn \ U ) = E(A; (Vn \ U ) ∪ {u}) \ Eu (A; (Vn \ U ) ∪ {u}):
As a consequence, there are at most
|Eu (A; (Vn \ U ) ∪ {u})|



n−|U
Y|−1
si :
× max


 i=1
6max




n−|U
Y|




i=1

n−|U |−1

X

si = |E(A; (Vn \ U ) ∪ {u})| − |Eu (A; (Vn \ U ) ∪ {u})|

i=1

si ∈ {0; : : : ; i} for all i ∈ {1; 2; : : : ; n − |U | − 1}
n−|U |

si :

X

si = |E(A; (Vn \ U ) ∪ {u})|

i=1

si ∈ {0; : : : ; i}

for all i ∈ {1; 2; : : : ; n − |U |}

















ways to extend pU to a Hamiltonian cycle. In deriving the last inequality we explicitly used that |Eu (A; (Vn \
U ) ∪ {u})|6n − |U |. The induction step is now complete, and hence this lemma holds for all U with |U | = l.
This completes the proof.
Corollary 5. Let A ⊆ En . Let u be any vertex in Vn . Let d(u) denote the set of edges in A incident to u.
Then we have that


n−2
X




n−2


Y
si = |A| − d(u);
d(u)
A
n 6
max
si : i=1
:
(2)


2


 i=1

si ∈ {0; : : : ; i} for all i ∈ {1; 2; : : : ; n − 2}
Proof. Choose any edge from the d(u) edges in A that are incident to vertex u. For each choice, the maximum
number of possibilities for extending this edge into a Hamiltonian cycle is given by the term between brackets
on the right-hand side of (2) (see Lemma 4). The factor 21 corrects for the fact that each Hamiltonian cycle
is found by starting with either one of its edges incident to vertex u.
Note that the right-hand side of (2) can be considered as an integer programming problem. The solution
to such a type of problem is presented in Lemma 6.
Lemma 6. Let l and T be the integers such that T 6 12 l(l + 1). De ne k as the largest integer for which
y := T − 21 k(k + 1) − k(l − k)¿0. Then;


l
X




l

Y
si = T;
max
= (k + 1)y k l−k−y k!:
si : i=1





 i=1
si ∈ {0; : : : ; i} for all i ∈ {1; 2; : : : ; l}

R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98

97

Proof. Ignoring the set of constraints si ∈ {1; : : : ; i} the problem is that of maximizing a product of integers
given their sum. This is achieved by choosing these integers as close to each other as possible, since for any
two integers n and m, with n ¡ m, it holds that (n + 1)(m − 1) = nm + (m − n) − 1¿mn. Hence, without the
constraint si ∈ {1; : : : ; i}, the optimal solution would be either of the form {s1∗ ; : : : ; sl∗ } = {k; : : : ; k} or of the
form {s1∗ ; : : : ; sl∗ } = {k; : : : ; k; k + 1; : : : ; k + 1}. It is easily seen that if the set of constraints si ∈ {1; : : : ; i} is
not ignored, then the optimal solution is either of the form {s1∗ ; : : : ; sl∗ } = {1; 2; : : : ; k; : : : ; k} or of the form
{s1∗ ; : : : ; sl∗ } = {1; 2; : : : ; k; : : : ; k; k + 1; : : : ; k + 1}. The rst part {s1∗ ; : : : ; sk∗ } = {1; 2; : : : ; k} is needed in order to
satisfy the additional constraints. The proof is completed by noting that the largest possible value of k, is the
largest value for which 1 + 2 + · · · + k + k(l − k) = 21 k(k + 1) + k(l − k)6T .
Using Corollary 5 and Lemma 6, we derive an upper bound for n (a), which is presented in Theorem 7.
Theorem 7. Let g = ⌈2(n + a)=n⌉. Let k ∈ {1; : : : ; n − 2} be the largest integer such that y := n + a − g −
1
2 k(k + 1) − k(n − 2 − k)¿0. Then
g
n (a)6 (k + 1)y k n−2−k−y k! := UB:
2
Proof. Consider any graph with n vertices and n + a edges, and let d denote the maximum degree in this
graph. Clearly, d¿g. Applying Corollary 5 and Lemma 6 gives that
d
n (a)6 (kd + 1)yd kdn−2−kd −yd kd ! := Bd ;
2
where kd is the largest integer such that
yd := n + a − d − 21 kd (kd + 1) − kd (n − 2 − kd )¿0:

(3)

(4)

Note that the only thing that remains to do, is proving that an upper bound for n (a) is found by replacing d
in (3) with its minimum value g. This is equivalent to showing that Bd is non-increasing in d for all d¿g,
which is done next. Combining (4) with 21 kd (kd +1)+kd (n−2−kd )=(kd (kd +1)=2)+(n−2−kd )kd ¿(n−2)kd =2
gives
(n − 2)

kd
2(n + a) n − 2
6n + a − d6n + a − g6n + a −
=
(n + a);
2
n
n

and hence
2
(5)
kd 6 (n + a)6g6d:
n
To complete the proof we distinguish two cases yd ¿ 0 and yd = 0, and show that Bd+1 6Bd , i.e. Bd is
non-increasing in d, for all d¿g. If yd ¿ 0 then kd+1 = kd and thus (5) gives
d + 1 kd
dkd + kd
= Bd
6Bd ;
d kd + 1
dkd + d
and if yd = 0 then kd+1 = kd − 1 and thus (5) gives
Bd+1 = Bd

Bd+1 = Bd

d + 1 kd − 1
dkd + (kd − d) − 1
= Bd
6Bd :
d
kd
dkd

Table 1 gives the upper and lower bounds for n (a), derived in this paper, for graphs with 10 vertices.
Due to the recursive proof of the lower bounds, starting with a complete graph, we expect that for sparse
graphs, the ratio of the upper bound and the exact value of n (a) is much smaller than that of the exact value
and the lower bound. Unfortunately we are not able to test this hypothesis, since calculating the exact values
n (a) is very time consuming, even for small number of vertices.

98

R.H. Teunter, E.S. van der Poort / Operations Research Letters 26 (2000) 91–98

Acknowledgements
The authors are grateful to the anonymous referee for his many helpful comments.
References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]

J. Bosak, Hamiltonian lines in cubic graphs, in: P. Rosenstiel (Ed.), Theorie des Graphes ICC (1967) 35 – 46.
C. Cooper, A.M. Frieze, On the number of Hamilton cycles in a random graph, J. Graph Theory 13 (6) (1989) 719–735.
M.R. Garey, D.S. Johnson, Computers and Intractability, a Guide to the Theory of NP-Completeness, Freeman, San Francisco, 1979.
E.L. Lawler, J.K. Lenstra, A.H.G. Rinnooy Kan, D.B. Shmoys, The Travelling Salesman Problem, A Guided Tour of Combinatorial
Optimization, Wiley, New York, 1985.
M. Libura, E.S. van der Poort, G. Sierksma, J.A.A. van der Veen, Sensitivity analysis based on k-best solutions of the travelling
salesman problem, Research Report 96A14, Graduate School=Research Institute Systems, Organizations and Management.
C.H. Papadimitriou, Computational Complexity, Addison-Wesley, Reading, MA, 1994.
E.S. van der Poort , M. Libura, G. Sierksma, J.A.A. van der Veen, Algorithms for nding k-best solutions of the travelling salesman
problem, Research Report, Graduate School=Research Institute Systems, Organizations and Management, to appear.
N.J.A. Sloane, Hamiltonian cycles in graphs of degree 4, J. Combin. Theory 6 (1969) 311–312.
A.G. Thomason, Hamiltonian cycles and uniquely edge colorable graphs, Ann. Dis. Math. 3 (1978) 259–268.
W.T. Tutte, On Hamiltonian circuits, J. London Math. Soc. 21 (1946) 98–101.