Question: in c++ Write a C++ program that reads a non-directed graph from a text file (chosen by the user) using exactly the following format: //

 in c++ Write a C++ program that reads a non-directed graph

in c++

Write a C++ program that reads a non-directed graph from a text file (chosen by the user) using exactly the following format: // number of vertices, with assumed names 1 to N (Max 100) // number of edges M Pairs of integers /the M edges (at any order) Use an adjacency matrix to store the graph and design your program following the Object-Oriented approach (the adjacency matrix is an instance variable inside the class "Graph" The class "Graph" should contain an integer method that returns the number of connected components in the graph Computing the number of connected components should be done by conducting a repeated calls to depth-first search until all the vertices in the graph are visited. After reading the graph from the file, the program should have an interactive menu with these choices: 1 Add an edge to the graph 2- Delete an edge from the graph 3- Report the number of connected components in the current graph

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!