Dijkstra’s algorithm of finding optimal paths