Exam-style question
Try this first
A breadth-first search starts at A. The neighbours of each vertex are considered in the order shown: A: B, C; B: D; C: E; D: none; E: none. In what order are the vertices visited?.
- A.A, C, B, E, D
- B.A, B, C, D, E
- C.A, B, D, C, E
- D.B, C, A, D, E
Model answer
What a good answer should say
- A, B, C, D, E
Explanation
Why this works
Breadth-first search visits all vertices one edge away from A before visiting vertices two edges away. It visits A, then B and C, followed by D and E.
Common mistake
No common mistake is linked to this question yet.
