Question: Consider the following network graph: 2 4 4 4 7 10 4 2 S 9 Note that this is similar to the graph of cities

 Consider the following network graph: 2 4 4 4 7 10

Consider the following network graph: 2 4 4 4 7 10 4 2 S 9 Note that this is similar to the graph of cities in the Traveling Salesman problem. Part a) Write a representation of the graph using an adjacency matrix. This should be in the form of a table in your report document. Write a representation of this adjacency table in Python, using a list of lists. Part b) Write a recursive solution to find the minimum distance between any start node, to node 10. Your solution should take as inputs the start node, and return two things: 1) The optimal route from that node to the end (a list of node numbers) 2) The total distance for that route Test it by determining the optimum path and distance from node 1. Test it by determining the optimum path and distance from node 2. Part ) Count how many times your recursive function got called for solving the two problems from part b). Implement a results dictionary that lets you avoid duplicate calculations. Count the number of times your function is getting called for each of the two test cases with this approach. Comment on the advantage of implementing a results dictionary for this problem. Consider the following network graph: 2 4 4 4 7 10 4 2 S 9 Note that this is similar to the graph of cities in the Traveling Salesman problem. Part a) Write a representation of the graph using an adjacency matrix. This should be in the form of a table in your report document. Write a representation of this adjacency table in Python, using a list of lists. Part b) Write a recursive solution to find the minimum distance between any start node, to node 10. Your solution should take as inputs the start node, and return two things: 1) The optimal route from that node to the end (a list of node numbers) 2) The total distance for that route Test it by determining the optimum path and distance from node 1. Test it by determining the optimum path and distance from node 2. Part ) Count how many times your recursive function got called for solving the two problems from part b). Implement a results dictionary that lets you avoid duplicate calculations. Count the number of times your function is getting called for each of the two test cases with this approach. Comment on the advantage of implementing a results dictionary for this

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!