Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?


2 Answers

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.

like image 148
hugomg Avatar answered Dec 08 '25 20:12

hugomg


The approach you mentioned is discussed in detail in literatures that discuss the relationship between Prim's algorithm and Dijkstra's algorithm, as usual wikipedia is a good place to start your research:

The process that underlies Dijkstra's algorithm is similar to the greedy process used in Prim's algorithm. Prim's purpose is to find a minimum spanning tree that connects all nodes in the graph; Dijkstra is concerned with only the lowest cost path beteen two nodes.

like image 31
Desmond Zhou Avatar answered Dec 08 '25 19:12

Desmond Zhou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!