FindHamiltonianCycle

As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System. >>

FindHamiltonianCycle[g]
attempts to find a Hamiltonian cycle.

Details and OptionsDetails and Options

  • FindHamiltonianCycle functionality is now available in the built-in Wolfram Language function FindHamiltonianCycle.
  • To use FindHamiltonianCycle, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
  • FindHamiltonianCycle[g] returns an empty list if no Hamiltonian cycle is found.
  • FindHamiltonianCycle considers the input graph as undirected.
  • FindHamiltonianCycle uses heuristic algorithms to find a Hamiltonian cycle; therefore, there is no guarantee that a Hamiltonian cycle will be found even if one exists.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

In[1]:=
Click for copyable input

This defines a small graph and finds a Hamiltonian cycle of the graph:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=

This function has been superseded by FindHamiltonianCycle in the Wolfram System:

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