Professional Documents
Culture Documents
c f u v
a d
b e
u d v
b e Eulerian ?
Does it have an Euler trail ?
An Euler tour of G is a tour which includes every
edge exactly once. c f
a
u d v
An Euler trail of G is a trail which includes every b e
edge exactly once.
Schlag CMPE177 Fall 2004 1 Schlag CMPE177 Fall 2004 2
Thm
For a connected graph G the following are Eulerian ?
equivalent:
a a a
1. G is Eulerian.
b e e e
b g b g
2. All vertices of G have even degree.
d d d
3. The edges of G can be partitioned into cycles.
c f c f f
c
Thm 3.2 1 if and only if 2
Thm 3.3 1 if and only if 3 Does it have an Euler trail ?
Show 1Ł 2Ł 3Ł 1
Schlag CMPE177 Fall 2004 3 Schlag CMPE177 Fall 2004 4
1
Proof: 1Ł 2 Proof: 1Ł 2 (continued)
Assume G is Eulerian. d(v)= 2(# loops at v) + (# non-loop edges of v)
Let C be an Euler Tour of G. = 2(# loops at v) + (# non-loop edges entering v)
Let v be any vertex of G. + (# non-loop edges leaving v)
If d(v)=0, then v has even degree. = 2(# loops at v) + 2(# non-loop edges leaving v)
If d(v)>0, then v has one or more edges which all Since C enters and leaves v the same # of times.
appear exactly once in C. So d(v) is even.
Each occurrence of v in C is preceded and Proof: 2Ł 3 By induction on the # of cycles of G, k.
followed by an edge of v.
Base: k=0. If G has no cycles, it is a tree.
Loops can be used both to enter and leave v, but
non-loops are used either to enter or leave v, not A tree with at least 2 vertices, must have 2 vertices
both. of degree 1 by Corollary 2.3.
Schlag CMPE177 Fall 2004 5 Schlag CMPE177 Fall 2004 6
2
Proof: 3Ł 1 Proof: 3Ł 1 (continued)
Let C and C’ be closed trails of G which intersect Splice together C1 and C j to form a closed trail, C''.
at v, but have no common edges.
C = ve 1v 1e 2 v 2 v k e k + 1v
C2 ,
,C j −1,C j +1,
is a closed trail with all of the edges of C and C’. which contains all of E(G).
Let C1,C2,
3
Fleury’s Algorithm Example of Fleury’s Algorithm
(aka don’t burn your bridges)
v←v0; F←E
C←trivial path at v0
while (G has unmarked edges) c f
If v has an unmarked edge that is not a bridge of (V,F) a
then e←unmarked edge of v that is not a bridge of (V,F)
else e←any unmarked edge of v u d v
mark e
b e
Append e to C
F←F-e
v←other endpoint of e
endwhile
4
Thm 7.2 Eulerian ?
For a weakly connected directed graph D: c
b
a d
D is Eulerian if and only if for all v, id(v)=od(v). c e h
b
a f c
D has an open directed Euler Trail from u to v if d g b
e h a d
and only if,
f e h
1. od(u)=id(v)+1. g
f
g
2. id(v)=od(v)+1.
3. for all w u,v, id(w)=od(w). Does it have an Euler Trail ?
5
Equivalent to:
Chinese Postman Problem
Add a set of edges of minimum weight to G to make
Given a weighted graph G, find a minimum cost tour. it Eulerian, where the cost of each new edge is the
distance between its endpoints in G.
f
6 f
5 2 6
a b 5 2
1 (e,f),(b,d) cost 3+3=6
1 3 1 a b
e 1
1 3 1 (e,b),(d,f) cost 2+5=7
7 d c e
2
7 d c
2
(e,d),(b,f) cost 4+3=7
Each edge must be traversed.
Schlag CMPE177 Fall 2004 21 Schlag CMPE177 Fall 2004 22
f
6 (e,f),(b,d) cost 3+3=6
5 2
3 a b
1
1 3 1
e 3
7 d c
2
f
6
5 2
a b Solution is an Euler Tour
1
1 3
of the modified graph.
e 1
7 d c
2