# Dijkstra’s algorithm below finds the length of ashortest path from vertex a to vertex z. Using the s

Dijkstra’s algorithm below finds the length of ashortest path from vertex a to vertex z. Using the suppliedpseudocode, modify the algorithm to find the lengths of theshortest paths from any given vertex to every other vertex in aconnected weighted graph: This algorithm finds the length of a shortest path from vertex ato vertex z in a connected, weighted graph. The weight of edge (i,j) is w(i, j ) > 0 and the label of vertex x is L(x). Attermination, L(z) is the length of a shortest path from a to z. Input: A connected, weighted graph in which all weights arepositive; vertices a and z Output: L(z), the length of a shortest path from a to z dijkstra(w, a, z, L) { L(a) = 0 for all vertices x = a L(x) =? T = set of all vertices T is the set of vertices whose shortest distance from a has // not been found while (z ? T ) { choose v ? T with minimum L(v) T = T ? {v} for each x ? T adjacent to v L(x) = min{L(x), L(v) + w(v, x)} } } . . .