This preview shows pages 1–11. Sign up to view the full content.
1
COMP170
Discrete Mathematical Tools
for Computer Science
Discrete Math for Computer Science
K. Bogart, C. Stein and R.L. Drysdale
Section 6.1, pp. 309320
Intro to Graphs
Version 2.0: Last updated, May 13, 2007
Slides
c
±
2005 by M. J. Golin and G. Trippen
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 2
Graphs
•
The Degree of a Vertex
•
Connectivity
•
Cycles
•
Trees
•
Basic Deﬁnitions
3
Graphs
Fundamental topic in discrete math and CS.
Important because it’s used to
model many common
situations
and to naturally describe many algorithms.
Example
Map of some cities in eastern US.
with communication lines existing
between certain pairs of these cities.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 4
What is the
minimum
number
of links needed to send a
message from
B
to
NO
?
3
:
B – CH – ME – NO
.
Which city/cities has/have the
most communication links em
anating from it/them?
A
:
6
links.
What is the total number of
communication links?
20
links.
5
consists of a set of
vertices
V
,

V

=
n
,
and a set of
edges
E
,

E

=
m
.
Each edge has two
endpoints
.
An edge
joins
its endpoints,
two endpoints are
adjacent
if
they are joined by an edge.
When a vertex is an endpoint
of an edge, we say that the
edge and the vertex are
incident
to each other.
Graph
G
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 6
More Examples:
•
Vertices: biological species
Edges: species have a common ancestor
•
Vertices: people
Edges: people attend same school
•
Vertices: MTR stations
Edges: direct connection
•
Vertices: Web sites
Edges: A link from one site to another
How
Google
models
the
Internet!
7
More Graphs:
•
Simple Graph
(a, b, c):
at most one
edge joining each
pair of distinct vertices (versus
multiple
edges (d)) and
no
edges joining a vertex to itself (=
loop
).
•
Complete Graph
K
n
(b, c): graph with
n
vertices that
has an edge between each pair of vertices.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 8
A
path
in a graph is an alternating sequence of ver
tices and edges such that
•
it starts and ends with a vertex,
•
each edge joins the vertex before it in the sequence to
the vertex after it in the sequence, and
•
no vertex appears more than once in the sequence.
Length
of a path = # of edges on path
9
Example
Path from Boston to New Orleans is
B
{
B,CH
}
CH
{
CH,ME
}
ME
{
ME,NO
}
NO
.
Since the
2
nd
endpoint of an edge
is the
1
st
endpoint of the following
edge, we usually just write the succes
sive endpoints, e.g.,
B,CH,ME,NO.
This path has
length
3
.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
The
distance
between two
vertices is the length of the
shortest path between them.
dist(CI, W)
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 08/25/2010 for the course COMP COMP170 taught by Professor M.j.golin during the Spring '10 term at HKUST.
 Spring '10
 M.J.Golin
 Computer Science

Click to edit the document details