Maths WorkshopMaths problems with full solutions
Exercise 1249Combinatorics › Graph theoryOlympiadAdded 4 Nov 2026

When can a graph be drawn without lifting the pen?

#Euler circuit#graph theory#degrees#extremal trail

Statement

  1. Prove that a connected graph in which every vertex has even degree has a closed trail (a walk that returns to its start and uses no edge twice) containing all its edges.
  2. Deduce that a connected graph with exactly two vertices of odd degree has a trail using every edge exactly once, starting at one odd vertex and ending at the other.
  3. For which nn does KnK_n have a closed trail using every edge once?
Hint

For part 1, take a trail with the largest possible number of edges and show that it must be closed and use all edges.

Show solutionHide solution

Solution

1. Among all trails, take a longest one, T=(v0,v1,…,vm)T=(v_0,v_1,\dots,v_m).

*TT is closed.* Suppose vm≠v0v_m\ne v_0. Each time TT passes through vmv_m (other than the end) it uses two of its edges, and the last arrival uses one more, so TT uses an odd number of edges at vmv_m. Since deg⁡vm\deg v_m is even, there is an unused edge at vmv_m, and TT can be extended: contradiction. So vm=v0v_m=v_0.

*TT uses all edges.* Suppose not. Because the graph is connected, some unused edge ee has an endpoint ww on TT: take an unused edge ff and a path from a vertex of TT to an endpoint of ff ending with ff; the first unused edge ee on this path starts at a vertex reached by used edges only. Rotate the closed trail TT so that it starts and ends at ww, then append ee: this is a longer trail, a contradiction.

2. Let a,ba,b be the odd vertices. Add a new edge abab (a parallel edge if needed; the proof of part 1 works verbatim for multigraphs). All degrees are now even, so by part 1 there is a closed trail through all edges. Removing the new edge from it gives a trail from aa to bb through all the original edges exactly once.

3. All degrees of KnK_n equal n−1n-1. If nn is odd, the degrees are even and KnK_n is connected, so a closed trail exists. If nn is even and n≥2n\ge2, every vertex has odd degree and a closed trail using all edges cannot exist. So the answer is: exactly the odd nn (for n=1n=1 there are no edges and the empty trail works).

Remark. The converse of 1 is easy, so the condition is an equivalence. This is Euler's theorem (Königsberg bridges, 1736).

Lesson. Extremal choice: take a longest trail and show it cannot be improved.