Connected Component DFS

Connected Component DFS

DFS(v) {Local declarations omitted.}

mark[v] := ComponentNumber;

ptr := AdjacencyList[v];

while ptr ¹ NIL do

w := ptr^.vertex;

if mark[w] = 0 then

DFS(w)

endif

ptr := ptr^.Link;

endwhile

end DFS

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