Eulerian graph Created 2026-09-24 Updated 2026-10-14
An Eulerian graph has an Euler circuit: a closed trail traversing every edge exactly once. Here the graph is a finite undirected graph, possibly a multigraph with self-loops. Parallel edges retain distinct identities, and each self-loop contributes two to its vertex degree. Repeated vertices are allowed. This models inspecting every road segment once, even when a junction must be revisited.
For a nonempty set of edges, the Euler circuit criterion requires a connected graph only on the edge support of a graph: isolated vertices impose no travel requirement. A single vertex with a self-loop and two vertices joined by two parallel edges are both Eulerian graphs. Neither requires three vertices. With no edges and at least one vertex, we allow the zero-length trail at that vertex as an Euler circuit; the graph with no vertices has no such walk.
The motivating Seven Bridges of Königsberg problem asks for an Eulerian trail, which need not return to its starting vertex. In Leonhard Euler's Solutio problematis ad geometriam situs pertinentis by Leonhard Euler, §2 poses the bridge-crossing question and §§4–6 encode land regions by letters. The river's shape drops out: only the connections matter. The paper was written in 1735 and published in 1741, according to the Euler Archive; the journal volume carries the nominal year 1736.[ref]
Eulerian trail 2026-10-14
An Eulerian trail, also called an Eulerian path, is a trail in a graph traversing every edge exactly once. The name Eulerian path does not require a graph path: vertices may repeat. A Hamiltonian path instead visits every vertex exactly once, and may omit edges. An Eulerian trail may omit isolated vertices, so these are different coverage requirements.
For a finite undirected multigraph with at least one edge, allowing self-loops, an Eulerian trail exists exactly when the edge support of a graph is a connected graph and there are zero or two vertices of odd vertex degree. In the two-odd-vertex case they must be the two distinct endpoints; in the zero-odd-vertex case every Eulerian trail is an Euler circuit. Count a self-loop twice in the vertex degree but once in the trail, and count each parallel edge separately.[ref]
The parity obstruction is local: each intermediate visit pairs an arriving edge with a departing edge. Only the distinct endpoints can have an unpaired incidence. The handshaking lemma, , also shows that the number of vertices with odd vertex degree is even. Sufficiency in the two-endpoint case reduces to the Euler circuit criterion: add one extra edge between the odd vertices, construct an Euler circuit, rotate its record to start with the extra edge, then delete that edge. The remaining trail has the required endpoints.
For the Seven Bridges of Königsberg multigraph, the vertex degrees at are , so no Eulerian trail exists. Remove the unique edge : the vertex degrees become , and a six-edge Eulerian trail runs from to . Label the parallel edges between and between ; label by and by . A complete record is . It revisits while using every remaining edge once.
Figure 1.
Four odd vertex degrees forbid an Eulerian trail; two allow distinct endpoints; zero allow an Euler circuit
. Details.
Hamilton cycle Created 2026-09-24 Updated 2026-10-14
A Hamilton cycle, also called a Hamiltonian cycle, is a cycle in a graph containing every vertex of the graph. Here the convention is a finite simple graph whose edges are undirected, with . A traversal is a sequence
where are all the distinct vertices and for . Thus "once" means once before the closing return: the start appears again at the end, and there are exactly traversed edges. The graph may contain additional unused edges.[ref]
A Hamiltonian path visits all vertices once without requiring a return. Removing an edge from a Hamilton cycle gives a Hamiltonian path; a particular Hamiltonian path closes only if its endpoints are adjacent. An Euler circuit instead traverses every edge exactly once and can revisit vertices midway. The two requirements are independent, as these original labelled examples show.
Figure 1.
Two graphs separate Hamilton cycle vertex coverage from Euler circuit edge coverage; arrows mark traversal order, not directed edges
. Details.
For the complete graph , use and , where abbreviates the unordered pair . The route is a Hamilton cycle: it visits every vertex and uses four of the six edges, omitting and . It is not an Euler circuit, and the graph admits no Euler circuit at all: every vertex degree is three, contradicting the Euler circuit criterion. The crossing of the drawn diagonals is not another vertex.
Conversely, take two triangles in a graph sharing only , with and . The route is an Euler circuit, using all six edges once; the vertex degrees are . It cannot be a Hamilton cycle, since occurs midway as well as at the start and end. More strongly, no Hamilton cycle exists: is a cut vertex, and deleting it leaves the two separate edges and . Nevertheless, is a Hamiltonian path, whose endpoints are not adjacent.
Hierholzer's algorithm 2026-10-14
Hierholzer's algorithm constructs an Euler circuit by growing closed trails along unused edges and splicing them at shared vertices, as in the Euler circuit criterion. Each edge must have a distinct record. An implementation using adjacency lists, a stack, and a used flag for each edge runs in time, including the connectivity and vertex degree checks. Store both incidences of a self-loop, while marking its single edge record used only once.
Line graph of a regular graph is Eulerian Created 2026-09-24 Updated 2026-09-24
If is connected and -regular, then is connected and every one of its vertices has degree . The Euler circuit criterion therefore applies.
A graph is Eulerian graph if it has a closed trail containing every edge exactly once. For a graph with at least three vertices, the Euler circuit criterion says that it is Eulerian exactly when it is connected and every vertex has even degree.
Necessity is immediate: each visit of a closed trail to a vertex uses one entering and one leaving edge, so the incident edges occur in pairs; the trail also joins every vertex incident with an edge. Conversely, start at any vertex and extend an edge-simple trail until no unused incident edge remains. Even degrees force this maximal trail to end where it began. If edges remain, connectedness supplies a vertex of this circuit incident with an unused edge. Construct another closed trail from there and splice it into the first. Repeating consumes every edge and gives an Euler circuit.
The line graph has vertex set , with two vertices adjacent when the corresponding edges of share an endpoint. If is connected and -regular, then is connected, and the vertex corresponding to an edge has degree
Every degree is even, so the Euler circuit criterion makes Eulerian.