Hierholzer’s Euler walk

Try to draw a figure in one stroke, tracing every line exactly once. If it can be done, the algorithm shows where to move the pencil. You can pass through a point more than once.

Walk along unused edges. At a dead end, record the vertex in the reversed route and backtrack. An open trail needs exactly two odd-degree vertices.

This version uses a V × V edge table. Including its initialization, time is O(V² + E). An empty result means no single trail exists.