Computer Science, asked by lovelyparents, 10 months ago

Explain briefly about algorithm and time complexity for single source shortest path?

Answers

Answered by kk456malhi
0

Answer:

Explanation:

Algorithm Steps:

The outer loop traverses from  : .

Loop over all edges, check if the next node distance > current node distance + edge weight, in this case update the next node distance to "current node distance + edge weight".

This algorithm depends on the relaxation principle where the shortest distance for all vertices is gradually replaced by more accurate values until eventually reaching the optimum solution. In the beginning all vertices have a distance of "Infinity", but only the distance of the source vertex = , then update all the connected vertices with the new distances (source vertex distance + edge weights), then apply the same concept for the new vertices with new distances and so on.

Similar questions