Assignment title: Information
Question
C++ programming
Q
Write a program that can accomplish the following:
1. Read in a graph from graph.dat in the following format:
node# 1st-arc-to-node# weight-for-previous-arc 2nd-arc-to-node# weight-for-previous-arc 3rd-arc-to-node# weight-for-previous-arc ...
As an example:
1 2 10 3 5 4 100
2 1 5
4 3 50 2 10
In the above example, node 1 has an arc with weight 10 to node 2, weight 5 to node 3, and weight 100 to node 4. Node 2 has an arc with weight 5 to node 1. Node 4 has an arc to node 3 with weight 50 and to node 2 with weight 10.
Note that in the above example, there IS a node 3 despite not being specifically declared on a line. Any node that is either explicitly defined on its own line, or into which an arc goes, must be considered to exist.
2. Display an ascii art image of the graph on the screen. An sample for the above example is shown below. It is not the only possible example: