Strongly Connected Components: Compute Finish Times

Strongly Connected Components: Compute Finish Times

for i:= 1 to n do

mark[i] := 0;

endfor

FinishTime := 0

for i:= 1 to n do

if mark[i] = 0 then

DFS(i);

endif

endfor

DFS(v)

mark[v] := 1;

ptr := AdjacencyList[v];

while ptr ¹ NIL do

w:= ptr^.vertex;

if mark[w] = 0 then

DFS(w)

endif

ptr := ptr^.Link;

endwhile

FinishTime := FinishTime+1

f[v] := FinishTime

endDFS

Previous slide Next slide Back to the first slide View Graphic Version