finish Dijkstra's algorithms