Algorithm
Algorithm
W
9/12
.[u]
Time
Nil 0
For each V[u] V [G] Do if color [u] = white Then DFS-visit (u) DFS visit (u) Color (u) Time D[u] Gray time+1 time
For each V A adj [u] Do if color [V] = white Then [u] DFS-visit [V] Color[u] F[u] Black time time+1 u
Topological Sorting
Topological Sort (G) Call DFS (G) to compute finishing Item f[v] for each u
Faheem Janjua As each vertex is finished insert it into The format of a link list Return the link of list of vertices
Connecting Components
Call DFS (G) to compute finishing line f [u] For each vertex Compute Call DFS GT (GT) but in the main loop of Decreasing f[u]
In the depth first forest formed in line, 3 as a separate straight connected component.
ABC
FGH
DE