Question: You need to create a graph on a page for 20 major cities of Pakistan. Map of Pakistan is attached in pdf format showing 30


You need to create a graph on a page for 20 major cities of Pakistan. Map of Pakistan is attached in pdf format showing 30 plus major cities and some roads as well. Just pick any 20 cities, and make them the vertices in your graph. To connect them to each other, use Google Maps. Google map can provide you the link between cities and their costs (kms) as well. Try to have as many paths as you can in your graph. Now convert you logical graph into a text file, so that the program should be able to read in all the details of the graph. For that assign each city a unique ID number starting from zero and onwards. The pattern of data in the text file resembles the previous pattern, we used in the program but with one additional info, i.e., link weight. The file pattern will be: Number Of Vertices Vertice# ConnectedTo Weight ConnectedTo Weight -999 Vertice# ConnectedTo Weight ConnectedTo Weight -999 Now create a class WeightedGraph with functions to create the graph (using Adjacency List or Matrix) find shortest paths using Dijkstra The program should present a menu to the user asking for the city name. With the city name, your program, should find its ID#, and using the Dijkstra Algo, find and display the shortest path to all the other cities in the graph. Modify your existing city graph of 20 cities to include ten more cities of Pakistan. Now for this assignment, you will have a graph of 30 cities interconnected through various road links. Now convert you logical graph into a text file, so that the program should be able to read in all the details of the graph. For that assign each city a unique ID number starting from zero and onwards. The pattern of data in the text file resembles the previous pattern, we used in the program but with one additional info, i.e., link weight. The file pattern will be: Number Of Vertices Vertice# ConnectedTo Weight ConnectedTo Weight -999 Vertice# ConnectedTo Weight ConnectedTo Weight -999 Now create a class WeightedGraph with functions to create the graph (using Adjacency List or Matrix) find shortest path between every two cities in the graph using Floyd-Warshal Algo The program should present a menu to the user asking for city names to find the shortest path between them From City name To City name OUTPUT: The program should print the shortest distance in Kms from source to destination all the city names coming in the path of source to destination
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
