Advanced maths

Euler path and circuit calculator from a graph edge list

Find an Euler trail or circuit with original edge-row identities, supporting loops and parallel edges with explicit connectivity and degree diagnoses.

Your numbers

Labels start at 1. Use at most 200 rows. Repeated rows are distinct parallel edges; equal endpoints are self-loops. Blank means no edges.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

An Euler traversal uses each edge exactly once while allowing repeated vertices. This page checks the required degree and edge-bearing connectivity conditions, constructs a trail using edge identities and verifies that every original row is consumed exactly once. Directed and undirected modes use different degree rules. Parallel rows remain distinct, and a self-loop is one edge rather than an extra intermediate vertex.

THE FORMULAUndirected: connected edge-bearing part and zero or two odd degrees. Directed: balanced degrees for a circuit, or one +1 and one −1 out-minus-in imbalance for an open trail, with connectivity.

A worked example

For the undirected triangle with edges 1–2, 2–3 and 3–1, every degree is two. The walk 1→2→3→1 traverses all three rows exactly once and returns to its start, so it is an Euler circuit. Removing edge 3–1 leaves an open trail from one to three. Adding an isolated fourth vertex changes neither edge traversal, because this page tests connectivity on the nonisolated part.

Good to know

Supports 1–40 vertices and at most 200 directed or undirected edge rows. Loops and parallel edges are allowed and retain row identity. Isolated vertices do not invalidate a traversal of the edge-bearing part. With no edges, the explicit convention is a zero-length circuit at vertex one. The returned traversal is one valid choice, not a count of Euler trails. This is not a Hamiltonian path or a shortest route that may repeat edges.

An edge row has an identity even when its endpoints repeat

Two input rows 1,2 describe two different parallel edges. An undirected walk can use one to go out and the other to return, consuming each once. If the rows were collapsed into one adjacency relation, the algorithm would lose an edge and could incorrectly diagnose the parity or declare a traversal complete. The result table therefore reports the original row number at each step in addition to the two visited endpoints.

A self-loop contributes two to an undirected vertex degree but is traversed as one edge. In directed mode it contributes one incoming and one outgoing edge, leaving the imbalance unchanged. During construction the loop is marked used under its one identity, preventing a duplicate incidence entry from causing a second traversal. The final certificate checks both the count and uniqueness of consumed edge rows.

The triangle traversal consumes all three undirected edge rows exactly once123Row 1Row 2Row 3Walk: 1,2,3,1Three edges usedReturn to start
Arrows show the chosen traversal direction, not a directed input graph. The walk 1→2→3→1 uses edge rows one, two and three in order. Every vertex has even undirected degree, so this is a circuit.

The Shortest path calculator for a weighted graph edge list minimizes route cost instead of requiring each edge identity to be used exactly once.

Vertex visitation and edge traversal are separate requirements

An Euler circuit can revisit a vertex many times, so it does not solve a Hamiltonian problem that visits each vertex once. An isolated vertex has no edge to consume. This page therefore ignores isolates in the connectivity check and states that convention alongside its result. A different application that requires physically visiting every declared location would need additional routing assumptions rather than silently interpreting this edge-only answer as a complete trip.

Degree conditions alone are also insufficient if the edge-bearing graph is disconnected. Two disjoint cycles each have even degrees, yet a single trail cannot move between them without an extra edge. Directed mode similarly checks the underlying edge-bearing connectivity together with its in/out balance rules. Failed inputs return a diagnosis instead of a partial walk labeled complete. If a graph has no edges at all, the stated length-zero convention avoids presenting an arbitrary nonexistent edge or treating the empty traversal as a division error.

A few questions, answered

Does an Euler circuit have to start at a particular vertex?

Any suitable vertex on the edge-bearing component can serve as a circuit start. This page chooses deterministically; an open directed trail must respect its unique positive imbalance start.

Can the output traverse an undirected row in reverse?

Yes. Its row identity is preserved, while the From and To columns show the actual traversal direction. Directed rows can only be used in their entered direction.

Find your calculator

Start typing to explore the library.