Mathematics for Computer Science
MIT 6.042J/18.062J
Directed Graphs
Albert R Meyer
October 17, 2011
lec 7M.1
Normal Person’s Graph
y
y = f(x)
x
Albert R Meyer
October 17, 2011
lec 7M.2
Computer Scientist’s Graph
b
a
c
d
f
e
Albert R Meyer
October 17, 2011
lec 7M.3
Digraphs
• a set, V, of vertices
• a set, E V×V
of directed edges
(v,w) E notation: vw
v
Albert R Meyer
October 17, 2011
w
lec 7M.4
Relations and Graphs
a
d
b
c
V= {a,b,c,d}
E = {(a,b), (a,c), (c,b)}
Albert R Meyer
October 17, 2011
lec 7M.5
Digraphs
Formally, a digraph
with vertices V is
the same as a binary
relation on V.
Albert R Meyer
October 17, 2011
lec 7M.6
Walks & Paths
Walk: follow successive edges
length: 5 edges
(not the 6 vertices)
Albert R Meyer
October 17, 2011
lec 7M.7
Walks & Paths
Path: walk thru vertices
without repeat vertex
length: 4 edges
Albert R Meyer
October 17, 2011
lec 7M.8
Walks & Paths
Lemma:
The shortest walk between
two vertices is a path!
Proof: (by contradiction) suppose
path from u to v crossed itself:
c
v
u
Albert R Meyer
October 17, 2011
lec 7M.9
Walks & Paths
Lemma:
The shortest walk between
two vertices is a path!
Proof:
(by contradiction)
then path
without c---csuppose
is
path
from u to v crossed itself:
shorter!
c
v
u
Albert R Meyer
October 17, 2011
lec 7M.10
Walks & Paths
Digraph G defines walk
+
relation G
+
u G v iff walk u to v
(the positive walk relation)
Albert R Meyer
October 17, 2011
lec 7M.11
Cycles
A cycle is a walk whose
only repeat vertex is its
start & end.
(a single vertex is a
length 0 cycle)
Albert R Meyer
October 17, 2011
lec 7M.12
Cycles
v0
v1
v2
…
vn-1
v0
vi
vi+1
v0
Albert R Meyer
October 17, 2011
lec 7M.13
Closed Walks & Cycles
Closed walk starts & ends at the
same vertex.
Lemma: The shortest positive
length closed walk containing a
vertex is a pos. length cycle!
Proof: similar
Albert R Meyer
October 17, 2011
lec 7M.14
Directed Acyclic Graph
DAG
has no positive
length cycle
Albert R Meyer
October 17, 2011
lec 7M.15
Directed Acyclic Graph
examples:
DAG
< relation on integers
⊂ relation on sets
prerequisite on classes
Albert R Meyer
October 17, 2011
lec 7M.16
DAG walk relation
a
c
b
what is
smallest DAG
with same
walk relation?
d
e
f
Albert R Meyer
October 17, 2011
lec 7M.17
Covering Edges
a
unneeded edges
covering edges
c
b
e.g. any path
from c to d must
use cd
d
e
f
Albert R Meyer
October 17, 2011
lec 7M.18
Problems
1-3
Albert R Meyer
October 17, 2011
lec 7M.19
© Copyright 2026 Paperzz