Question: Suppose we are trying to implement a program that finds a path between any two locations within Seattle that takes the shortest amount of time

 Suppose we are trying to implement a program that finds a

Suppose we are trying to implement a program that finds a path between any two locations within Seattle that takes the shortest amount of time possible. Note that the time needed to travel down a particular stretch of road depends on several different factors such as the length of the road, the speed limit, and the amount of traffic. In case of a tie, the program should find us the route with the shortest physical distance. For example, suppose we are considering two different routes from UW to the Space Needle. Based on current traffic conditions, both routes will take 15 minutes. However, route one is 3.5 miles long and route two is 3.7 miles long. In that case, our algorithm should pick route one. (a) Explain how you would model this scenario as a graph. Answer the following questions in bullet points with short sentences, then give an overall description on anything else that is relevant: What are your vertices and edges? What information do you store for each vertex and edge? . Is this a weighted graph or an unweighted orne Is this a directed or undirected graph? Do you permit self-loops? Parallel edges? (b) Explain how you would modify Dijkstra's algorithm to find us the best route according to the specifications listed above. In particular, be sure to explain: How you combine or use different factors like road length, the speed limit, or the amount of traffic while finding the best route. How you would modify Dijkstra's algorithm to break ties in the manner described above. Use the following pseudocode for Dijkstra's algorithm as a base for your response to this question; it will be helpful to list specific lines that you will be modifying to fit this specific problem. Be sure your algorithm makes sense when combined with the graph representation you chose in part a. Dijkstra(Graph G, Vertex source) initialize distances to infinity mark source as distance 0 mark all vertices unprocessed while (there are unprocessed vertices) let u be the closest unprocessed vertex foreach (edge (u, v) leaving u) C if (u.distw(u, v)

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!