1- Implement a minimum spanning tree (MST) algorithm using C++. An MST (also minimum weight spanning tree) is a subset of the edges of a connected, edge-weighted, undirected graph that connects all the vertices together, without any cycles and with the minimum total edge weight. The program is interactive. Graph edges with respective weights are entered at the command line and results are displayed on the console.
2. Each input transaction represents an undirected edge of a connected weighted graph. The edge consists of two unequal non-negative integers in the range 0 to 99 representing graph vertices that the edge connects. Each edge has an assigned weight. The edge weight is a positive integer in the range 1 to 99. The three integers on each input transaction are separated by space. An input transaction containing the string “end-of-file” signals the end of the graph edge input. After the edge information is read, the MST process begins. Use an array with a capacity of 100 for recording input edges. The input data can be assumed to be valid, so is no need to perform data validation on the input data.
3. After the edges of the MST are determined, the MST edges are displayed on the console, one edge per output line, following the message: “Minimum spanning tree:”. Each output line representing an MST edge contains three integers separated by space. The first two integers are the two vertices representing the edge and the third integer represents the weight of the edge.
After displaying the edges of the MST, the program displays the message: “Edge weight total:” followed by the sum of the weights from the edges comprising the MST.
Note: the user must provide the input.
i will give you the example to test the code.
2 Sample input transactions are as follows: 1 3 5 3 2 6 1 2 7 end-of-file Sample output expected after processing the above input will be as follows: Minimum spanning tree: 1 3 5 3 2 6 Edge weight total: 11
this is the example
remember that the user must enter the values. The values that can be entered can be diffrenent
Computer Science homework help