Hamiltonian Walk — Definition, Formula & Examples
A Hamiltonian walk is a closed walk in a graph that visits every vertex at least once, though it may repeat vertices and edges. Unlike a Hamiltonian cycle, it does not require that each vertex be visited exactly once.
Given a graph , a Hamiltonian walk is a closed walk where and every vertex appears as some for at least one index . Edges and vertices may be repeated.
How It Works
To find a Hamiltonian walk, you start at any vertex and traverse edges, visiting every vertex in the graph at least once, then return to your starting vertex. You are allowed to revisit vertices and reuse edges. This makes Hamiltonian walks easier to find than Hamiltonian cycles, since the exactness constraint is relaxed. Every graph that has a Hamiltonian cycle automatically has a Hamiltonian walk, but the converse is not true. The length of an optimal (shortest) Hamiltonian walk in a weighted graph is closely related to the Travelling Salesman Problem.
Worked Example
Problem: Consider the graph with vertices and edges . The edge does not exist. Find a Hamiltonian walk starting and ending at .
Step 1: Start at . Traverse to via edge , then to via edge , then to via edge . All vertices have now been visited.
Step 2: Return to via edge to close the walk.
Step 3: Check: every vertex () appears at least once, and the walk is closed since it starts and ends at . This walk happens to also be a Hamiltonian cycle since no vertex is repeated (other than the start/end). In a graph without edge , you would need to repeat a vertex, producing a Hamiltonian walk that is not a Hamiltonian cycle.
Answer: A Hamiltonian walk is , with total length 4 edges.
Why It Matters
Hamiltonian walks arise naturally when modeling routing problems where you must visit every location but can afford to retrace steps. Optimizing the length of a Hamiltonian walk in weighted graphs is a variant of the Travelling Salesman Problem studied in combinatorial optimization and operations research.
Common Mistakes
Mistake: Confusing a Hamiltonian walk with a Hamiltonian cycle by assuming every vertex must be visited exactly once.
Correction: A Hamiltonian walk allows repeated vertices and edges. A Hamiltonian cycle requires each vertex to appear exactly once (except the start/end vertex). Every Hamiltonian cycle is a Hamiltonian walk, but not vice versa.
