L32 Connected
L32 Connected
ET = {(u, v):(v, u) E }.
T e f g h
G is G with all edges
reversed. a GT b c d
e f g h
MA512: Data Structures and Algorithms
4
Transpose of a Directed Graph
• Transpose: Adjacency list representation
Adj’[1..|V|]: new adjacency list representation
For each vertex 𝑢 ∈ 𝐺
u u’
v v’
C C’
• Compute GT e f g h
e f g h
cd
abe
fg h
u v
x
MA512: Data Structures and Algorithms
16
Proof:Case 2: d(C) > d(C)
Let y be the first vertex discovered in C.
At time d[y], all vertices in C are white and there is a white
path from y to each vertex in C all vertices in C become
descendants of y. Again, f [y] = f (C).
At time d[y], all vertices in C are also white.
u v
x y
Analysis of Algorithms
21