Implements shortest path algorithms by Dijkstra, Floyd and Warshall.