1 # circuit is a global array
 2    find_euler_circuit
 3      circuitpos = 0
 4      find_circuit(node 1)
 5 
 6 # nextnode and visited is a local array
 7 # the path will be found in reverse order
 8   find_circuit(node i)
 9 
10     if node i has no neighbors then
11       circuit(circuitpos) = node i
12       circuitpos = circuitpos + 1
13     else
14       while (node i has neighbors)
15           pick a random neighbor node j of node i
16           delete_edges (node j, node i)
17           find_circuit (node j)
18       circuit(circuitpos) = node i
19       circuitpos = circuitpos + 1
20