Answer
Explaining how to use breadth-first search to find the length of a shortest path between two vertices in an undirected graph.
Work Step by Step
--Assume that we wish to find the length of a shortest path from v1 to every other vertex of G using Algorithm 1.
-In line 2 of that algorithm, add L(v1) := 0, and add the following as a third step in the then clause at the end:
--L(w) := 1+L(v).