The Petersen Graph Has a Hamiltonian Path and No Cycle
Published 12/4/2026 · 3 min read · Developer tools
Daniel Okonkwo — Front-end developer and tech writer at OneKitly
Web performance · File formats
Checked against 2 sources
A Hamiltonian path visits every vertex exactly once; a Hamiltonian cycle does that and returns to the start. The two are not the same question, and the Petersen graph is the standard proof: ten vertices each of degree three, a path such as 0–5–8–6–1–2–7–9–4–3 exists, and an exhaustive search shows no cycle does. Nothing in the shape of the graph makes this predictable — it is vertex-transitive, perfectly regular, and looks like it ought to close. The only way to answer is to try every arrangement, which is why the tool refuses beyond twelve vertices: 12! is 479 million and 13! is 6.2 billion.
Ten vertices, fifteen edges, every degree 3: 0–5–8–6–1–2–7–9–4–3 visits each vertex once, and no arrangement closes the loop.
Euler counts edges, Hamilton counts vertices, and only one of them is easy
An Euler path uses every edge once and exists exactly when the graph is connected and has zero or two vertices of odd degree — a rule Euler published in 1736 and one that a program can check in a single pass. A Hamiltonian path uses every vertex once and has no such rule; deciding it is NP-complete, and half a century of effort has produced good heuristics and no criterion. The Petersen graph shows why no simple degree condition could work: all ten vertices have the same degree, so any rule based on degrees alone must give the same verdict for the path and the cycle, and the true answers differ.
The default example has the opposite pair of answers
The five-vertex graph the tool starts with — A–B, B–C, C–D, D–E, E–A, A–C, B–D — has a Hamiltonian cycle, A–C–B–D–E–A, and therefore a path as well. It has no Euler path at all, because four of its five vertices have odd degree and an Euler path tolerates at most two. So the two default examples in this article sit on opposite corners of the same table: one graph is Eulerian-hostile and Hamiltonian-friendly, the other the reverse. Any intuition of the form "a well-connected graph should have both" fails on the first graph you test it against.
| Question | How it is decided | Cost |
|---|---|---|
| Euler path? | count odd-degree vertices | linear |
| Euler circuit? | all degrees even | linear |
| Hamiltonian path? | backtracking search | NP-complete |
| Hamiltonian cycle? | backtracking search | NP-complete |
Frequently asked questions
- Why does a proof of absence take as long as a search?
- Because a search that finds something can stop, and a search that finds nothing cannot. Backtracking prunes hard — a partial path that strands a vertex is abandoned at once — so a graph with a Hamiltonian path often yields one in milliseconds. Proving there is none means every branch has to be closed, and the pruning is what decides whether that takes a second or a week. The twelve-vertex cap is set by the worst case rather than the typical one, because a tool cannot know in advance which it has been handed.
- Is the travelling salesman problem the same thing?
- It is the weighted version of the same question. Asking whether a Hamiltonian cycle exists is the decision problem; asking for the cheapest one over weighted edges is the optimisation problem, and a solver for the second answers the first for free by checking whether any finite tour exists. That is the standard proof that the travelling salesman problem is at least as hard, and it is why practical routing software never claims optimality on large instances — it reports a tour and a bound on how far from optimal it can be.
Articles you may find interesting
All guides →Related tools
Sources
Spotted a mistake in this article?