The Hamiltonian number of a connected graph
is the length of a Hamiltonian
walk on
.
In other words, it is the minimum length of a closed spanning walk in the graph.
For a Hamiltonian graph,
, where
is the vertex count. The
Hamiltonian number therefore gives one measure of how far away a graph is from being
Hamiltonian, and a graph with
is called an almost
Hamiltonian graph.
The Hamiltonian number of a connected graph on
vertices that is nonhamiltonian is
(equivalently,
is almost Hamiltonian)
iff
has a Hamiltonian path
whose endpoints have a common neighbor.
If
is a connected bipartite
graph with nonempty bipartition classes of sizes
and
,
then its Hamiltonian number is even and
|
(1)
|
Since
is the vertex count of
, no closed spanning walk of length
exists if
is even or if
.
Therefore, a bipartite almost
Hamiltonian graph must satisfy
.
Punnim et al. (2007) show that
|
(2)
|
with iff
is a tree. Since a tree
has Hamiltonian number
, an almost Hamiltonian
tree must satisfy
,
giving
.
Since the 3-path graph
is the only tree on three nodes,
it is also the only almost Hamiltonian
tree.
In general, determining the Hamiltonian number of a graph is difficult (Lewis 2019).
If
is a
-connected
graph on
vertices with diameter
, then
|
(3)
|
(Goodman and Hedetniemi 1974, Lewis 2019).
If
is an almost Hamiltonian cubic
graph with
vertices, then the triangle-replaced graph
has Hamiltonian number
|
(4)
|
(Punnim et al. 2007).
Values for special classes of (non-Hamiltonian) graphs are summarized in the table below, where
denotes the vertex count of the graph