min-heap, where the priority of vertex v is initialized to priority(v) = w(rv) if rv is
an edge of G and priority(v) = ∞, otherwise
for Stage ← 1 to n – 1 do
dequeue vertex u //u has the highest priority value, i.e., the smallest value, of all
// the elements in Q
12.23 Consider the dag D on vertex set V = {0,1,2} with edge set E = {(0,1),(0,2),(2,1)}
where edge (0,1) has weight 2, edge (0,2) has weight 3, and edge (2,1) has weight -2.
Dijkstra’s algorithm generates the tree having edges (0,1) and (0,2), yielding the path
12.24 Since the matrices for Floyd’s algorithm for a graph is symmetric, we only show
the upper triangular portions of these matrices.