Answered step by step
Verified Expert Solution
Link Copied!

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: //

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

ISBN: 133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago