Dijkstra's application to find the path