I have difficulties in understanding the usefulness of the Johnson Algorithm. I think the question must sound really stupid for someone with knowledge in this area, but I cannot figure it out. According to Wikipedia, the Johnson Algorithm uses the Bellman Ford Algorithm to transform the weights of the edges to non-negative weights and then uses the Dijkstra Algorithm to find the shortest path. But the Bellman Ford Algorithm is also an algorithm to find the shortest path. Why don’t we just use the shortest path that we get from the Bellman Ford Algorithm?
I have difficulties in understanding the usefulness of the Johnson Algorithm . I think
Share
The Bellman-Ford algorithm finds the shortest path from a single source to all graph vertices (“single-source shortest paths”). Johnson’s algorithm finds the shortest path from every vertex to every other vertex (“all-pairs shortest paths”), and so it is equivalent to running Bellman-Ford from every possible start vertex in your graph.