Exercise 2-b Use Dijkstra algorithm to find the best path from home to each of the destinations (fill a trips [routing] table, showing for each destination the distance and next hop) Home 1 School 2 Garden 12 Domino's Pizza 7 Domino's Pizza 1 2 5 1 3 9 3 Cinema 2 Pharmacy Mosque 10
Added by Victor Manuel G.
Close
Step 1
We can represent the destinations as nodes and the distances between them as edges. The graph representation would look like this: - Home: (Garden: 12, Domino's Pizza: 1, School: 7, Pharmacy: 2, Mosque: 10, Cinema: 3) - Garden: (Home: 12) - Domino's Pizza: Show more…
Show all steps
Your feedback will help us improve your experience
Samuel Goyette and 99 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Apply Dijkstra's algorithm to find the shortest path (in mileage) between Boston and Los Angeles. (Show the progress and the result obtained by this algorithm at each step) [5 marks] Use part(a) to find the shortest path (in mileage) between Boston and San Francisco. [2 marks] Suppose that the mileage separating Boston and Atlanta is equal to 656. Write an adjacency matrix of the weighted graph showing the mileage between the four cities Boston Chicago New York and Atlanta. [3 marks] Construct a tree to find a route with the least total mileage for a traveling salesman departing from Boston and wishing to visit Chicago, New York and Atlanta before returning back to Boston. [5 marks]
Sri K.
Use Dijkstra's algorithm to find the shortest path and its distance in each of the following questions. From A to z
Write mathematical model and determine the shortest routes between location 1 and each of the remaining four locations. Use Dijkstra's algorithm and show all iterations with details. (No grade for just writing final solution)
Adi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD