Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 graphStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started