Algorithmus von Hierholzer Technische Universität München
Einfacher Graph mit 4 Knoten.

Cycle without using edges twice

Computing Eulerian cycles

Being a postman, you would like to know the best route to distribute your letters without visiting a street twice? This problem of finding a cycle that visits every edge of a graph only once is called the Eulerian cycle problem. It is named after the mathematician Leonhard Euler, who solved the famous Seven Bridges of Königsberg problem in 1736.

Hierholzer's algorithm, which will be presented in this applet, finds an Eulerian tour in graphs that do contain one.

What do you want to do first?


SVG Download

Legend

Knoten Node
Knoten Undirected edge

Legend

Which graph do you want to execute the algorithm on?

Start with an example graph:

Modify it to your desire:

  • To create a node, make a double-click in the drawing area.
  • To create an edge, first click on the output node and then click on the destination node.
  • Right-clicking deletes edges and nodes.

Download the modified graph:

Download

Upload an existing graph:

A

occured when reading from file:

the contents:

                    

What next?

SVG Download

Legend

Knoten Node
Kante Undirected edge

Legend

Algorithm status

Hierholzer's algorithm

Click on nextto start the algorithm.

BEGIN

IF graph infeasible THEN END

start ← suitable node

tour ← {start}

REPEAT

current = start ← node in tour with
unvisited edge

subtour ← {start}

DO

{current, u} ← take unvisited edge

subtour ← subtour ∪ {u}

current ← u

WHILE start ≠ current

Integrate subtour in tour

UNTIL tour is Eulerian path/cycle

END

Variable status:

start current subtour tour
- -

If you switch tabs, the execution will be terminated.

You can open another browser window to read the description in parallel.