There is a network of roads G=(V,E) connecting a set of cities . Each road in E has an associated length Ie. There is a proposal to add one new road to this network, and there is a list E' of pairs of cities between which the new road can be built. Each such potential road localid="1659075853079" e'E' has an associated length. As a designer for the public works department you are asked to determine the road localid="1659075866764" e'E'whose addition to the existing network G would result in the maximum decrease in the driving distance between two fixed cities s and t in the network. Give an efficient algorithm for solving this problem.

Short Answer

Expert verified

answer is not available.

Step by step solution

01

Step-1: Shortest Path Problem

The shortest path issue in graph theory is the task of finding a path between two vertex (or nodes) in a graph that minimizes the total of the weights of its constituent edges. For multiplicative weights, the generalised shortest path issue can be resolved quickly. The solution is to invert Dijkstra's algorithm.

Dijkstra algorithm is an application of single source shortest path.Dijkstra’s algorithm also known as SPF algorithm and is an algorithm for finding the shortest paths between the vertices in a graph. It returns a search tree for all the paths the given node can take. An acyclic graph is a directed graph that has no cycles. Its operation is performed in the minheap.

Dijkstra’s algorithm is a single-source shortest path problem. It is used in both directed and undirected graph with non negative weight.

02

Step-2: Algorithm for determining shortest path.

Take a look at the graph G=(V,E) and the new edges E' . Now choose an edge(road) e'E'.

Assume that e'=x,y and e'=Ie , are both equal in length. The shortest distance from s to t is then calculated by dsx+Ie+dty .

Dijkstra's algorithm can be used to find the shortest path distances. To find the shortest path distance from s to x , run the Dijkstra's algorithm once from . Run the Dijkstra's method again from t to get the shortest path distance between v and t .

And the shortest path issue in graph theory is the task of finding a path between two vertex (or nodes) in a graph that minimizes the total of the weights of its constituent edges. For multiplicative weights, the generalised shortest path issue can be resolved quickly. The solution is to invert Dijkstra's algorithm.

Assume that when Dijkstra's algorithm is run from vertex, it finds the shortest distance betweenand all vertices, which is represented bydiss,u, u can represent any vertex in the graph.

Dijkstra algorithm is an application of single source shortest path.Dijkstra’s algorithm also known as SPF algorithm and is an algorithm for finding the shortest paths between the vertices in a graph. It returns a search tree for all the paths the given node can take. An acyclic graph is a directed graph that has no cycles. Its operation is performed in the minheap.

Dijkstra’salgorithm is a single-source shortest path problem. It is used in both directed and undirected graph with non negative weight.

Next, calculate the length of the shortest path from s to t through each edge e'E, and choose the best edge that delivers the least distance between s s and t .

  • From s to any node x , use Dijkstra, and from to any node y , use Dijkstra.
  • The shortest distances between sdsx and tdtywill be obtained as a result of this.
  • Then locate the edge that minimizes dsx+Ie+dty by iterating over all. Dijkstra plus e=x,yE'y ,which is oElogV+E' is the total running time OF' .

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Shortest paths are not always unique: sometimes there are two or more different paths with the minimum possible length. Show how to solve the following problem in O((|V|+|E|)log|V|)time.

Input:An undirected graph G=(V,E);edge lengths le>0; starting vertex sV.

Output:A Boolean array for each node u , the entry usp[u]should be true if and only if there is a unique shortest path s to u (Note:usp[s]=true)

Professor F. Lake suggests the following algorithm for finding the shortest path from node to node t in a directed graph with some negative edges: add a large constant to each edge weight so that all the weights become positive, then run Dijkstra’s algorithm starting at node s , and return the shortest path found to node t .

Is this a valid method? Either prove that it works correctly, or give a counterexample.

You are given a set of cities, along with the pattern of highways between them, in the form of an undirected graph G = (V , E). Each stretch of highway eEconnects two cities, and you know its length in miles, le. You want to get from city s to city t. There’s one problem: your car can only hold enough gas to cover L miles. There are gas stations in each city, but not between cities. Therefore, you can only take a route if every one of its edges has length leL

(a) Given the limitation on your car’s fuel tank capacity, show how to determine in linear time whether there is a feasible route from sto t.

(b) You are now planning to buy a new car, and you want to know the minimum fuel tank capacity that is needed to travel from s to t. Give anO[(V+E)log|V|]algorithm to determine this.

Give an O|V|2algorithm for the following task.

Input:An undirected graph G=(V,E); edge lengths Ie>0;an edge eE.

Output:The length of the shortest cycle containing edge e

Generalized shortest-paths problem.In Internet routing, there are delays on lines but also, more significantly, delays at routers. This motivates a generalized shortest-paths problem.

Suppose that in addition to having edge lengths {Ie:eE} ,a graph also has vertex costs {cV:vV} . Now define the cost of a path to be the sum of its edge lengths, plusthe costs ofall vertices on the path (including the endpoints). Give an efficient algorithm for the followingproblem.

Input:A directed graph G={V,E} positive edge lengths Ie and positive vertex costs cv; a starting vertex sv.

Output:An array cost[.] such that for every vertex u,costu, is the least cost of any path from s to u (i.e., the cost of the cheapest path), under the defnition above.

Notice that cost[s]=c.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free