Implement a spanning tree algorithm using C++. A spanning tree is an acyclic spanning subgraph of the of a connected undirected weighted graph. The program is interactive. Graph edges with respective weights (i.e., v1 v2 w) are entered at the command line and results are displayed on the console. 1. 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 9 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 process begins. Use an adjacency matrix for recording input edges and show all code used to determine the spanning tree. The input data can be assumed to be valid, so is no need to perform data validation on the input data. 2. After the edges of the spanning tree are determined, the tree edges are displayed on the console, one edge per output line, following the message: "Spanning tree:". Each output line representing a tree edge contains two integers separated by space. These integers are the two vertices representing the edge. 3. Sample input transactions are as follows: 10 30 81 30 20 62 10 20 73 end-of-file Sample output expected after processing the above input will be as follows: Spanning tree: 10 30 30 20 4. The program will be run at the command prompt by navigating to the directory containing the executable version of the program after the program is compiled.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Implement a spanning tree algorithm using C++. A spanning tree is an acyclic spanning
subgraph of the of a connected undirected weighted graph. The program is interactive.
Graph edges with respective weights (i.e., v1 v2 w) are entered at the command line and
results are displayed on the console.
1.
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 9 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 process begins. Use an
adjacency matrix for recording input edges and show all code used to determine the
spanning tree. The input data can be assumed to be valid, so is no need to perform data
validation on the input data.
2.
After the edges of the spanning tree are determined, the tree edges are displayed on the
console, one edge per output line, following the message: "Spanning tree:". Each output
line representing a tree edge contains two integers separated by space. These integers are
the two vertices representing the edge.
3.
Sample input transactions are as follows:
10 30 81
30 20 62
10 20 73
end-of-file
Sample output expected after processing the above input will be as follows:
Spanning tree:
10 30
30 20
The program will be run at the command prompt by navigating to the directory containing
the executable version of the program after the program is compiled.
4.
Transcribed Image Text:Implement a spanning tree algorithm using C++. A spanning tree is an acyclic spanning subgraph of the of a connected undirected weighted graph. The program is interactive. Graph edges with respective weights (i.e., v1 v2 w) are entered at the command line and results are displayed on the console. 1. 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 9 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 process begins. Use an adjacency matrix for recording input edges and show all code used to determine the spanning tree. The input data can be assumed to be valid, so is no need to perform data validation on the input data. 2. After the edges of the spanning tree are determined, the tree edges are displayed on the console, one edge per output line, following the message: "Spanning tree:". Each output line representing a tree edge contains two integers separated by space. These integers are the two vertices representing the edge. 3. Sample input transactions are as follows: 10 30 81 30 20 62 10 20 73 end-of-file Sample output expected after processing the above input will be as follows: Spanning tree: 10 30 30 20 The program will be run at the command prompt by navigating to the directory containing the executable version of the program after the program is compiled. 4.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Polynomial time
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education