Johnson's Algorithm - Correctness

Correctness

In the reweighted graph, all paths between a pair s and t of nodes have the same quantity h(s)h(t) added to them. The previous statement can be proven as follows: Let p be an s-t path. Its weight W in the reweighted graph is given by the following expression:

Notice that every is cancelled by in the previous bracketed expression; therefore, we are left with the following expression for W:

Notice that the bracketed expression is the weight of p in the original weighting.

Since the reweighting adds the same amount to the weight of every s-t 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.

Read more about this topic:  Johnson's Algorithm

Famous quotes containing the word correctness:

    With impressive proof on all sides of magnificent progress, no one can rightly deny the fundamental correctness of our economic system.
    Herbert Hoover (1874–1964)

    Rather would I have the love songs of romantic ages, rather Don Juan and Madame Venus, rather an elopement by ladder and rope on a moonlight night, followed by the father’s curse, mother’s moans, and the moral comments of neighbors, than correctness and propriety measured by yardsticks.
    Emma Goldman (1869–1940)

    The surest guide to the correctness of the path that women take is joy in the struggle. Revolution is the festival of the oppressed.
    Germaine Greer (b. 1939)