xxxxxxxxxx
{
list L = empty
tree T = empty
choose a starting vertex x
search(x)
while(L nonempty)
STATEMENT 1
if w not yet visited
{
add (v,w) to T
search(w)
}
}
DFS(G)
{
list L = empty
tree T = empty
choose a starting vertex x
search(x)
while(L nonempty)
STATEMENT 2
if w not yet visited
{
add (v,w) to T
search(w)
}
}
search(vertex v)
{
visit(v);
for each edge (v,w)
add edge (v,w) to end of L
}