Graph Theory37 sections · 1633 units
Open in CourseQuiz: Two-BFS Method
Knowledge check
Check Your Understanding
Two-BFS diameter algorithm: BFS from any node , find farthest node , BFS from , find farthest node . Distance to is the diameter. Why does this work?
- A.It only works for binary trees
- B.BFS always finds diameter endpoints
- C.You need three BFS calls, not two
- D.The farthest node from any node must be a diameter endpoint