graph-theorydijkstra

How accurate is Dijkstra Algorithm?


Is it necessary that Dijkstra Algorithm always finds the shortest path between two veritices?


Solution

  • If all the edge weights in your graph is positive, Dijkstra's algorithm finds the shortest path. But it doesn't work if the graph has negative weights. For finding shortest path in graphs with negative edge weights, algorithm like Bellman-Ford is used.