Computer Science homework help

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.

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp