Dijkstra's algorithm guarantees the shortest path