This preview shows pages 1–2. Sign up to view the full content.
The University of Texas at Austin
Department of Computer Sciences
Professor Vijaya Ramachandran
Graphs; shortest paths
CS357: ALGORITHMS, Spring 2006
1
Graphtheoretic Deﬁnitions
An
undirected graph
G
=(
V,E
) consists of a ﬁnite set of
vertices
V
and a set
E
of unordered pairs
of distinct vertices in
V
. An edge containing vertices
x
and
y
is denoted by (
x, y
) (or equivalently
as (
y, x
)).
A
directed graph
, also called
G
=(
V,E
) consists of a ﬁnite set of vertices
V
, and a set of edges
E
which is
a binary relation
on
V
, i.e.,
E
is a subset of
V
×
V
.
The
degree
of a vertex
v
is the number of edges of the form (
v, x
),
x
∈
V
.
In a directed graph, this is also called the
outdegree
of
v
;i
t
s
indegree
is the number of edges of
the form (
x, v
),
x
∈
V
.
In both an undirected and directed graph, if (
u, v
) is an edge, then
v
is
adjacent
to
u
.
A
path
of length
k
from vertex
u
to vertex
u
0
in
G
=(
V,E
) is a sequence of vertices
<v
0
,v
1
,
···
,v
k
>
with
v
0
=
u
and
v
k
=
u
0
such that each (
v
i

1
,v
i
)
∈
E
,1
≤
i
≤
k
.
For each
v
∈
V
,
<v>
represents a path of length 0.
Apathis
simple
if all vertices on the path are distinct.
We say that
v
is
reachable
from
u
if there is a path (of some length) from
u
to
v
.
Given a graph
G
=(
V,E
) (directed or undirected), a graph
G
0
=(
V
0
,E
0
)i
sa
subgraph
of
G
if
V
0
⊆
V
and
E
0
⊆
E
.
Given a set of vertices
V
1
⊆
V
,
the subgraph of
G
induced by
V
1
is the graph
G
1
=(
V
1
,E
1
)where
E
1
contains all edges (
u, u
0
)
∈
E
with both
u
and
u
0
in
V
1
.
Representation of graphs.
The running time of graph algorithms is usually measured in terms of the size of the representation
used to describe the graph
G
=(
V,E
).
This size is

V

+

E

,i
fan
adjacencylists
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 01/30/2008 for the course CS 357 taught by Professor Ramachandran during the Spring '06 term at University of Texas at Austin.
 Spring '06
 Ramachandran
 Algorithms

Click to edit the document details