Johnson’s algorithm for all pairs shortest paths