Question: We are given a weighted graph G = (V, E) with weights given by W. The nodes represent cities and the edges are (positive) distances

 We are given a weighted graph G = (V, E) with

We are given a weighted graph G = (V, E) with weights given by W. The nodes represent cities and the edges are (positive) distances between the cities. We want to get a car that can travel between any two cities: it can leave with a full tank of gas, but cannot purchase gas until it reached its destination. The zero-stop-capacity of the car we purchase is defined to be the longest distance between any two cities that we may travel (but of course, between any two cities we would take the shortest path). A simple way to compute this is to run Floyd-War shall (0(n^3)), and then look at all pairs of vertices/cities and return the greatest distance (0(n^2)). A bit more formally, Floyd-War shall returns W*, where W*[u, v] is the length of the shortest route from city u to v. The zero-stop-capacity is thus max {W*[u, v] | u, v element E}. Now suppose that you want to calculate the necessary one-stop-capacity of a potential car: we are allowed to stop at just one intermediate city to purchase gas for the car. Describe an algorithm to determine what capacity would be needed for our car to travel between any two cities with at most one refueling stop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!