All-pairs shortest path problem