Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Your task for this assignment is to identify a spanning tree in a connected undirected weighted graph using C++.

1. Implement a spanning tree algorithm using C++. A spanning tree is an acyclic spanning subgraph of the of a connected undirected weighted graph. Your program will be interactive. Graph edges with respective weights (i.e., v1 v2 w) 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 uppercase letters 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 values on each input transaction are separated by a single 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 spanning tree evaluation process begins. Use an adjacency matrix for recording input edges and show all code used to determine the spanning tree. The input data is assumed to be valid. There is no need to perform data validation on the input data.

3. 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 edge vertices separated by space.

Sample input transactions are as follows: A B 2 A C 4 A D 10 A E 6 B C 3 B D 8 B E 1 C D 55 C E 7 D E 9 end-of-file Sample output expected after processing the above input will be as follows:

2 Spanning tree: A C B C A D D E 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.

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education