

 


 

Get Selected Weeks Solution with ONLY  NOT  Add Selected Tutorials To Cart 
Deliverables
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.
Summary
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 runtime 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 runtime. 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 runtime 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[0], which will be 5 (Houston) and then output previous[5] 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 writeup. BigO 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 support@extutorials.com
I will help you any time
Thank you very much
5 option: Implement a priority queue ADT that uses integer distances as keys and stores strings as its data item. Time complexity of Dijkstra algorithm is O(M log N) Reuse your binary tree ADT but modify it to place items based on an integer key. Then add an ADT function to select the minimum item by recursively following the left node of the tree. Time complexity of Dijkstra algorithm
// GSP295Week7iLab.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #define MAX_VERTICES 100 #define INF 1000000000 using namespace std; char* label[MAX_VERTICES]; int weight[MAX_VERTICES][MAX_VERTICES]; int best[MAX_VERTICES]; int numVertices; int trace[MAX_VERTICES]; void init() { numVertices = 7; for (int i = 1; i
======================================================================== CONSOLE APPLICATION : GSP295Week7iLab Project Overview ======================================================================== AppWizard has created this GSP295Week7iLab application for you. This file contains a summary of what you will find in each of the files that make up your GSP295Week7iLab application.
// stdafx.cpp : source file that includes just the standard includes // GSP295Week7iLab.pch will be the precompiled header // stdafx.obj will contain the precompiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include #include // TODO: reference additional headers your program requires here
#pragma once // Including SDKDDKVer.h defines the highest available Windows platform. // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. #include