Search code examples
algorithmgraphtheorygraph-algorithm

Modifying shortest path to get a min-cost path


If we modify the shortest path problem such that the cost of a path between two vertices is the maximum of the costs of the edges on it, then for any pair of vertices u and v, the path between them that follows a minimum-cost spanning tree is a min-cost path.

How can I prove this approach is true? It makes sense but I am not sure. Does anyone know if this algorithm exists in the literature? Is there a name for it?


Solution

  • You can use some basic facts of MST (that are usually discussed in the correctness proof for Prim's & Kruskal's algorithms). The one that matters now is that

    Lema 1:

    Given a graph cut (a partitioning of the vertices into two disjoint sets) the edge in the MST connecting the two parts will be the cheapest of the edges connecting the two parts.

    (The proof is straighfoward, if there were a cheaper edge we would be able to easily contruct a cheaper spanning tree)

    We can now prove that the paths in a MST are all min-cost paths if you consider the maximum-cost:

    Take any two vertices s and t in G and the path p that connects them in a MST of G. Now let uv be the most expensive edge in this path. We can describe a graph cut over this edge, with one partition with the vertices on the u side of the MST and the other partition with the vertices on the v side. We know that any path connecting s and t must pass this cut, therefore we can determine that the cost of any path from s to t must be at least the cost of the cheapest edge on this cut. But Lemma 1 tells us that uv is the cheapest edge on this cut so p must be a min-cost path.