Graph Theory37 sections · 1633 units
Open in CourseQuiz: DFS on Trees
Knowledge check
Check Your Understanding
You run DFS on a rooted tree and pass a parent parameter to avoid revisiting the parent. Why is this enough to prevent cycles in a tree, but not in a general graph?
- A.Trees have directed edges, so you can only go one way
- B.Trees have fewer edges, so collisions are rare
- C.The parent parameter acts as a full visited array
- D.Trees have exactly path between any nodes, so blocking the parent blocks the only back-edge