WLJS LogoWLJS Notebook

HamiltonianGraphQ

HamiltonianGraphQ[g] yields True if the graph g is Hamiltonian (has a Hamiltonian cycle), and False otherwise.

Examples

Test if a graph is Hamiltonian:

HamiltonianGraphQ[CompleteGraph[5]]
(* True *)
HamiltonianGraphQ[StarGraph[5]]
(* False *)

Please visit the official Wolfram Language Reference for more details.

On this page