An Euler circuit (or Eulerian circuit) is a path in a graph that starts and ends at the same vertex and visits every edge exactly once. A graph has an Euler circuit if and only if it is connected and every vertex has an even degree.

Sourcecode: