Question: In C++, write a main program that: 1- Calls a function to read an adjacency list from a text file called ListFile.txt for a given
In C++, write a main program that:
1- Calls a function to read an adjacency list from a text file called ListFile.txt for a given graph
This is a weighted graph so the adjacency list for a node has the nodes number adjacent to it followed by a comma and followed by the weight of the edge, followed by a space, and other node information. Hint: use istringstream
So, for example, adjacency list for node one may look like: 3,17 5,30 7,9 This meas that there is an edge between node 1 and 3 with the weight of 17, there is an edge between nodes 1 and 5 with weight 30, and there is an edge between nodes 1 and 7 with the weight 9.
2- Calls a function that prints the edges in the minimum Spanning tree of the graph
3- Calls a function that prompts the user for a source node and prints the shortest distance to every other node in the graph
Note: You may want to look up Dijkstras although other algs are appropriate.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
