Graph Theory37 sections · 1633 units
Open in Course

Quiz: BFS Path Reconstruction

Knowledge check

Check Your Understanding

During BFS, you store a parent array where parent[v] records the vertex that discovered v. After BFS finishes, how do you reconstruct the shortest path from source to target?

  1. A.Follow parent pointers from target back to source, then reverse
  2. B.Follow parent pointers from source forward to target
  3. C.Run BFS again from target to source
  4. D.Sort the parent array by distance
Start the roadmap to answer the quizzes and solve the challenges