Breadth First Search generates a shortest path tree rooted at the start vertex v for a graph. The weighted length of a path in a weighted graph is the sum of the weights of the edges in the path. A shortest weighted path between two vertices is the shortest weighted path between the two vertices. Bellman Ford Algorithm finds shortest weighted path tree rooted at r, if it exists. After the scans are completed.
Lemma states a loop invariant .
A loop invariant is a condition that is always true upon the completion of each iteration of a loop. Proof that a loop invariant holds is generally done by induction upon the number of iterations of the loop. R An equivalence relation on a set S divides S into disjoint subsets called equivalence classes. The equivalence classes are the graph's connected components. Form the union of two sets.