Write the psuedo code for the Depth first Search.

Q

Write the psuedo code for the Depth first Search.

✍: .fyicenter.com

A

dfs(G, v) //OUTLINE
Mark v as "discovered"
For each vertex w such that edge vw is in G:
If w is undiscovered:
dfs(G, w); that is, explore vw, visit w, explore from there as much as possible, and backtrack from w to v. Otherwise:
"Check" vw without visiting w. Mark v as "finished".

2012-04-16, 2937👍, 0💬