By Lson Lee · Indie developer & puzzle game enthusiast

Euler Paths & Euler Circuits

The mathematical foundation of every one-stroke puzzle — explained simply

What Is an Euler Path?

An Euler path (also called an Eulerian trail) is a path through a graph that visits every edge exactly once. You can think of it as drawing every line in a figure without lifting your pen and without retracing any line.

Euler Path

A --- B
|     |
C --- D

Start: A → End: D (different)
Visits every edge once

Starts and ends at different vertices. Requires exactly 2 odd-degree vertices.

Euler Circuit

  A
 / \
B---C
 \ /
  D

Start: A → End: A (same)
Visits every edge once

Starts and ends at the same vertex. Requires 0 odd-degree vertices.

The key difference: an Euler path starts at one vertex and ends at another. An Euler circuit starts and ends at the same place — it's a complete loop.

Euler's Theorem: The Rules

Euler proved a simple but powerful set of rules for determining whether a graph can be traced in one stroke:

The Three Cases

Odd-Degree VerticesResultType
0Traceable — start anywhere, end where you startedEuler Circuit
2Traceable — must start at one odd vertex, end at the otherEuler Path
4, 6, 8...Not traceable in one strokeImpossible

That's it. Count the odd-degree vertices. If there are 0 or 2, the puzzle is solvable. If there are more, it's impossible. This is called the odd/even vertex rule.

What Is "Degree"?

The degree of a vertex is simply the number of edges (connections) touching it. If a vertex has 3 edges, its degree is 3 (odd). If it has 4 edges, its degree is 4 (even).

Example: A house shape

    A (degree 2 ✓ even)
   / \
  B---C    B (degree 3 ✗ odd)
  |   |    C (degree 3 ✗ odd)
  D---E    D (degree 2 ✓ even)
           E (degree 2 ✓ even)

2 odd-degree vertices (B and C)
→ Euler PATH exists: start at B, end at C

Examples: Can You Draw It in One Stroke?

Triangle

A(2)—B(2)—C(2)—A   |   All vertices degree 2 (even)

✓ Yes — Euler circuit. Start anywhere, end where you started.

The Envelope (House with X)

Square with both diagonals + triangle on top   |   Bottom corners: degree 4 (even), top corners vary

✓ Yes — Classic one-stroke challenge. Has exactly 2 odd-degree vertices.

The Königsberg Bridges

4 vertices, 7 edges   |   All 4 vertices have odd degree

✗ No — 4 odd vertices. Euler proved this impossible in 1736.

Complete Graph K₅ (Pentagon with All Diagonals)

5 vertices, 10 edges   |   Every vertex has degree 4 (even)

✓ Yes — Euler circuit. All vertices even, so you can start anywhere and return.

How One Stroke Uses Euler's Theorem

When the One Stroke app generates a new puzzle, it doesn't randomly create grids and hope they're solvable. Instead, it uses Euler's theorem to construct graphs that are mathematically guaranteed to have a solution.

The procedural generation algorithm ensures every puzzle has either 0 or 2 odd-degree vertices — meaning an Euler path or circuit always exists. This is why the game can promise infinite solvable puzzles: it's not luck, it's math.

When you're stuck on a puzzle in One Stroke, try applying Euler's rules:

Frequently Asked Questions

What is an Euler path?

An Euler path is a trail in a graph that visits every edge exactly once. It starts at one vertex and ends at a different vertex. A graph has an Euler path if and only if it has exactly two vertices with an odd degree.

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

An Euler path starts and ends at different vertices, visiting every edge once. An Euler circuit starts and ends at the same vertex, also visiting every edge once. An Euler path requires exactly 2 odd-degree vertices; an Euler circuit requires 0.

How do Euler paths relate to one-stroke puzzles?

One-stroke puzzles are essentially Euler path problems. The puzzle asks you to trace every edge exactly once — which is the definition of an Euler path or circuit. Games like One Stroke use Euler's theorem to guarantee every puzzle has a valid solution.

Is a Hamiltonian path the same as an Euler path?

No. An Euler path visits every edge exactly once. A Hamiltonian path visits every vertex exactly once. They're related but different concepts. Euler paths have a simple test (count odd vertices); Hamiltonian paths are much harder to determine (it's an NP-complete problem).

Continue Learning

Try One Stroke Free on iPhone

Infinite puzzles. Adaptive difficulty. No forced ads.

Download on the App Store
Download on the App Store