Implement Dijkstra's shortest path algorithm