How to use this calculator
Find a trail through every undirected edge exactly once, when the graph’s degree and connectivity conditions permit it.
- Enter Node count, Undirected edge endpoints, comma separated. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Undirected Euler trail and circuit explained
Find a trail through every undirected edge exactly once, when the graph’s degree and connectivity conditions permit it.
A numerical walkthrough
Node count = 4; Undirected edge endpoints, comma separated = 1 2, 2 3, 3 1, 1 4.
- Traversed edges: 4
- Euler node sequence: 1 → 2 → 3 → 1 → 4
The model behind the numbers
Hierholzer traversal of every edge exactly once
Check for zero or two odd-degree vertices, choose a valid start, and follow unused edges while stacking vertices. Backtracking stitches the traversed cycles into a full trail. All entered edges must belong to the same nonisolated connected component.
What to enter
n— Node count- Number of available vertex labels, numbered from 1 through n.
e— Undirected edge endpoints, comma separated- Undirected endpoint pairs written as “u v”, separated by commas. Repeated pairs represent parallel edges; an edge can be traversed only once.
Interpreting the result
Parallel edges and loops are supported. Isolated vertices do not prevent an edge-covering trail; zero or two odd-degree vertices are required.
Frequently asked questions
Is this a Hamiltonian path?
No, Euler trails use every edge, while vertices may repeat.
Can an edge be reused?
No.
When is the trail a circuit?
When it starts and ends at the same vertex.
How do I use the Undirected Euler trail and circuit calculator?
Enter Node count, Undirected edge endpoints, comma separated. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Undirected Euler trail and circuit?
Node count = 4; Undirected edge endpoints, comma separated = 1 2, 2 3, 3 1, 1 4. Traversed edges: 4 Euler node sequence: 1 → 2 → 3 → 1 → 4
Method reference: NetworkX graph algorithm definitions.
Read our calculation methodology.