HOME

TheInfoList



OR:

In
graph theory In mathematics and computer science, graph theory is the study of ''graph (discrete mathematics), graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of ''Vertex (graph ...
, an Eulerian trail (or Eulerian path) is a
trail A trail, also known as a path or track, is an unpaved lane or a small paved road (though it can also be a route along a navigable waterways) generally not intended for usage by motorized vehicles, usually passing through a natural area. Ho ...
in a finite
graph Graph may refer to: Mathematics *Graph (discrete mathematics), a structure made of vertices and edges **Graph theory, the study of such graphs and their properties *Graph (topology), a topological space resembling a graph in the sense of discret ...
that visits every edge exactly once (allowing for revisiting vertices). Similarly, an Eulerian circuit or Eulerian cycle is an Eulerian trail that starts and ends on the same vertex. They were first discussed by
Leonhard Euler Leonhard Euler ( ; ; ; 15 April 170718 September 1783) was a Swiss polymath who was active as a mathematician, physicist, astronomer, logician, geographer, and engineer. He founded the studies of graph theory and topology and made influential ...
while solving the famous
Seven Bridges of Königsberg The Seven Bridges of Königsberg is a historically notable problem in mathematics. Its negative resolution by Leonhard Euler, in 1736, laid the foundations of graph theory and prefigured the idea of topology. The city of Königsberg in Prussia ...
problem in 1736. The problem can be stated mathematically like this: :Given the graph in the image, is it possible to construct a
path A path is a route for physical travel – see Trail. Path or PATH may also refer to: Physical paths of different types * Bicycle path * Bridle path, used by people on horseback * Course (navigation), the intended path of a vehicle * Desir ...
(or a cycle; i.e., a path starting and ending on the same vertex) that visits each edge exactly once? Euler proved that a necessary condition for the existence of Eulerian circuits is that all vertices in the graph have an even degree, and stated without proof that connected graphs with all vertices of even degree have an Eulerian circuit. The first complete proof of this latter claim was published posthumously in 1873 by Carl Hierholzer. This is known as Euler's Theorem: :A connected graph has an Euler cycle
if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either bo ...
every vertex has an even number of incident edges. The term Eulerian graph has two common meanings in graph theory. One meaning is a graph with an Eulerian circuit, and the other is a graph with every vertex of even degree. These definitions coincide for connected graphs. For the existence of Eulerian trails it is necessary that zero or two vertices have an odd degree; this means the Königsberg graph is ''not'' Eulerian. If there are no vertices of odd degree, all Eulerian trails are circuits. If there are exactly two vertices of odd degree, all Eulerian trails start at one of them and end at the other. A graph that has an Eulerian trail but not an Eulerian circuit is called semi-Eulerian.


Definition

An Eulerian trail,Some people reserve the terms ''path'' and ''cycle'' to mean ''non-self-intersecting'' path and cycle. A (potentially) self-intersecting path is known as a trail or an open walk; and a (potentially) self-intersecting cycle, a circuit or a closed walk. This ambiguity can be avoided by using the terms Eulerian trail and Eulerian circuit when self-intersection is allowed. or Euler walk, in an
undirected graph In discrete mathematics, particularly in graph theory, a graph is a structure consisting of a set of objects where some pairs of the objects are in some sense "related". The objects are represented by abstractions called '' vertices'' (also call ...
is a walk that uses each edge exactly once. If such a walk exists, the graph is called traversable or semi-eulerian. An Eulerian cycle, also called an Eulerian circuit or Euler tour, in an undirected graph is a cycle that uses each edge exactly once. If such a cycle exists, the graph is called Eulerian or unicursal. The term "Eulerian graph" is also sometimes used in a weaker sense to denote a graph where every vertex has even degree. For finite connected graphs the two definitions are equivalent, while a possibly unconnected graph is Eulerian in the weaker sense if and only if each connected component has an Eulerian cycle. For directed graphs, "path" has to be replaced with '' directed path'' and "cycle" with ''
directed cycle Direct may refer to: Mathematics * Directed set, in order theory * Direct limit of (pre), sheaves * Direct sum of modules, a construction in abstract algebra which combines several vector spaces Computing * Direct access (disambiguation), a ...
''. The definition and properties of Eulerian trails, cycles and graphs are valid for multigraphs as well. An Eulerian orientation of an undirected graph ''G'' is an assignment of a direction to each edge of ''G'' such that, at each vertex ''v'', the indegree of ''v'' equals the outdegree of ''v''. Such an orientation exists for any undirected graph in which every vertex has even degree, and may be found by constructing an Euler tour in each connected component of ''G'' and then orienting the edges according to the tour. Every Eulerian orientation of a connected graph is a
strong orientation In graph theory, a strong orientation of an undirected graph is an assignment of a direction to each edge (an Orientation (graph theory), orientation) that makes it into a strongly connected graph. Strong orientations have been applied to the des ...
, an orientation that makes the resulting directed graph
strongly connected In the mathematical theory of directed graphs, a graph is said to be strongly connected if every vertex is reachable from every other vertex. The strongly connected components of a directed graph form a partition into subgraphs that are thems ...
.


Properties

*An undirected graph has an Eulerian cycle if and only if every vertex has even degree, and all of its vertices with nonzero degree belong to a single connected component. *An undirected graph can be decomposed into edge-disjoint cycles if and only if all of its vertices have even degree. So, a graph has an Eulerian cycle if and only if it can be decomposed into edge-disjoint cycles and its nonzero-degree vertices belong to a single connected component. *An undirected graph has an Eulerian trail if and only if exactly zero or two vertices have odd degree, and all of its vertices with nonzero degree belong to a single connected component. *A directed graph has an Eulerian cycle if and only if every vertex has equal in degree and out degree, and all of its vertices with nonzero degree belong to a single
strongly connected component In the mathematics, mathematical theory of directed graphs, a graph is said to be strongly connected if every vertex is reachability, reachable from every other vertex. The strongly connected components of a directed graph form a partition of a s ...
. Equivalently, a directed graph has an Eulerian cycle if and only if it can be decomposed into edge-disjoint
directed cycle Direct may refer to: Mathematics * Directed set, in order theory * Direct limit of (pre), sheaves * Direct sum of modules, a construction in abstract algebra which combines several vector spaces Computing * Direct access (disambiguation), a ...
s and all of its vertices with nonzero degree belong to a single strongly connected component. *A directed graph has an Eulerian trail if and only if at most one vertex has at most one vertex has every other vertex has equal in-degree and out-degree, and all of its vertices with nonzero degree belong to a single connected component of the underlying undirected graph.


Constructing Eulerian trails and circuits


Fleury's algorithm

Fleury's algorithm is an elegant but inefficient algorithm that dates to 1883. Consider a graph known to have all edges in the same component and at most two vertices of odd degree. The algorithm starts at a vertex of odd degree, or, if the graph has none, it starts with an arbitrarily chosen vertex. At each step it chooses the next edge in the path to be one whose deletion would not disconnect the graph, unless there is no such edge, in which case it picks the remaining edge left at the current vertex. It then moves to the other endpoint of that edge and deletes the edge. At the end of the algorithm there are no edges left, and the sequence from which the edges were chosen forms an Eulerian cycle if the graph has no vertices of odd degree, or an Eulerian trail if there are exactly two vertices of odd degree. While the ''graph traversal'' in Fleury's algorithm is linear in the number of edges, i.e. O(, E, ), we also need to factor in the complexity of detecting
bridge A bridge is a structure built to Span (engineering), span a physical obstacle (such as a body of water, valley, road, or railway) without blocking the path underneath. It is constructed for the purpose of providing passage over the obstacle, whi ...
s. If we are to re-run Tarjan's linear time bridge-finding algorithm after the removal of every edge, Fleury's algorithm will have a time complexity of O(, E, ^2). A dynamic bridge-finding algorithm of allows this to be improved to O(, E, \cdot \log^3 , E, \cdot \log \log , E, ), but this is still significantly slower than alternative algorithms.


Hierholzer's algorithm

Hierholzer's 1873 paper provides a different method for finding Euler cycles that is more efficient than Fleury's algorithm: *Choose any starting vertex ''v'', and follow a trail of edges from that vertex until returning to ''v''. It is not possible to get stuck at any vertex other than ''v'', because the even degree of all vertices ensures that, when the trail enters another vertex ''w'' there must be an unused edge leaving ''w''. The tour formed in this way is a closed tour, but may not cover all the vertices and edges of the initial graph. *As long as there exists a vertex ''u'' that belongs to the current tour but that has adjacent edges not part of the tour, start another trail from ''u'', following unused edges until returning to ''u'', and join the tour formed in this way to the previous tour. *Since we assume the original graph is connected, repeating the previous step will exhaust all edges of the graph. By using a data structure such as a doubly linked list to maintain the set of unused edges incident to each vertex, to maintain the list of vertices on the current tour that have unused edges, and to maintain the tour itself, the individual operations of the algorithm (finding unused edges exiting each vertex, finding a new starting vertex for a tour, and connecting two tours that share a vertex) may be performed in constant time each, so the overall algorithm takes
linear time In theoretical computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations ...
, O(, E, ). This algorithm may also be implemented with a deque. Because it is only possible to get stuck when the deque represents a closed tour, one should rotate the deque by removing edges from the tail and adding them to the head until unstuck, and then continue until all edges are accounted for. This also takes linear time, as the number of rotations performed is never larger than , E, (intuitively, any "bad" edges are moved to the head, while fresh edges are added to the tail)


Counting Eulerian circuits


Complexity issues

The number of Eulerian circuits in '' digraphs'' can be calculated using the so-called BEST theorem, named after de Bruijn, van Aardenne-Ehrenfest, Smith and Tutte. The formula states that the number of Eulerian circuits in a digraph is the product of certain degree factorials and the number of rooted arborescences. The latter can be computed as a
determinant In mathematics, the determinant is a Scalar (mathematics), scalar-valued function (mathematics), function of the entries of a square matrix. The determinant of a matrix is commonly denoted , , or . Its value characterizes some properties of the ...
, by the
matrix tree theorem In the mathematics, mathematical field of graph theory, Kirchhoff's theorem or Kirchhoff's matrix tree theorem named after Gustav Kirchhoff is a theorem about the number of spanning trees in a graph (discrete mathematics), graph, showing that this ...
, giving a polynomial time algorithm. BEST theorem is first stated in this form in a "note added in proof" to the Aardenne-Ehrenfest and de Bruijn paper (1951). The original proof was
bijective In mathematics, a bijection, bijective function, or one-to-one correspondence is a function between two sets such that each element of the second set (the codomain) is the image of exactly one element of the first set (the domain). Equival ...
and generalized the de Bruijn sequences. It is a variation on an earlier result by Smith and Tutte (1941). Counting the number of Eulerian circuits on ''undirected'' graphs is much more difficult. This problem is known to be #P-complete. In a positive direction, a
Markov chain Monte Carlo In statistics, Markov chain Monte Carlo (MCMC) is a class of algorithms used to draw samples from a probability distribution. Given a probability distribution, one can construct a Markov chain whose elements' distribution approximates it – that ...
approach, via the ''Kotzig transformations'' (introduced by Anton Kotzig in 1968) is believed to give a sharp approximation for the number of Eulerian circuits in a graph, though as yet there is no proof of this fact (even for graphs of bounded degree).


Special cases

An asymptotic formula for the number of Eulerian circuits in the
complete graph In the mathematical field of graph theory, a complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge. A complete digraph is a directed graph in which every pair of distinct vertices i ...
s was determined by
McKay McKay, MacKay or Mackay is a Scottish and Irish surname. The last phoneme in the name is traditionally pronounced to rhyme with 'eye', but in some parts of the world this has come to rhyme with 'hey'. In Scotland, it corresponds to Clan Mackay. ...
and Robinson (1995): : \operatorname(K_n) = 2^\pi^ e^ n^ \bigl(1+O(n^)\bigr). A similar formula was later obtained by M.I. Isaev (2009) for
complete bipartite graph In the mathematical field of graph theory, a complete bipartite graph or biclique is a special kind of bipartite graph where every vertex of the first set is connected to every vertex of the second set..Electronic edition page 17. Graph theory ...
s: : \operatorname(K_) = \left(\frac-1\right)!^ 2^\pi^ n^ \bigl(1+O(n^)\bigr).


Applications

Eulerian trails are used in
bioinformatics Bioinformatics () is an interdisciplinary field of science that develops methods and Bioinformatics software, software tools for understanding biological data, especially when the data sets are large and complex. Bioinformatics uses biology, ...
to reconstruct the
DNA sequence A nucleic acid sequence is a succession of bases within the nucleotides forming alleles within a DNA (using GACT) or RNA (GACU) molecule. This succession is denoted by a series of a set of five different letters that indicate the order of the nu ...
from its fragments. They are also used in
CMOS Complementary metal–oxide–semiconductor (CMOS, pronounced "sea-moss ", , ) is a type of MOSFET, metal–oxide–semiconductor field-effect transistor (MOSFET) semiconductor device fabrication, fabrication process that uses complementary an ...
circuit design to find an optimal
logic gate A logic gate is a device that performs a Boolean function, a logical operation performed on one or more binary inputs that produces a single binary output. Depending on the context, the term may refer to an ideal logic gate, one that has, for ...
ordering. There are some algorithms for processing
tree In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, e.g., including only woody plants with secondary growth, only ...
s that rely on an Euler tour of the tree (where each edge is treated as a pair of arcs). The de Bruijn sequences can be constructed as Eulerian trails of de Bruijn graphs.


In infinite graphs

In an infinite graph, the corresponding concept to an Eulerian trail or Eulerian cycle is an Eulerian line, a doubly-infinite trail that covers all of the edges of the graph. It is not sufficient for the existence of such a trail that the graph be connected and that all vertex degrees be even; for instance, the infinite
Cayley graph In mathematics, a Cayley graph, also known as a Cayley color graph, Cayley diagram, group diagram, or color group, is a Graph (discrete mathematics), graph that encodes the abstract structure of a group (mathematics), group. Its definition is sug ...
shown, with all vertex degrees equal to four, has no Eulerian line. The infinite graphs that contain Eulerian lines were characterized by . For an infinite graph or multigraph to have an Eulerian line, it is necessary and sufficient that all of the following conditions be met: * is connected. * has
countable set In mathematics, a set is countable if either it is finite or it can be made in one to one correspondence with the set of natural numbers. Equivalently, a set is ''countable'' if there exists an injective function from it into the natural numbe ...
s of vertices and edges. * has no vertices of (finite) odd degree. *Removing any finite subgraph from leaves at most two infinite connected components in the remaining graph, and if has even degree at each of its vertices then removing leaves exactly one infinite connected component.


Undirected Eulerian graphs

Euler stated a necessary condition for a finite graph to be Eulerian as all vertices must have even degree. Hierholzer proved this is a sufficient condition in a paper published in 1873. This leads to the following necessary and sufficient statement for what a finite graph must have to be Eulerian: An undirected connected finite graph is Eulerian if and only if every vertex of G has even degree. The following result was proved by Veblen in 1912: An undirected connected graph is Eulerian if and only if it is the disjoint union of some cycles.Hierholzer developed a linear time algorithm for constructing an Eulerian tour in an undirected graph.


Directed Eulerian graphs

It is possible to have a directed graph that has all even out-degrees but is not Eulerian. Since an Eulerian circuit leaves a vertex the same number of times as it enters that vertex, a necessary condition for an Eulerian circuit to exist is that the in-degree and out-degree are equal at each vertex. Obviously, connectivity is also necessary. König proved that these conditions are also sufficient. That is, a directed graph is Eulerian if and only if it is connected and the in-degree and out-degree are equal at each vertex. In this theorem it doesn't matter whether "connected" means "weakly connected" or "strongly connected" since they are equivalent for Eulerian graphs. Hierholzer's linear time algorithm for constructing an Eulerian tour is also applicable to directed graphs.


Mixed Eulerian graphs

All
mixed graphs Mixed is the past tense of ''mix''. Mixed may refer to: * Mixed (United Kingdom ethnicity category), an ethnicity category that has been used by the United Kingdom's Office for National Statistics since the 2001 Census Music * ''Mixed'' (album) ...
that are both even and symmetric are guaranteed to be Eulerian. However, this is not a necessary condition, as it is possible to construct a non-symmetric, even graph that is Eulerian. Ford and Fulkerson proved in 1962 in their book ''Flows in Networks'' a necessary and sufficient condition for a graph to be Eulerian, viz., that every vertex must be even and satisfy the balance condition, i.e. for every subset of vertices S, the difference between the number of arcs leaving S and entering S must be less than or equal to the number of edges incident with S. The process of checking if a mixed graph is Eulerian is harder than checking if an undirected or directed graph is Eulerian because the balanced set condition concerns every possible subset of vertices.


Eulerian cycles and bridges

Define an Eulerian graph as a graph with an Eulerian cycle. Every Eulerian graph is a bridgeless graph. This is because in an Eulerian graph every edge is a part of an Eulerian cycle. Hence, if the edge is deleted, then its endpoints remain connected through the rest of the cycle. But the opposite is not true. Define an almost Eulerian graph as a graph that can be made Eulerian by adding a single edge (equivalently, a graph that contains an Eulerian trail). Every almost-Eulerian graph is almost-bridgeless, but the opposite is not true. The classes of bridgeless graphs and almost-Eulerian graphs have a non-empty intersection (the Eulerian graphs are both bridgeless and almost-Eulerian), but they do not contain each other.


See also

* Eulerian matroid, an abstract generalization of Eulerian graphs * Five room puzzle * Handshaking lemma, proven by Euler in his original paper, showing that any undirected connected graph has an even number of odd-degree vertices *
Hamiltonian path In the mathematical field of graph theory, a Hamiltonian path (or traceable path) is a path in an undirected or directed graph that visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is a cycle that visits each vert ...
– a path that visits each ''vertex'' exactly once. *
Route inspection problem In graph theory and combinatorial optimization, Guan's route problem, the Chinese postman problem, postman tour or route inspection problem is to find a shortest closed path or circuit that visits every edge of an (connected) undirected graph at ...
, search for the shortest path that visits all edges, possibly repeating edges if an Eulerian path does not exist. * Veblen's theorem, which states that graphs with even vertex degree can be partitioned into edge-disjoint cycles regardless of their connectivity


Notes


References


Bibliography

*. Translated as . * Euler, L.,
Solutio problematis ad geometriam situs pertinentis
, ''Comment. Academiae Sci. I. Petropolitanae'' 8 (1736), 128–140. *. * Lucas, E., ''Récréations Mathématiques IV'', Paris, 1921. * Fleury, "Deux problemes de geometrie de situation", ''Journal de mathematiques elementaires'' (1883), 257–261. * T. van Aardenne-Ehrenfest and N. G. de Bruijn (1951) "Circuits and trees in oriented linear graphs",
Simon Stevin Simon Stevin (; 1548–1620), sometimes called Stevinus, was a County_of_Flanders, Flemish mathematician, scientist and music theorist. He made various contributions in many areas of science and engineering, both theoretical and practical. He a ...
28: 203–217. * * W. T. Tutte and C. A. B. Smith (1941) "On Unicursal Paths in a Network of Degree 4",
American Mathematical Monthly ''The American Mathematical Monthly'' is a peer-reviewed scientific journal of mathematics. It was established by Benjamin Finkel in 1894 and is published by Taylor & Francis on behalf of the Mathematical Association of America. It is an exposi ...
48: 233–237.


External links

{{Commons category, Eulerian paths
Discussion of early mentions of Fleury's algorithm

''Euler tour''
at
Encyclopedia of Mathematics The ''Encyclopedia of Mathematics'' (also ''EOM'' and formerly ''Encyclopaedia of Mathematics'') is a large reference work in mathematics. Overview The 2002 version contains more than 8,000 entries covering most areas of mathematics at a graduat ...
. Graph theory objects Leonhard Euler