On this page
Put a token on a vertex of a graph. At every step, move it to a neighbour chosen uniformly at random. How long until it reaches a particular vertex? How long until it has seen them all? These two questions define the hitting time and the cover time, and three small graphs show almost everything about them.
What are hitting time and cover time?
The hitting time H(u, v) is the expected number of steps for a walk started at u to first reach v, as defined in these Carnegie Mellon lecture notes on random walks.
The cover time is the expected number of steps to visit every vertex, taken from the worst starting vertex, in the same lecture notes.
The commute time between u and v is H(u, v) + H(v, u), and for a graph with m edges it equals 2m times the effective resistance between u and v when every edge is a 1-ohm resistor (lecture notes).
Why does a random walk on a path take (n − 1)² steps?
Number the vertices of a path 0, 1, ..., n − 1 and let h(k) be the expected time to reach n − 1 from k. One step always happens, then you are at a neighbour, so:
h(n − 1) = 0, since you are already there.
h(0) = 1 + h(1), since vertex 0 has only one neighbour.
h(k) = 1 + (h(k − 1) + h(k + 1)) / 2 for every vertex in between.
That is a system of linear equations, one per vertex. Take n = 5 and guess h(k) = 16 − k², that is, 16, 15, 12, 7, 0. Check: h(0) = 1 + 15 = 16. h(1) = 1 + (16 + 12)/2 = 15. h(2) = 1 + (15 + 7)/2 = 12. h(3) = 1 + (12 + 0)/2 = 7. Every equation holds.
In general h(k) = (n − 1)² − k², so the end-to-end hitting time on a path is exactly (n − 1)², a result stated in Mohammed Abdullah's thesis on the cover time of random walks. Doubling the path roughly quadruples the wait, because the walk keeps wandering back over ground it has already covered.
What is the cover time of a complete graph?
On the complete graph every vertex is joined to every other, so each step lands on one of the other n − 1 vertices at random. Once k vertices have been seen, the chance the next step finds a new one is (n − k)/(n − 1), so the expected wait is (n − 1)/(n − k) steps. This is the coupon collector problem. Adding the waits for k = 1 to n − 1 gives (n − 1)(1 + 1/2 + ... + 1/(n − 1)), which grows like n ln n, as the same thesis shows.
Worked out: for n = 10 the cover time is 9 × 2.829 ≈ 25.5 steps, and for n = 30 it is 29 × 3.962 ≈ 114.9 steps. The same thesis records Feige's result that no connected graph on n vertices has a cover time below about n ln n, so asymptotically the complete graph is as fast as a random walk gets.
Which graph makes a random walk slowest?
Graham Brightwell and Peter Winkler found the n-vertex graph with the largest hitting time in Random Structures and Algorithms (1990). It is the lollipop: a clique on about 2n/3 vertices with a path on the remaining vertices attached, and the walk starts in the clique and aims for the far end of the path. Its hitting time is approximately 4n³/27. Uriel Feige then proved that the cover time of any connected n-vertex graph is at most 4n³/27 + o(n³), in Random Structures and Algorithms (1995).
You can check the 4n³/27 figure with the resistor fact. Take n = 30: a clique of 20 vertices (190 edges) and a path of 10 more edges, 200 edges in all. The path end y is 10 ohms from the join vertex u, so the commute time is 2 × 200 × 10 = 4,000. Going back from y to u is a walk on a path of 11 vertices, 10² = 100 steps, which leaves H(u, y) = 3,900. Starting from any other clique vertex adds 19 steps to reach u first: 3,919, against 4n³/27 = 4,000.
The walk keeps falling back into the clique and restarting its climb. Compare n = 30 across the three graphs:
Complete graph, visit everything: about 115 steps.
Path, end to end: 841 steps.
Lollipop, clique to path end: 3,919 steps.
For where a long walk spends its time, see solving πP = π for a Markov chain's stationary distribution.
How do you solve a hitting-time problem yourself?
Name the target and write h = 0 there.
For every other vertex write h = 1 + the average of h over its neighbours.
Use symmetry to merge vertices that must have the same h.
Solve, then sanity-check one equation by substitution, as above.
For commute times on bigger graphs, swap equations for 2m times the effective resistance.
If the set-up feels shaky, the Fermi Concept Library gives every concept in mathematics its own lesson, so you can patch the gap before the algebra. When you want a second look at your equations, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer.
Next, read why a walk in three dimensions may never come home in our post on Pólya's recurrence theorem.



