Blog

Eulerian Path Puzzle: How to Solve It Every Time

26 November 2026

An Eulerian path puzzle asks you to draw a shape in one continuous stroke, covering every line exactly once. You can tell whether it is solvable before you draw anything: count the points where an odd number of lines meet. If there are zero or two, a route exists. Any other count means it does not. Our one-line puzzle game, Tracers: One Line Puzzle, is built on this idea, and the method below works on every level.

TL;DR

  • An Eulerian path uses every line (edge) of a figure exactly once. Points where lines meet are called vertices.
  • Count the vertices with an odd number of lines. Zero or two means the puzzle is solvable. Four or more means it is not.
  • With two odd vertices, start at one and finish at the other. With none, start anywhere and you will end where you began.
  • While tracing, avoid crossing a line that would cut you off from unfinished parts of the figure until you have no other choice.
  • Our blog has a level-by-level guide to draw-one-line puzzles if you want more practice.

Table of Contents

What an Eulerian path puzzle is

The idea is named after the mathematician Leonhard Euler, who first discussed it in 1736 while working on the Seven Bridges of Königsberg problem. The question was whether a walk through the city could cross each of its seven bridges exactly once.

Euler noticed that the route taken inside each landmass does not matter. Only the order of bridges crossed does. That let him redraw the problem as a graph, with each landmass as a dot and each bridge as a line joining two dots. This was the start of graph theory.

Every “draw it without lifting your pencil” puzzle is the same problem in disguise. A textbook version is the Five Rooms Puzzle: a house has five rooms and the outside, with a doorway in each shared wall. Can you walk through every doorway exactly once? Treat each room (and the outside) as a dot and each doorway as a line, and you have a graph.

A few terms help:

  • Vertex: a dot, corner or junction where lines meet.
  • Edge: a line between two vertices.
  • Degree: how many edges touch a vertex.
  • Eulerian path: a route using every edge once, starting and ending at different vertices.
  • Eulerian circuit: the same, but you finish where you started.

A vertex may be visited as many times as you like. Only the edges are limited to one use each.

The two-second solvability test

The rule is short. A connected figure has an Eulerian circuit if and only if every vertex has even degree, and an Eulerian path if and only if it has 0 or 2 odd-degree vertices. When there are two, every valid path starts at one and ends at the other.

Eulerian route outcomes by odd vertex count

“Connected” matters too: all the lines must belong to one piece. If the figure has two separate islands of lines, you cannot draw both without lifting your pencil. Loose ends count as vertices of degree 1, so a dangling line makes an odd vertex.

Why odd vertices cause trouble

Think about passing through a vertex. Each visit uses one edge to arrive and one to leave, so it uses edges in pairs. A vertex with an odd number of edges will always have one left over. Starting at an odd vertex means you leave with the last unpaired edge. An odd vertex you did not start at will eventually trap you: one edge to arrive by, none to leave. So the only odd vertices a route can tolerate are its start and its end.

This also explains why odd vertices always come in even numbers. In the Königsberg graph the degrees were 3, 5, 3 and 3, which add up to 14, twice the seven bridges. Four odd vertices means no route exists.

A worked example

Take the classic house shape: a square with a triangular roof, plus the diagonals-free base. The two bottom corners each have three lines (two walls plus the floor line… or the base), the two top-of-wall corners each have three lines, and the roof peak has two. Count carefully on your own drawing: if the two lower corners are the only odd vertices, you start at one and end at the other. The well-known “house of Nikolaus” puzzle works exactly like this: it has two odd vertices, so you must start at one and end at the other. Add the extra crossing lines that make four odd vertices and the puzzle becomes impossible.

Odd vertices Result Where to start
0 Circuit exists Anywhere, you finish at the start
2 Path exists At one odd vertex, finish at the other
4 or more No solution Not possible
1 or 3 Cannot happen in a normal graph Recount

If you count one or three, you have miscounted. Odd vertices always come in pairs.

How to trace the route

Once you know the puzzle is solvable, you still need to draw it without getting stranded. Easy puzzles often fall to trial and error from an odd vertex. Larger figures need a rule.

Fleury’s rule: do not burn your bridges

The reliable hand method is Fleury’s algorithm:

  1. Count the odd vertices. If there are two, start at one. If none, start anywhere.
  2. At each step, choose an edge whose removal will not cut off the rest of the figure. In graph terms, avoid a “bridge”, an edge that is the only link between two parts.
  3. Travel along it and mark it as used.
  4. Take a bridge only when nothing else is left at your current vertex.
  5. Keep going until every edge is used.

The reason is that crossing a bridge commits you to finishing on the far side. If you cross early, whatever you left behind is unreachable.

A good check at the end: count the edges in the figure before you start, then count the steps in your route. They must match. The OpenStax worked example does this on a graph with odd vertices c and f and produces the route c, b, a, c, d, b, f, e, h, i, g, f.

The loop-splicing method

An alternative is easier on bigger puzzles. Start at a vertex and keep following unused lines until you return to where you began. That gives a closed loop. If some vertex on the loop still has unused lines, start a second loop from there and splice it in. Repeat until every edge is used. For example, a first loop ABCGFA and a second loop CDEC combine into ABCDECGFA.

For a puzzle with two odd vertices, imagine a temporary extra line joining them. That makes every vertex even, so you can find a full circuit, then remove the imagined line to leave your path. This is the idea behind Hierholzer’s algorithm, which is quicker than Fleury’s and is what computer solvers use.

The loop-splicing method

When the puzzle has no solution

If you count four or more odd vertices, stop. No amount of retrying will work. The Five Rooms Puzzle is an example: it has more than two odd vertices, so no Euler path exists.

Your options:

  • Check the rules. Perhaps not every line has to be used, or a line may be drawn twice. That is a different puzzle.
  • Recount. Dangling ends and lines that cross without a junction are common mistakes. A crossing is only a vertex if the lines actually meet there.
  • Change the figure. Königsberg shows how little it takes: adding or removing one bridge between two landmasses leaves exactly two odd vertices, so a path appears.

If you want a break from line puzzles, other logic games work the same muscles. A murder mystery logic puzzle game is one example of deduction without drawing.

How a solver finds the route

Software does not guess. A solver first checks the degree count, then runs Hierholzer’s algorithm. It follows edges until it returns to its start, then splices in sub-tours from any vertex that still has unused edges. For a path, it starts at one of the two odd vertices. With suitable data structures it runs in linear time, proportional to the number of edges.

This is a useful contrast with a different puzzle type, the Hamiltonian path, which asks you to visit every vertex once. Checking degrees plus connectivity takes time proportional to vertices plus edges, so Eulerian puzzles can be settled quickly, unlike Hamiltonian ones.

Practise on real levels

The test and the tracing rules are easiest to learn by playing. Our puzzle game, Tracers: One Line Puzzle, is a one-line puzzle for Android where each level is a figure to draw in a single stroke. We are an independent studio in Western Australia, and the app has its own plain-English privacy policy, so you can see what data it handles. If you want to compare notes on strategy, our guide to solving every draw-one-line level walks through the approach, and you can contact the developer directly.

Sardarjidevelopers

Before each level, count the odd vertices, pick your start, and keep bridges for last. After a few levels the count becomes automatic.

FAQ

What is the difference between an Euler path and an Euler circuit?

An Euler path uses every edge once and ends at a different vertex from where it began. An Euler circuit also uses every edge once but returns to the start. A path needs exactly two odd vertices, a circuit needs none.

Can I start anywhere in a one-stroke puzzle?

Only if every vertex is even. If two vertices are odd, you must start at one of them and will finish at the other. Starting elsewhere guarantees you get stuck.

Why can’t a puzzle have exactly one odd vertex?

Every edge adds one to the degree of two vertices, so the total of all degrees is always even. That forces the number of odd vertices to be even too: 0, 2, 4 and so on.

Is an Eulerian path the same as a Hamiltonian path?

No. An Eulerian path covers every edge once, while a Hamiltonian path visits every vertex once. Eulerian puzzles have a simple degree test, and Hamiltonian ones do not.

Sources

Recommended