Dijkstra's algorithm
By using a modified version of Dijkstra's algorithm that simultaneously computes the distances to each vertex in the graphs , it is also possible to find the total lengths of the shortest pairs of paths from a given source vertex to every other vertex in the graph, in an amount of time that is proportional to a single instance of Dijkstra's algorithm.