This preview shows pages 1–3. Sign up to view the full content.
COP 3503 – Computer Science II
–
CLASS NOTES

DAY #24
Euler Circuits
Consider the three figures (a) – (c) shown below.
A puzzle for you to solve is to
reconstruct these three figures using a pencil and paper drawing each line exactly
once without lifting the pencil from the paper while drawing the figure.
To make
the puzzle even harder, see if you can draw the figure following the rules above but
have the pencil finish at the same point you originally started the drawing.
Try to
do this before you read any further in the notes.
(a)
(b)
(c)
It turns out that these puzzles have a fairly simple solution.
Figure (a) can only be
drawn within the specified rules, if the starting point is the lowerleft or lowerright
hand corner, and it is not possible to finish at the starting point.
Figure (b) is easily
drawn with the finishing point being the same as the starting point (see the last
page of the notes for one possible solution).
Figure (c) cannot be drawn at all
within the specified rules, even though it appears to be the simplest of the
drawings!
These puzzles are converted into graph theory problems by assigning a
vertex to each intersection.
Then the edges are assigned in the natural manner.
The corresponding graphs are shown below.
(a)
(b)
(c)
Once the puzzle has been converted into the graphs as shown above, we need to
find a path that visits every edges exactly once.
If the extra challenge is to be
Day 24 
1
Graph Problems Continued
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document solved, then a cycle must be found that visits every edge exactly once.
This
problem was solved in 1736 by the mathematician Euler and is commonly
regarded as the beginning of graph theory.
This problem is referred to as an
Euler
path
or
Euler circuit problem
, depending upon the specific problem statement.
The Euler path and Euler circuit problems, although slightly different problems,
have the same basic solution and we will focus only on the Euler circuit problem.
For a given graph to have an Euler circuit certain properties must hold in the graph.
Namely, since an Euler circuit must begin and end on the same vertex, such a
circuit is only possible if (1) the graph is connected and (2) each vertex in the
graph has an even degree.
If any vertex were to have an odd degree, then
eventually you would reach the point where only one edge into that vertex is
“unvisited”, and taking that edge into that vertex would strand you at that vertex.
If exactly two vertices have an odd degree, then a Euler path is still possible (since
you are not required to begin and end on the same vertex in an Euler path) if the
path begins on one of the odd degree vertices and ends on the other odd degree
vertex.
If more than two vertices have an odd degree, then an Euler path is not
possible.
Looking at the puzzles from above and applying this knowledge we see
that for puzzle (a) has only an Euler path beginning at either the lower left or lower
right corners which are the two vertices with an odd degree.
All other vertices in
this graph have an even degree of either 2 or 4.
Puzzle (c) has neither an Euler
This is the end of the preview. Sign up
to
access the rest of the document.