July 2018
Beginner
202 pages
5h 4m
English
Sometimes, it might be necessary to compute the shortest paths between all pairs of vertices. For example, we might be interested in building a table of distances. One way to do that is to perform a single source shortest path for every vertex of the graph. If you use Dijkstra's algorithm for that, we end up with a runtime of O(V*(V + E)logE).
In this subsection, we shall explore an algorithm capable of solving the all pairs shortest paths problem in O(V3) time, with a remarkably simple and elegant implementation.
Read now
Unlock full access