0% found this document useful (0 votes)
135 views

Eulerian Trails and Circuits. Hamiltonian Paths and Cycles: Isabela DR Amnesc UVT

The document discusses graphs and graph theory concepts like trails, circuits, paths, and cycles. It specifically focuses on Eulerian trails and circuits. An Eulerian trail includes every edge in a graph through a trail. An Eulerian circuit does so through a closed circuit. A graph is Eulerian if it contains an Eulerian circuit. The document proves that a connected graph is Eulerian if and only if every vertex has an even degree or the edges can be partitioned into cycles. It also describes Hierholzer's algorithm for finding an Eulerian circuit in an Eulerian graph.

Uploaded by

Raluca Romanov
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views

Eulerian Trails and Circuits. Hamiltonian Paths and Cycles: Isabela DR Amnesc UVT

The document discusses graphs and graph theory concepts like trails, circuits, paths, and cycles. It specifically focuses on Eulerian trails and circuits. An Eulerian trail includes every edge in a graph through a trail. An Eulerian circuit does so through a closed circuit. A graph is Eulerian if it contains an Eulerian circuit. The document proves that a connected graph is Eulerian if and only if every vertex has an even degree or the edges can be partitioned into cycles. It also describes Hierholzer's algorithm for finding an Eulerian circuit in an Eulerian graph.

Uploaded by

Raluca Romanov
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Lecture 12

Eulerian trails and circuits.


Hamiltonian paths and cycles

Isabela Drămnesc UVT

Computer Science Department,


West University of Timişoara,
Romania

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 1 / 24


Trails, circuits, paths and cycles
Remember that ...

If G = (V , E ) is a simple graph, then


A walk or path in G is a sequence of (not necessarily distinct)
nodes v1 , v2 , . . . , vk such that (vi , vi+1 ) ∈ E for
i = 1, 2, . . . , k − 1. Such a walk is sometimes called a v1 − vk
walk.
v1 and vk are the end vertices of the walk.
If the vertices in a walk are distinct, then the walk is called a
simple path.
If the edges in a walk are distinct, then the walk is called a
trail.
A cycle is a simple path v1 , . . . , vk (where k ≥ 3) together
with the edge (vk , v1 ).
A circuit or closed trail is a trail that begins and ends at the
same node.
The length of a walk (or simple path, trail, cycle, circuit) is its
number of edges, counting repetitions.
Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 2 / 24
Eulerian trails and circuits

B An Eulerian trail in a simple graph G = (V , E ) is a trail which


includes every edge of G .
B An Eulerian circuit in a simple graph G = (V , E ) is a circuit
which includes every edge of G .
B An Eulerian graph is a simple graph which contains an
Eulerian circuit.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 3 / 24


Eulerian trails and circuits

B An Eulerian trail in a simple graph G = (V , E ) is a trail which


includes every edge of G .
B An Eulerian circuit in a simple graph G = (V , E ) is a circuit
which includes every edge of G .
B An Eulerian graph is a simple graph which contains an
Eulerian circuit.
Note that
B Cycles Cn are Eulerian graphs.
B Paths Pn have no circuits at all ⇒ Pn are not Eulerian graphs.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 3 / 24


Eulerian trails and circuits

Quiz
Which of the following graphs is Eulerian?

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 4 / 24


Eulerian trails and circuits

Quiz
Which of the following graphs is Eulerian?

Q: How can we recognize Eulerian graphs?

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 4 / 24


Eulerian trails and circuits

Quiz
Which of the following graphs is Eulerian?

Q: How can we recognize Eulerian graphs?


A: Two well-known characterizations:
1 based on node degrees
2 based on the existence of a special collection of cycles.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 4 / 24


Eulerian circuits
Characterization Theorem
For a connected graph G, the following statements are equivalent:
1 G is Eulerian.
2 Every vertex of G has even degree.
3 The edges of G can be partitioned into (edge-disjoint) cycles.
Proof of 1 ⇒ 2. Assume
B G is Eulerian ⇔ there exists a circuit that includes every edge of G
For example, v1 , v3 , v4 , v1 , v2 , v6 , v1 is a circuit in the graph below:
v2 v4 deg (v2 ) = deg (v3 ) = deg (v4 ) = deg (v6 ) = 2
v1 v5 deg (v1 ) = 4
deg (v5 ) = 0
v6 v3

Every time a circuit enters a node v on an edge, it must leave on a


different edge. Since the circuit never repeats an edge, the number of
edges incident with v is even ⇒ deg(v ) is even.
Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 5 / 24
Eulerian circuits
Proof of Characterization Theorem (continued)

Proof of 2 ⇒ 3. Suppose every node of G has even degree. We use


induction on the number of cycles in G . G is connected and without
nodes of degree 1 ⇒ G is not a tree ⇒ G has at least one cycle Cn1 .
Let G 0 be the graph obtained by removing Cn1 from G ⇒ all edges of G 0
have even degree and we can proceed recursively to prove that G 0 can be
partitioned into (edge-disjoint) cycles Cn2 , . . . , Cnk . Then
Cn1 , Cn2 , . . . , Cnk is a partition of G into (edge-disjoint) cycles.

Example

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 6 / 24


Eulerian circuits
Proof of Characterization Theorem (continued)

Proof of 2 ⇒ 3. Suppose every node of G has even degree. We use


induction on the number of cycles in G . G is connected and without
nodes of degree 1 ⇒ G is not a tree ⇒ G has at least one cycle Cn1 .
Let G 0 be the graph obtained by removing Cn1 from G ⇒ all edges of G 0
have even degree and we can proceed recursively to prove that G 0 can be
partitioned into (edge-disjoint) cycles Cn2 , . . . , Cnk . Then
Cn1 , Cn2 , . . . , Cnk is a partition of G into (edge-disjoint) cycles.

Example

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 6 / 24


Eulerian circuits
Proof of Characterization Theorem (continued)

Proof of 2 ⇒ 3. Suppose every node of G has even degree. We use


induction on the number of cycles in G . G is connected and without
nodes of degree 1 ⇒ G is not a tree ⇒ G has at least one cycle Cn1 .
Let G 0 be the graph obtained by removing Cn1 from G ⇒ all edges of G 0
have even degree and we can proceed recursively to prove that G 0 can be
partitioned into (edge-disjoint) cycles Cn2 , . . . , Cnk . Then
Cn1 , Cn2 , . . . , Cnk is a partition of G into (edge-disjoint) cycles.

Example

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 6 / 24


Eulerian circuits
Proof of Characterization Theorem (continued)

Proof of 2 ⇒ 3. Suppose every node of G has even degree. We use


induction on the number of cycles in G . G is connected and without
nodes of degree 1 ⇒ G is not a tree ⇒ G has at least one cycle Cn1 .
Let G 0 be the graph obtained by removing Cn1 from G ⇒ all edges of G 0
have even degree and we can proceed recursively to prove that G 0 can be
partitioned into (edge-disjoint) cycles Cn2 , . . . , Cnk . Then
Cn1 , Cn2 , . . . , Cnk is a partition of G into (edge-disjoint) cycles.

Example

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 6 / 24


Eulerian circuits
Proof of Characterization Theorem (continued)

Proof of 2 ⇒ 3. Suppose every node of G has even degree. We use


induction on the number of cycles in G . G is connected and without
nodes of degree 1 ⇒ G is not a tree ⇒ G has at least one cycle Cn1 .
Let G 0 be the graph obtained by removing Cn1 from G ⇒ all edges of G 0
have even degree and we can proceed recursively to prove that G 0 can be
partitioned into (edge-disjoint) cycles Cn2 , . . . , Cnk . Then
Cn1 , Cn2 , . . . , Cnk is a partition of G into (edge-disjoint) cycles.

Example

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 6 / 24


Eulerian circuits
Proof of Characterization Theorem (continued)
Proof of 3 ⇒ 1. Suppose that the edges of G can be partitioned into k edge-disjoint
cycles Cn1 , . . . , Cnk . Because G is connected, every such cycle is an Eulerian circuit
which must share a node with another cycle ⇒ these circuits can be patched until we
obtain one Eulerian circuit which is the whole graph G . 

Example

4
5 3 Cycles:

6 1 9
3,6,7,8,2,4,9,3
3,8,5,1,3
7 2 5,6,2,7,9,5
8
4,5,7,4

First 2 cycles have common node 3 ⇒ circuit


S1 = 3, 8, 5, 1, 3, 6, 7, 8, 2, 4, 9, 3
S1 shares node 6 with 3rd cycle ⇒ circuit
S2 = 3, 8, 5, 1, 3, 6, 2, 7, 9, 5, 6, 7, 8, 2, 4, 9, 3
Circuit shares node 4 with 4th cycle ⇒ Eulerian circuit
S3 = 3, 8, 5, 1, 3, 6, 2, 7, 9, 5, 6, 7, 8, 2, 4, 5, 7, 4, 9, 3
Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 7 / 24
Finding Eulerian circuits
Hierholzer’s Algorithm

The patching algorithm illustrated before is called Hierholzer’s


Algorithm. It solves the following problem:
Given: an Eulerian graph G
Find an Eulerian circuit of G .
1 Identify a circuit in G and call it R1 . Mark the edges of R1 . Let
i = 1.
2 If Ri contains all edges of G , then stop (since Ri is an Eulerian
circuit).
3 If Ri does not contain all edges of G , then let vi be a node on Ri
that is incident with an unmarked edge, ei .
4 Build a circuit, Qi , starting at node vi and using edge ei . Mark the
edges of Qi .
5 Create a new circuit, Ri+1 , by patching the circuit Qi into Ri at vi .
6 Increment i by 1, and go to step (2).

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 8 / 24


Hierholzer’s Algorithm
Illustrated example

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 9 / 24


Finding Eulerian trails

Question: How can we recognize graphs which contain an


Eulerian trail?

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 10 / 24


Finding Eulerian trails

Question: How can we recognize graphs which contain an


Eulerian trail?
Answer: Note that:
If the graph is Eulerian, then it contains an
Eulerian trail too, because every Eulerian circuit
is also a trail.
There are non-Eulerian graphs with Eulerian
trails.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 10 / 24


Finding Eulerian trails

Question: How can we recognize graphs which contain an


Eulerian trail?
Answer: Note that:
If the graph is Eulerian, then it contains an
Eulerian trail too, because every Eulerian circuit
is also a trail.
There are non-Eulerian graphs with Eulerian
trails.

Corollary
A connected graph G contains an Eulerian trail if and only if there
are at most two vertices of odd degree.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 10 / 24


Fleury’s algorithm
Given a graph G with an Eulerian circuit or path
Find a corresponding circuit or trail.
Initially, all edges are unmarked.
1 Choose a node v and call it the lead node.
2 If all edges of G have been marked, then stop. Otherwise continue
with next step.
3 Among all edges incident with the lead node, choose, if possible, one
that is not a bridge of the subgraph formed by the unmarked edges.
If this is not possible, choose any edge incident with the lead node.
Mark this edge and let its other end node be the new lead node.
4 Go to step (2).

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 11 / 24


Fleury’s algorithm
Given a graph G with an Eulerian circuit or path
Find a corresponding circuit or trail.
Initially, all edges are unmarked.
1 Choose a node v and call it the lead node.
2 If all edges of G have been marked, then stop. Otherwise continue
with next step.
3 Among all edges incident with the lead node, choose, if possible, one
that is not a bridge of the subgraph formed by the unmarked edges.
If this is not possible, choose any edge incident with the lead node.
Mark this edge and let its other end node be the new lead node.
4 Go to step (2).
Remarks:
Step 2 is performed |E | times, where |E | is the nr. of edges of G .
In general, detecting if e ∈ E is a bridge has complexity O(|E |2 )
⇒ Fleury’s algorithm has complexity O(|E |3 ).
Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 11 / 24
Finding Eulerian circuits
Exercises

1 For each of the following, draw an Eulerian graph that


satisfies the conditions, or prove that no such graph exists.
(a) An even number of vertices, an even number of edges.
(b) An even number of vertices, an odd number of edges.
(c) An odd number of vertices, an even number of edges.
(d) An odd number of vertices, an odd number of edges.
2 Use Hierholzer’s algorithm to find an Eulerian circuit in the
following graph. Use R1 = a, b, c, g , f , j, i, e, a as your initial
circuit.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 12 / 24


Finding Eulerian circuits
Exercises

1 Use Fleury’s algorithm to find an Eulerian circuit for the graph


depicted below. Let a be your initial node.

2 Prove that if every edge of a graph G lies on an odd number


of cycles, then G is Eulerian.
3 Let G = Km,n .
1 Find conditions on m and n that characterize when G will have
an Eulerian trail.
2 Find conditions that characterize when G will be Eulerian.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 13 / 24


Hamiltonian paths and cycles

A Hamiltonian path P of a simple graph G is a simple path


that contains all nodes of G .
A traceable graph is a simple graph containing a Hamiltonian
path.
A Hamiltonian cycle of a graph is a cycle that contains all
nodes of the graph.
A Hamiltonian graph is a graph containing a Hamiltonian
cycle.
Remarks
1 All Hamiltonian graphs are traceable.
2 There are traceable graphs which are not Hamiltonian.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 14 / 24


Hamiltonian and traceable graphs
Quiz

Look at the following graphs and try to determine which ones are
traceable, Hamiltonian, or neither.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 15 / 24


Hamiltonian and traceable graphs
Quiz

Look at the following graphs and try to determine which ones are
traceable, Hamiltonian, or neither.

Remarks. Hamiltonian graphs can have all even degrees (C10 ),


all odd degrees (K10 ), or a mixture (G1 in the previous figure).

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 15 / 24


How to recognize Hamiltonian graphs?
Dirac’s Theorem

Dirac’s Theorem
Let G be a graph of order n ≥ 3. If δ(G ) ≥ n/2, then G is Hamiltonian.

Proof. Let G satisfy the given conditions. Assume G is not


Hamiltonian, and let P = v1 , . . . , vp be a simple path in G with maximal
length. Since P is maximal, all neighbors of v1 and of vp are on P. Also,
since δ(G ) ≥ n/2, each of v1 and vp has at least n/2 neighbors on P.
We claim that ∃j ∈ {1, . . . , p − 1} such that vj ∈ N(vp ) and
vj+1 ∈ N(v1 ). If this was not the case, then for every neighbor vi of vp on
P (and there are at least n/2 of them), vi+1 is not a neighbor of v1 . This
n n n
means that deg(v1 ) ≤ p − 1 − < n − = contradicting the fact
2 2 2
that δ(G ) ≥ n/2. Thus, such a j exists, as shown in the following figure:

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 16 / 24


How to recognize Hamiltonian graphs?
Dirac’s Theorem (continued)

Dirac’s Theorem
Let G be a graph of order n ≥ 3. If δ(G ) ≥ n/2, then G is
Hamiltonian.
Proof. (continued)

Let C be the cycle v1 , v2 , . . . , vj , vp , vp−1 , . . . , vj+1 , v1 . Since we


assume G is not Hamiltonian, there there is a node of G not on P.
δ(G ) ≥ n/2 implies G is connected ⇒ G has a node w not on G
that is adjacent to some node vi on P. But then the path starting
with w , vi and then continuing around the cycle C is longer than
the maximal path P, contradiction.
We conclude that G is Hamiltonian. 
Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 17 / 24
How to recognize Hamiltonian graphs?
Other criteria and auxiliary notions

Theorem (A generalization Dirac’s Theorem)


Let G be a graph of order n ≥ 3. If deg(x) + deg (y ) ≥ n for all pairs of
nonadjacent nodes x, y , then G is Hamiltonian.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 18 / 24


How to recognize Hamiltonian graphs?
Other criteria and auxiliary notions

Theorem (A generalization Dirac’s Theorem)


Let G be a graph of order n ≥ 3. If deg(x) + deg (y ) ≥ n for all pairs of
nonadjacent nodes x, y , then G is Hamiltonian.

A set of nodes in a graph G is independent if they are pairwise


nonadjacent. The independence number of a graph G , denoted by α(G ),
is the largest size of an independent set of nodes from G .
Example
Consider the following two graphs

The only independent set of size 2 in G1 is {c, d}, so α(G1 ) = 2. There


are two independent sets of size 3 in G2 : {a, c, e} and {b, d, f }, and
none of size 4, so α(G2 ) = 3.
Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 18 / 24
How to recognize Hamiltonian graphs?
Other criteria and auxiliary notions

We recall that the vertex connectivity κ(G ) of a graph G is the minimum


size of a node cut set of G .
Theorem (Chvátal and Erdös, 1972)
Let G be a connected graph of order n ≥ 3 with vertex connectivity κ(G )
and independence number α(G ). If κ(G ) ≥ α(G ), then G is Hamiltonian.

Exercise (The Icosian game of Hamilton)


Show that the graph depicted in the circle below is Hamiltonian.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 19 / 24


Hamiltonian and traceable graphs
Exercises

1 Prove that if G is Hamiltonian, then G is 2-connected.


2 Give the connectivity and independence number of the
Petersen graph depicted below.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 20 / 24


Hamiltonian graphs
Two definitions and 3 special graphs

Given two graphs G and H, we say that G is H-free if G does


not contain a copy of H as an induced graph.
If S is a collection of graphs, we say that G is S-free if G does
not contain any of the graphs of S as induced subgraph.

Three special graphs

K1,3 Z1 N

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 21 / 24


Hamiltonian graphs
Other results

Theorem ( Goodman and Hedetniemi, 1974)


If G is a 2-connected, {K1,3 , Z1 }-free graph, then G is Hamiltonian.

Proof. Let G be 2-connected and {K1,3 , Z1 }-free, and let C be a


longest cycle in G . Since G is 2-connected, the cycle C exists. We show
that C must be Hamiltonian.
If C is not Hamiltonian, there must be a node v not on C that is
adjacent to a node w in C . Let a and b be the immediate predecessor
and successor of w on C .
A longer cycle would exist if {a, b} ∩ N(v ) 6= ∅, thus {a, b} ∩ N(v ) = ∅.

If a is not adjacent to b then the subgraph induced by {w , v , a, b} is K1,3 ,


contradiction with the assumption that G is K1,3 -free ⇒ ab is an edge in G .
But in this case the subgraph induced by {w , v , a, b} is Z1 , a contradiction with
the assumption that G is Z1 -free.

⇒ C is a Hamiltonian cycle. 

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 22 / 24


Hamiltonian graphs
Other results

Theorem (Duffus, Gould, and Jacobson, 1981)


Let G be a {K1,3 , N}-free graph.
1 If G is connected, then G is traceable.
2 If G is 2-connected, then G is Hamiltonian.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 23 / 24


Hamiltonian graphs
Other results

Theorem (Duffus, Gould, and Jacobson, 1981)


Let G be a {K1,3 , N}-free graph.
1 If G is connected, then G is traceable.
2 If G is 2-connected, then G is Hamiltonian.

Remark.
The graph K1,3 is forbidden to appear as a subgraph by both last
two theorems. The graph K1,3 is usually called the “claw”, and
appears as forbidden subgraph in many theorems from graph theory.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 23 / 24


References

J. M. Harris, J. L. Hirst, M. J. Mossinghoff. Combinatorics


and Graph Theory. Second Edition. Springer 2008.
Section 1.4. Trails, Circuits, Paths, and Cycles.

Isabela Drămnesc UVT Graph Theory and Combinatorics – Lecture 12 24 / 24

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy