Professional Documents
Culture Documents
Lars Kulik
Lecture 6
Semester 1, 2022
1
Graphs Again
2
Graphs, Mathematically
G = hV , E i
V : Set of nodes or vertices
E : Set of edges (a binary relation on V )
a c a c
f f
d d
b e g b e g
V = {a, b, c, d, e, f , g } V = {a, b, c, d, e, f , g }
E = symmetric closure of E = {(a, b), (a, c), (a, d),
{(a, b), (a, c), (a, d), (a, e), (b, d), (c, f ),
(a, e), (b, d), (b, e), (d, e), (e, b), (g , f )}
(c, f ), (d, e), (f , g )}
3
Graph Concepts
Undirected: Directed:
a c a c
f f
d d
b e g b e g
f f
d d
b e g b e g
4
More Graph Concepts: Degrees of Nodes
5
More Graph Concepts: Paths and Cycles
a c
f
d
A cycle is a simple path, except that v0 = vk , that is, the last node
is the same as the first node.
6
More Graph Concepts
Unweighted: Weighted:
9
a c a c
1 3
f 7 4 f
d d
1 2 2
b e g b e g
5
Dense: Sparse:
a c a c
f f
d d
b e g b e g
7
More Graph Concepts
Cyclic: Acyclic (actually, a tree):
a c a c
f f
d d
b e g b e g
f f
d d
b e g b e g
8
Rooted Trees
9
Modelling with Graphs
walls doors
foundation windows
roof painting
10
Modelling with Graphs
a b c d e f g
a c a 0 1 1 1 1 0 0
b 1 0 0 1 1 0 0
f c 1 0 0 0 0 0 0
d
d 1 1 0 0 1 0 0
b e g
e 1 1 0 1 0 0 0
f 0 0 0 0 0 0 1
g 0 0 0 0 0 1 0
12
Graph Representations, Undirected Graphs
a →b→c →d →e
b →a→d →e
a c
c →a
f d →a→b →e
d e →a→b →d
b e g f →g
g →f
13
Graph Representations, Directed Graphs
a b c d e f g
a 0 1 1 1 1 0 0
a c b 0 0 0 1 0 0 0
c 1 0 0 0 0 0 0
f d 0 0 0 0 1 0 0
d
e 0 1 0 0 0 0 0
b e g
f 0 0 0 0 0 0 0
g 0 0 0 0 0 1 0
14
Graph Representations, Directed Graphs
a →b→c →d →e
b →d
a c
c →a
d →e
f
d e →b
b e g f
g →f
15
Graph Representations
Think of some! ✎
16
Up Next
17