shortest path in a weighted graph
RU: кратчайший путь во взвешенном графе
In a weighted graph a path's length is the sum of its edge weights, not the number of edges, so the cheapest route may use more edges. Plain BFS no longer works; Dijkstra's algorithm handles non-negative weights.