HamiltonianGraphQ

HamiltonianGraphQ[g]

yields True if the graph g is Hamiltonian, and False otherwise.

Details

  • A graph is Hamiltonian if it has a cycle that traverses each vertex exactly once.

Examples

open allclose all

Basic Examples  (2)

Test whether a graph is Hamiltonian:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Not all graphs have a Hamiltonian cycle:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Scope  (6)

Applications  (2)

Properties & Relations  (4)

See Also

FindHamiltonianCycle  EulerianGraphQ  ConnectedGraphQ

Introduced in 2010
(8.0)