Lecture 3
Lecture 3
Example,
𝑇𝑇 ′ = 𝑉𝑉, 𝐸𝐸 ′ ,
𝐸𝐸 ′ = 𝑐𝑐, 𝑏𝑏 , 𝑏𝑏, 𝑎𝑎 , 𝑎𝑎, 𝑒𝑒 , 𝑒𝑒, 𝑑𝑑
𝑇𝑇 ′′ = 𝑉𝑉, 𝐸𝐸 ′′ ,
𝐸𝐸 ′′ = { 𝑎𝑎, 𝑏𝑏 , 𝑏𝑏, 𝑑𝑑 , 𝑑𝑑, 𝑒𝑒 , (𝑒𝑒, 𝑐𝑐)}
Euler path/cycle
Definition
An Euler path in a graph 𝐺𝐺 is a path that contains all vertices of the
graph and passes trough every edge of 𝐺𝐺 exactly once. An Euler path
is Euler cycle if it starts and ends in the same vertex.
Example
No Euler cycle,
no Euler path
No Euler cycle
Euler cycle - a, e, c, d, e, b, a Euler path - a, c, d, e, b, d, a, b.
It is evident that a necessary condition for Euler cycle/path is the
connectedness of the graph. But this is not sufficient condition.
Euler theorem
A graph with at least two vertices has an Euler cycle if and only if it is
connected and each of its vertices has even degree.
Proof.
Necessity
Let a graph 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) has an Euler cycle. It follows that it is
connected. We move through the Euler cycle and count the vertex
degrees. Since all the edges are different, then passing through a
vertex, add 2 to its degree. All edges belong to the cycle, hence
passing through the last edge of the cycle, all degrees will be
counted, and thus, - it will be an even number.
Sufficiency
Let a graph 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) is connected and the degree of each vertex is
even. We prove that 𝐺𝐺 has an Euler cycle.
Consider the longest path in 𝐺𝐺 (the edges are all different), let it be:
𝑃𝑃: 𝑣𝑣1 , 𝑣𝑣2 , …,𝑣𝑣𝑘𝑘 . Prove that that 𝑣𝑣1 = 𝑣𝑣𝑘𝑘 .
Suppose that 𝑣𝑣1 ≠ 𝑣𝑣𝑘𝑘 . Since odd number of edges are adjacent to 𝑣𝑣1
in 𝑃𝑃, but the degree of 𝑣𝑣1 is even, then there must be an edge
(𝑢𝑢, 𝑣𝑣1 ) adjacent to 𝑣𝑣1 , which does not belong to 𝑃𝑃 . Then, the path
𝑢𝑢, 𝑣𝑣1 , 𝑣𝑣2 , …,𝑣𝑣𝑘𝑘 in 𝐺𝐺 is longer than 𝑃𝑃 . This contradicts the fact that
𝑃𝑃 is a longest path.
Therefore, 𝑃𝑃 is a cycle. Now we prove that 𝑃𝑃 is an Euler cycle, i.e.
contains all the edges of 𝐺𝐺.
Make a contradictory assumption – suppose there exists an edge
(𝑢𝑢1 , 𝑢𝑢2 ) , not belonging to 𝑃𝑃 . Then,
1. Either 𝑢𝑢1 or 𝑢𝑢2 belongs to P, which will bring to a longer path, -
this is a contradiction.
2. Both 𝑢𝑢1 and 𝑢𝑢2 do not belong to P. But, since the graph 𝐺𝐺 is
connected, there should be a path that connects 𝑢𝑢1 or 𝑢𝑢2 to P.
This will bring to a -longer path, - this is a contradiction.
Therefore, 𝑃𝑃 contains all the edges of 𝐺𝐺.□
Theorem
A connected graph 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) has an Euler path if and only the number
of odd degree vertices ≤2.
Proof.
Necessity.
Let 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) has an Euler path. If this is a cycle, then from the
previous theorem we know that the number of odd degree vertices is 0.
Now suppose an Euler path is from the vertex 𝑎𝑎 to the vertex 𝑏𝑏 of 𝐺𝐺 .
The first edge in the path adds 1 to the degree of the vertex 𝑎𝑎. Then if
the path again passes through the vertex 𝑎𝑎 (enter to the vertex, and go
out from it), it will add 2 to its degree. The last edge in the path adds 1
to the degree of the vertex 𝑏𝑏. Thus, the number of odd degree vertices
is 2.
Sufficiency.
If the number of odd degree vertices of 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) is 0, then according
to the previous theorem, 𝐺𝐺 has an Euler path.
The number of odd degree vertices could not be 1.
Now suppose that the number of odd degree vertices is 2, and let these
are the vertices 𝑎𝑎 and 𝑏𝑏 .
Let us define a graph 𝐺𝐺′ = (𝑉𝑉′, 𝐸𝐸′) in the following way:
𝑉𝑉 ′ = 𝑉𝑉 ∪ {𝑢𝑢} and 𝐸𝐸𝐸 = 𝐸𝐸 ∪ { 𝑎𝑎, 𝑢𝑢 , (𝑢𝑢, 𝑏𝑏)}.
Now the degrees of all the vertices in 𝐺𝐺𝐺 are even; and thus, it contains
an Euler cycle. Removing the vertex 𝑢𝑢 with the edges 𝑎𝑎, 𝑢𝑢 , (𝑢𝑢, 𝑏𝑏), we
obtain an Euler path in 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) □.
Euler theorem
A graph with at least two vertices has an Euler cycle if and only
if it is connected and each of its vertices has even degree.
Theorem
A connected graph 𝐺𝐺 = (𝑉𝑉, 𝐸𝐸) has an Euler path if and only the
number of odd degree vertices ≤2.
Theorem
A connected graph has an Euler path but not an Euler cycle if and
only if it has exactly two vertices of odd degree.
The problem model is a graph whose vertices are the land parts: banks and islands A, B, C, D;
and the edges are the seven bridges a, b, c, d, e, f, g. It should be passed through the edges
of the graph each one exactly once.
APPLICATIONS OF EULER PATHS AND CYCLES.
Euler paths and cycles can be used to solve many practical
problems. For example, many applications ask for a path or cycle
that traverses each street in a neighborhood, or each link in a
communications network exactly once. Finding an Euler path or
cycle in the appropriate graph model can solve such problems.
Algorithm constructing Euler Cycle (Fleury’s algorithm)
We start with an arbitrary vertex 𝑣𝑣 in the graph and move through an edge, let it
be the edge 𝑣𝑣𝑣𝑣, and assign the number 1 to this edge. Remove this edge from the
set of edges, and consider the vertex 𝑢𝑢.
In general, let 𝑤𝑤 be the vertex considered in the current step, and let 𝑘𝑘 be the
number assigned to the current edge.