3. Consider the following weighted graph: San Seattle 808 Francisco Las Vegas 2060 2257 1780 Oklahoma City 272 Phoenix Los Angeles 1440 792 12 Minneapolis 1217 Milwaukee 949 Chicago 948 1614 New York 811 City 237 Washington D.C. 1423 517 Dallas 'New Orleans Miami Assume Phoenix is the start node and Chicago is the destination node. Trace the contents of the Distance Destination, Path, and Included arrays as Dijkstra shortest path algorithm runs to generate the shortest path between the start and the destination. Provide only the final states of the arrays.
Added by Catherine E.
Close
Step 1
Start with the start node, Phoenix. Initialize the distance array with the distance from Phoenix to all other nodes as infinity, except for Phoenix itself which is 0. Initialize the previous node array as null for all nodes except Phoenix. Distance: [0, infinity, Show more…
Show all steps
Your feedback will help us improve your experience
Syed Vasi and 51 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 traveling salesman algorithm to find a route with the least total airfare that visits each of the cities in this graph excluding Denver and starting from San Francisco, where the weight on an edge is the least price available for a flight between the two cities. a. Write the Adjacency Matrix. b. Construct a tree showing all the possibilities with their minimum costs. c. Use part (b) to find the best route with its cost.
Madhur L.
The graph below shows five cities. The weights on the edges represent the airfare for a one-way flight between the cities. Seattle $70 $120 $150 Dallas LA $140 $165 $100 $170 $145 $85 $75 Chicago Atlanta 1) How many vertices and edges does the graph have? The graphs consists of 5 vertices + 10 edges 2) Is the graph connected? The graph is connected because there is a path between every pair of vertex. 3) What is the degree of the vertex representing LA? The degree of the vertex representing LA is 4) If you fly from Seattle to Dallas to Atlanta, is that a path or a circuit? This is a path 5) If you fly from LA to Chicago to Dallas to LA, is that a path or a circuit? This is a circuit 6) Find the circuit generated by the Nearest Neighbor Algorithm started at Chicago.
Adi S.
Use the mileage chart shown below to find the minimum spanning tree for the 6 cities of Atlanta, Dallas, Denver, Houston, Kansas City, and Memphis. Using Kruskal's algorithm which edge is chosen last? Group of answer choices Memphis - Denver. None of the above Memphis - Dallas. Kansas City - Denver. Kansas City - Memphis.
Krishna G.
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