Question: This is the Expected input This is the Expected Output Extra help info Your program should take one of the following four commands from the

 This is the Expected input This is the Expected Output Extrahelp info Your program should take one of the following four commands

This is the Expected input

from the standard input, and execute corresponding functions. On reading S, the

This is the Expected Output

program stops. On reading R, the program reads in an edge weighted

Extra help info

directed graph from file GRAPHinput.txt to build the adjacency lists, and waits

Your program should take one of the following four commands from the standard input, and execute corresponding functions. On reading S, the program stops. On reading R, the program reads in an edge weighted directed graph from file GRAPHinput.txt to build the adjacency lists, and waits for the next command. The file GRAPHinput.txt is a text file. The first line of the file contains two integers n and ma, which indicates the number of vertices and the number of edges on the graph, respectively. It is followed by m lines, where each line contains three integers u, v, and w. These three integers indicate the information of an edge: there is an edge pointing from u to v, with weight w. Please note that the vertices of the graph are indexed from 1 to n (not from 0 to n -1). On reading w, the program writes the graph information to the screen, and waits for the next command. The screen output format of W is as follows: The first line should contain two integers, n and m, where n is the number of vertices and m is the number of edges. It should be followed by n lines, where each of these n lines has the following format: u (v1 w1) (v2 w2) (var, wz) Your program should take one of the following four commands from the standard input, and execute corresponding functions. On reading S, the program stops. On reading R, the program reads in an edge weighted directed graph from file GRAPHinput.txt to build the adjacency lists, and waits for the next command. The file GRAPHinput.txt is a text file. The first line of the file contains two integers n and ma, which indicates the number of vertices and the number of edges on the graph, respectively. It is followed by m lines, where each line contains three integers u, v, and w. These three integers indicate the information of an edge: there is an edge pointing from u to v, with weight w. Please note that the vertices of the graph are indexed from 1 to n (not from 0 to n -1). On reading w, the program writes the graph information to the screen, and waits for the next command. The screen output format of W is as follows: The first line should contain two integers, n and m, where n is the number of vertices and m is the number of edges. It should be followed by n lines, where each of these n lines has the following format: u (v1 w1) (v2 w2) (var, wz)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!