Slide 22
Slide 22 text
Shortest paths, diameter
Unweighted graph
• An s–t path is a path from a vertex s to a vertex t.
• dist(s, t) = length of a shortest s–t path
• Diameter is diam(G) := maxs,t∈V
dist(s, t)
s
t
dist(s, t) = 3 = diam(G)
Weighted graph
• Each edge e ∈ E has a weight (length) w(e) ∈ R.
• Then, the length of a path is the sum of edge lengths.
s
3
2
1
2
−3
1
t
1
dist(s, t) = 1
19 / 56