Theorem 22.5(Correctness of breadth-first search) Let G=(V,E)be a directed or undirected graph,and suppose that BFS is run on G from a given source vertex sV.Then,during its execution,BFS discovers every vertex vV that is reachable from the source s,and upon termination, v.d =8(s.v)for all v e V.Moreover,for any vertex vs that is reachable from s,one of the shortest paths from s to v is a shortest path from s to v. followed by the edge(.π,). 种递归的手法定义了最 短路径的获得一种递归的手法定义了最 短路径的获得