Since the reweighting adds the same amount to the weight of every path, a path is a shortest path in the original weighting if and only if it is a shortest path after reweighting. The weight of edges that belong to a shortest path from "q" to any node is zero, and therefore the lengths of the shortest paths from "q" to every node become zero in the reweighted graph; however, they still remain shortest paths. Therefore, there can be no negative edges: if edge "uv" had a negative weight after the reweighting, then the zero-length path from "q" to "u" together with this edge would form a negative-length path from "q" to "v", contradicting the fact that all vertices have zero distance from "q". The non-existence of negative edges ensures the optimality of the paths found by Dijkstra's algorithm. The distances in the original graph may be calculated from the distances calculated by Dijkstra's algorithm in the reweighted graph by reversing the reweighting transformation.