HamiltonianGraphQ
✖
HamiltonianGraphQ
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Test whether a graph is Hamiltonian:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-fx0ku8


https://wolfram.com/xid/01l2qecqdxw2xgl6b-kpunpp

Not all graphs have a Hamiltonian cycle:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-dt46pd


https://wolfram.com/xid/01l2qecqdxw2xgl6b-bhthi3

Scope (6)Survey of the scope of standard use cases
HamiltonianGraphQ works with undirected graphs:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-fffujv


https://wolfram.com/xid/01l2qecqdxw2xgl6b-gx301e


https://wolfram.com/xid/01l2qecqdxw2xgl6b-i2s368


https://wolfram.com/xid/01l2qecqdxw2xgl6b-yu8edt

HamiltonianGraphQ gives False for expressions that are not graphs:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-0am3hv

HamiltonianGraphQ works with large graphs:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-gco15s

https://wolfram.com/xid/01l2qecqdxw2xgl6b-cqnb2j

Applications (2)Sample problems that can be solved with this function
Test whether the Icosian game [MathWorld] has a solution:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-srktgl


https://wolfram.com/xid/01l2qecqdxw2xgl6b-oig6ak


https://wolfram.com/xid/01l2qecqdxw2xgl6b-x4drgg

https://wolfram.com/xid/01l2qecqdxw2xgl6b-iej1gx

Test whether there is a sequence of moves by a knight chess piece that visits each square of an chessboard exactly once:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-9rztj9

https://wolfram.com/xid/01l2qecqdxw2xgl6b-41gj8e

Properties & Relations (4)Properties of the function, and connections to other functions
A Hamiltonian cycle can be found using FindHamiltonianCycle:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-rqz4j


https://wolfram.com/xid/01l2qecqdxw2xgl6b-ks4l7

Skeleton graphs of platonic solids are Hamiltonian:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-bqitea


https://wolfram.com/xid/01l2qecqdxw2xgl6b-b88swg


https://wolfram.com/xid/01l2qecqdxw2xgl6b-r1wae3

The line graph of a Hamiltonian graph is Hamiltonian:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-i42jjn


https://wolfram.com/xid/01l2qecqdxw2xgl6b-lf3oq3

An Eulerian graph is not always Hamiltonian:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-gxz0rn


https://wolfram.com/xid/01l2qecqdxw2xgl6b-g0qtte


https://wolfram.com/xid/01l2qecqdxw2xgl6b-4cytvd

The line graph of an Eulerian graph is Hamiltonian:

https://wolfram.com/xid/01l2qecqdxw2xgl6b-jcxi53

Wolfram Research (2010), HamiltonianGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html.
Text
Wolfram Research (2010), HamiltonianGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html.
Wolfram Research (2010), HamiltonianGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html.
CMS
Wolfram Language. 2010. "HamiltonianGraphQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html.
Wolfram Language. 2010. "HamiltonianGraphQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html.
APA
Wolfram Language. (2010). HamiltonianGraphQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html
Wolfram Language. (2010). HamiltonianGraphQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html
BibTeX
@misc{reference.wolfram_2025_hamiltoniangraphq, author="Wolfram Research", title="{HamiltonianGraphQ}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_hamiltoniangraphq, organization={Wolfram Research}, title={HamiltonianGraphQ}, year={2010}, url={https://reference.wolfram.com/language/ref/HamiltonianGraphQ.html}, note=[Accessed: 26-March-2025
]}