Sunteți pe pagina 1din 50

5.2 - 5.

3 Graphs and
Graph Terminology
Liesez Euler, Liesez
Euler, cest notre
matre tous.
- Pierre Laplace

Graphsconsistof Example 1: The
following picture
pointscalledvertices
is a graph. List its
linescallededges vertices
A and
edges. D
1. Edgesconnecttwo
vertices. C

2. Edgesonlyintersect
atvertices.
3. Edgesjoininga
vertextoitselfare E
calledloops.
B


Example 2:
This is also a graph. The vertices just
happen to have peoples names.
Such a graph could represent friendships
(or any kind of relationship).

Flexo Bender Leela

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.

Fry Amy Farnsworth


Now check out the graph below.
What can we say about it in comparison to
the previous figure?

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
l the math-y jargon one could ask
(ie - al
for)

Adjacent Vertices are


t w o v e r t i c e s t h a t a r e
joined by an edge.
Adjacent Edges are
two edges that
int e r s e ct a t a v e r t e x .
The degree of a
x i s t h e n u m b e r o f
verte
edg e s a t t h a t v e r t e x .

Graph Terminology
A l o o p c o 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 ev en de gree.


Example 3:

1) Find the degree A


of each vertex. D

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 path is a sequence
of v e r t i c e s s u ch t h a t
e r t e x i s a d j a c e nt
each v
to the next. In a
pa t h , e a c h e d g e c a n b e
traveled only once.
Th e l e n g t h o f a p a t h
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 end s at the s ame
vertex is called a
circui t.

A graph is connected
if any two vertices
can be joined by a
path. If this is not
possi ble t hen the
r a p h i s di s c o n n ec t e d .
g

Graph Terminology

The connected
parts of a
disconnected graph
are called
components.
A bridge is an
edge 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.

B 2) Find a path from H to


J of length 4.
W 3) Find a circuit of
H
K length 5.
4) Find a circuit of
length 1.
Example 5: Draw a picture of a 5)
graph
Findthat satisfies
a bridge.
the following:
Vertices: A, B, C, D
Edges: AB, AC, AD, B is adjacent to D.


Graph Terminology
An Euler Path is a
path that travels
thr o u g h ev e r y e d g e o f
th e g r a ph ( o n c e a n d
only once).

An E u l e r C i r c u i t i s a
ci r c u i t t h a t t r a v e l s
through every edge of
a graph .

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 Eulers
Theorems
Now I will have less
distraction.
Leonhard Euler
after losing sight
in his right eye.

Knigsbergs Bridges II
(The rare sequel that is not entirely
gratuitous.)
Recall from Tuesday the R
puzzle that the residents
of Knigsburg had been
unable to solve until
Eulers arrival: A D
Is there a way to cross all
seven bridges exactly
once and return to your
starting point? L
Is there even a way to A stylized (i.e. - inaccurate)
cross all seven bridges map of Knigsbergs Bridges.
exactly once?


What Euler realized was that most of the information
on the maps had no impact on the answers to the two
questions.

R R

D A D
A

L L

By thinking of each bank and island as a vertex and each


bridge as an edge joining them Euler was able to model
the situation using the graph on the right. Hence, the
Knigsberg puzzle is the same as asking if the graph has
an Euler path or Euler circuit.
Example: Slay-
The Scooby Gang needs to patrol the following section of
town starting at Sunnydale High (labeled G). Draw a

age
graph that models this situation, assuming that each
side of the street must be checked except for those
along the park. (Map is from p. 206)


Example2:(Exercise21,pg207)The
maptotherightofdowntownKingsburg,
showstheKingsRiverrunningthrough
thedowntownareaandthethreeislands
(A,B,andC)connectedtoeachother
andbothbanksbysevenbridges.The
ChamberofCommercewantstodesigna
walkingtourthatcrossesallthebridges.
Drawagraphthatmodelsthelayoutof
Kingsburg.


Example3:
TheKevinBaconGame
(http://www.cs.virginia.edu/oracle/)


EulersTheorems
Eulers Theorem 1
(a) If a graph has any odd vertices, then
it cannot have an Euler circuit.
(b) If a graph is connected and every
vertex is even, then it has at least one
Euler circuit.


Eulers Theorem 2
(a) If a graph has more than two odd
vertices, then it cannot have an Euler
path.
(b) If a connected graph has exactly
two odd vertices then it has at least one
Euler path starting at one odd vertex
and ending at another odd vertex.


KnigsburgsBridgesIII TheSearchForMoreMoney)
Example4:KnigsburgsBridgesIII( TheSearchForMoreMoney
LetusconsideragaintheKnigsburgBrdigepuzzleasrepresentedbythegraph
below:

A D

Wehavealreadyseenthatthepuzzleboilsdowntowhetherthisgraphhas
anEulerpathand/oranEulercircuit.Doesthisgraphhaveeither?


Example5:(Exercise60,pg214)RefertoExample2.Isitpossibletotakea
walksuchthatyoucrosseachbridgeexactlyonce?Explainwhyorwhynot.

A B C


Example 6: Unicursal Tracings
RecalltheroutingproblemspresentedonTuesday:
Dothesedrawingshaveunicursaltracings?Ifso,aretheyopenorclosed?

Howmightweanswerthesequeries?Well,ifweaddverticestothecornersofthe
tracingswecanreducethequestionstoaskingwhetherthefollowinggraphshaveEuler
paths(opentracing)and/orEulercircuits(closedtracing).

(a) (b)


(c)
Eulers 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 Fleurys
Algorithm


Eulers 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
Analgorithmisasetofprocedures/rulesthat,when
followed,willalwaysleadtoasolution*toa
givenproblem.
Somealgorithmsareformuladriventheyarrive
atanswersbytakingdataandplugginginto
someequationorfunction.
Otheralgorithmsaredirectivedriventheyarrive
atanswersbyfollowingagivensetofdirections.


FleurysAlgorithm
The Idea:
Dont 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 havent traveled yet.

Example 1:Does
1: this graph have an Euler circuit? If so,
find one.
A
B

D
C


FleurysAlgorithm
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 cant travel anymore, stop.

* - This works when we have an Euler


circuit. If we only have a path, we
must start at one of (two) the odd
vertices.

Example 2:Do
2: the following drawings have unicursal tracings? If
so, label the edges 1, 2, 3, . . . In the order in which they can be
traced.


Example3:(Exercise60,pg214)The
maptotherightofdowntownKingsburg,
showstheKingsRiverrunningthrough
thedowntownareaandthethreeislands
(A,B,andC)connectedtoeachother
andbothbanksbysevenbridges.The
ChamberofCommercewantstodesigna
walkingtourthatcrossesallthebridges.
Drawagraphthatmodelsthelayoutof
Kingsburg.

Itwasshownyesterdaythatitwas
possibletotakeawalkinsuchthatyou
crosseachbridgeexactlyonce.Show N
how.

A B C

S

Example: Slay-
The Scooby Gang needs to patrol the following section of
town starting at Sunnydale High (labeled G). Suppose

age
that they must check each side of the street except for
those along the park. Find an optimal route for our
intrepid demon hunters to take.


Quiz1,problem2

NorthBank(N)

B
A C

SouthBank(S)


Mathematics and the
Arts?
One of Eulers
800+ publications
included a
treatise on music
theory.
Book was too
math-y for most
composers--too
music-y for most
mathematicians


Mathematics and the
Arts?
While Eulers
theories did not
catch on, a
relationship
between
mathematics and
music composition
does exist in
what is called
the golden ratio.


Fibonacci Numbers
The Fibonacci Numbers
are those that comprise
the sequence:
1, 1, 2, 3, 5, 8, 13,
21, . . .
The sequence can be
defined by:
F1=1, F2=1;
Fn=Fn-1+Fn-2
These numbers can be
used to draw a series
of golden rectangles
like those to the
right.


Fibonacci Numbers
The sequence of
Fibonacci Ratios
- fractions like
3/5, 5/8, 8/13
approach a number
called the Golden
Ratio
(0.61803398)


The Golden Ratio
Several of Mozarts
piano sonatas make use
of this ratio.
At the time such pieces
regularly employed a
division into two parts
1. Exposition and
Development
2. Recapitulation
In Piano Sonata No. 1
the change between parts
occurs at measure 38 of
100. (which means that
part 2 is 62 0.618 x
100)


The Golden Ratio
Another example in music
is in the Hallelujah
chorus in Handels
Messiah.
The piece is 94 measures
long.
Important events in
piece:
1. Entrance of trumpets -
King of Kings occurs in
measures 57-58 (8/13)
x 94
2. The kingdom of
glory occurs in meas.
34-35 (8/13) x 57
etc, etc. . .


The Golden Ratio in
Art

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

S-ar putea să vă placă și