Professional Documents
Culture Documents
3 Graphs and
Graph Terminology
“Liesez Euler, Liesez
Euler, c’est notre
maître à tous.”
- Pierre Laplace
Graphs consist of Example 1: The
points called following picture
vertices is a graph. List its
lines called vertices
A and
edges edges. D
Zoidberg
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Leela Fry
Flexo
Amy
Bender
Farnsworth Zoidberg
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
Moral of the Story
• One graph may be drawn in
(infinitely) many ways, but it
always provides us with the same
information.
• Graphs are a structure for
describing relationships between
objects.
(The vertices denote the objects and the
edges represent the relationship.)
Graph Terminology
Graph Terminology
e ma th -y ja rg on on e could ask
(ie - all th
for)
Adj a c e n t V e rt i c e s a r e
tw o v e r ti c e s t h a t a r e
joined by an edge.
Adjacent Edges are
two edges that
inter s e c t a t a v e r t e x .
The degree of a
e r t e x i s t h e n u m b e r o f
v
edges at that vertex.
Graph Terminology
A l o o p co u n t s tw i c e
toward the degree.
An odd vertex is a
vertex of odd degree.
An even vertex is a
vertex of even degree.
Example 3:
2) Is A adjacent to
C
B?
Is D adjacent to
A?
Is E adjacent to
itself?
Is C adjacent to E
itself?
B
3) Is AB adjacent to
BC?
Is CE adjacent to
BD?
Graph Terminology
A p a t h i s a s e q u e n c e
of v e r t ic e s s u ch t h a t
v e r t ex i s ad j a c e n t
each
to the next. In a
p a t h , e a c h e d g e c a n b e
traveled only once.
•The length of a path
is t h e n u m b e r o f e d g e s
in that path.
Graph Terminology
•A path that starts
and ends at the same
vertex is called a
circuit.
•A graph is connected
if any two vertices
can be joined by a
pa t h . If t h i s i s n o t
possible then the
gr a p h is di s c o n n ec t e d .
Graph Terminology
•The connected
parts of a
di s c o n ne c t e d g r a p h
are called
components.
•A bridge is an
ed g e i n a c o nn e c t e d
gr a p h w h o s e r e m o v a l
makes it
disconnected.
Example 4:
1) Find a path from B to
K passing through W
S J but not S.
•An E u l e r C i r c u i t i s a
cir c u i t t h a t t r a v e l s
th ro u g h e v e r y e d g e o f
a gr a ph .
Example 6: The graph on the
left has no Euler paths, but
the one on the right has
several.
R R
A D A D
L L
§5.4 - 5.5 Graph
Models and Euler’s
Theorems
“Now I will have less
distraction.”
- Leonhard Euler
after losing sight
in his right eye.
Königsberg’s Bridges II
(The rare sequel that is not entirely
gratuitous.)
Recall from Tuesday the
R
puzzle that the residents
of Königsburg had been
unable to solve until
Euler’s arrival: A D
• Is there a way to cross
all seven bridges exactly
once and return to your
starting point? L
R R
D A D
A
L L
A D
A B C
S
Example 6: Unicursal Tracings
Recall the routing problems presented on Tuesday:
•“Do these drawings have unicursal tracings? If so, are
they open or closed?”
(a (b)
)
(c)
• Euler’s Theorem 3
(a) The sum of the degrees of all the
vertices of a graph equals twice the
number of edges.
(b) A graph always has an even number
of odd vertices.
A quick summary . . .
Number of odd vertices
Conclusion
0 Graph has Euler
circuit(s)
2 Graph has Euler
path(s) but no Euler
circuit
4, 6, 8, . . . Graph has no Euler
path and no Euler
circuit
1, 3, 5, . . . Impossible!
§5.6 Fleury’s
Algorithm
• Euler’s Theorems give us a simple way
to see whether an Euler circuit or an
Euler path exists in a given graph, but
how do we find the actual circuit or
path?
• We could use a “guess-and-check”
method, but for a large graph this could
lead to many wasted hours--and not
wasted in a particularly fun way!
Algorithms
An algorithm is a set of procedures/rules
that, when followed, will always lead
to a solution* to a given problem.
• Some algorithms are formula driven--
they arrive at answers by taking data
and ‘plugging-in’ to some equation or
function.
• Other algorithms are directive driven--
they arrive at answers by following a
given set of directions.
Fleury’s Algorithm
• The Idea:
“Don’t burn your bridges behind you.”
(“bridges”: graph-theory bridges, not real world)
• When trying to find an Euler path or an Euler
circuit, bridges are the last edges we should
travel.
• Subtle point: Once we have traversed an
edge we no longer care about it--so by
“bridges” we mean the bridges of the part of
the graph that we haven’t traveled yet.
Example 1: Does this graph have an Euler circuit? If so,
find one.
A
B
D
C
F
Fleury’s Algorithm
1) Ensure the graph is connected and all the
vertices are even*.
2) Pick any vertex as the starting point.
3) When you have a choice, always travel along
an edge that is not a bridge of the yet-to-be-
traveled part of the graph.
4) Label the edges in the order which you travel.
5) When you can’t travel anymore, stop.
B
A C
Approx. = 0.618 x H
The Golden Ratio in
Art
Approx. = 0.618 x H
The Golden Ratio in
Art
The Golden Ratio in
Art
.618 x Ht.
0.618 x Width
The Golden Ratio in
Art
.618 x Ht.
0.618 x Width