Dijkstra - Single Source Shortest Path

Dijkstra is a Greedy algorithm to find the shortest path in a graph from a single source. Let’s take a weighted a graph as below: We’ll take 0 as the source. Shortest path from source 0 to node 4 will go through node 1 and node 3: Similarly we’ve to find the shortest path from the source 0 to every node. How does Dijkstra finds this ? Understanding Dijkstra Dijkstra like any other Greedy algorithm finds the next most optimum path at each step....

October 15, 2022 · 5 min · Ashish Gaur