|Get Selected Weeks Solution with ONLY||NOT||Add Selected Tutorials To Cart|
A single zip file including the following.
If you document any issues, it will be easier to isolate any problems, provide detailed help, and could potentially improve your grade.
The purpose of this week’s iLab is to extend your Week 6 iLab and implement Dijkstra’s algorithm to find the shortest path and distance to all destinations from a source node in an arbitrary graph.
Part 1: Priority Queues
The shortest path algorithm you will implement requires selecting the smallest distance from a set of distances between two nodes that have recently been inserted. Because you are now an algorithms and data structure expert, you immediately recognize the best solution for this problem: a priority queue.
However, it is unlikely you have a Priority Queue C++ implementation laying around as none of the iLabs has asked for this implementation. In order to adding functionality for selecting the smallest path from a set of pathsm you may do any of the following.
Please select and perform ONE of the following implementation options.
Think about the run-time for the Dijkstra algorithm in each of the cases listed above.
Option 1 will require significant additional implementation time, but is the best solution because it results in the lowest run-time. Options 2, 3, and 4 are best for you if you’ve written your ADTs well and are comfortable with extending them but still may require moderate additional time.
Option 5 will be the easiest to implement in most cases as you can simply do a linear search; however, option 5 results in the worst run-time performance of Dijkstra.
Any option you select will be worth full credit, providing the functionality is correct.
Part 2: Dijkstra
Implement Dijkstra’s algorithm based on the pseudo code given in lecture or your web research to find all paths and weight totals from an arbitrary graph source node. Your Dijkstra algorithm should output the shortest distance from a source node to each other node as well as output the shortest path to each node.
Part 3: Output Shortest Paths
Because you will need to output the shortest path as well as distance you will need to keep track of each node’s previous node. Note that this means you will need to return two arrays from Dijkstra—a distance array and a previous array. Therefore, you will need to create a small function that outputs values from the previous array “backwards.”
For example, if your source node is Austin and your array positions are as indicated in the city example problem from iLab 6, the shortest path to Atlanta will be Austin->Houston->Atlanta. If in the previous array, Atlanta is at position 0, Houston at position 5, and Austin at position 1, then to output the shortest path to Atlanta you will need to output Atlanta, then previous, which will be 5 (Houston) and then output previous which will be 1 (Austin).
Part 4: Test Driver
Your test driver should be extended from Week 6 and contain all the same commands to create a graph ADT and a command to setup the city test problem given in iLab 6. In addition, you must create a command to run Dijkstra’s algorithm on a user specified source node. You can choose the input method of the source code.
Your program must output each node’s name, the complete shortest path to that node from the source node, and the shortest path distance.
For example, if the source is Austin, the first few lines of output should be of the form (order is not significant):
Houston (160): Austin->Houston
Atlanta (960): Austin->Houston->Atlanta
Design a test plan with at least a few test cases and implement your test plan. At least one test case should use the city example below. You do not have to submit your test plan, but it would be a good idea to verify your algorithm by testing at least a few different problems and source nodes in various graphs.
Part 5: Lab Questions
Consider and answer the following questions in your Lab write-up. Big-O of Dijkstra is calculated using V (vertices) and E (edges) rather than N.
General iLab Comments
All oding assignments for this class will be using Microsoft Visual Studio. This is available through the Software Store, which can be found in Course Home. Contact the help desk if you encounter any issues or contact your professor.
*Please note as a reminder that you may not copy code from any web reference to complete this assignment, even if you correctly give credit. You may of course use web references to help you understand, but you must code the assignment yourself. You may use code directly from your textbook where applicable, but do make sure you give credit in your comments if you are doing so.
Here is solution for GSP295 - Week 7
It is 100% correct.
Solution contain Visual Studio C++ project and document answer all questions.
If you have more questions, please contact me via email firstname.lastname@example.org
I will help you any time
Thank you very much