Strongly Connected Components: DFS by Decreasing Finish

Strongly Connected Components: DFS by Decreasing Finish

for i := 1 to n do

mark[i] := 0;

endfor

SCCNumber := 0;

for i := 1 to n do

if mark[lookup[i]] = 0 then

SCCNumber :=

SCCNumber + 1

DFS(lookup[i]);

endif

endfor

DFS(v)

mark[v] := SCCNumber;

ptr := RevAdj[v];

while ptr ¹ NIL do

w := ptr^.Vertex;

if mark[w] = 0 then

DFS(w);

endif

ptr := ptr^.Link;

endwhile

endDFS

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