Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***( Create a test driver)*** class Graph{ public: Graph(); virtual ~Graph(); // adds one vertex; returns bool if added successfully. virtual bool addVertex(Vertex& v)=0; //

image text in transcribed

***(Create a test driver)***

class Graph{

public:

Graph();

virtual ~Graph();

// adds one vertex; returns bool if added successfully.

virtual bool addVertex(Vertex& v)=0;

// adds in a set of vertices; returns bool if added successfully

virtual bool addVertices(Vertex* vArray) = 0;

// removes a vertex; the edges that have connection with this vertex need to be removed

virtual bool removeVertex(Vertex& v) = 0;

// adds an edge; returns true if the edge is added successfully.

virtual bool addEdge(Edge& e) = 0;

// removes a set of edges; as a result, some nodes may remain as orphan

virtual bool addEdges(Edge* eArray) = 0;

// remove the edge

virtual bool remove(Edge& e) = 0;

// returns bool if a vertex exists in a graph.

virtual bool searchVertex(const Vertex& v) = 0;

// returns bool if an Edge exists in a graph.

virtual bool searchEdge(const Edge& e) = 0;

// displays the path that contains the vertex.

virtual void display(Vertex& v) const = 0;

// displays the path that contains the edge.

virtual void display(Edge& e) const = 0;

// displays the whole graph with your own defined format

virtual void display() const = 0;

// converts the whole graph to a string such as 1-2-4-5; 1-3-5; each path is separated by ';'

virtual string toString () const = 0;

//remove all the vertices and edges;

virtual bool clean() = 0;

};

C++ Program: Undirected graph A Graph is formally define as G=(NE) consisting of the set N of vertices (or nodes) and the set E of and value (int) as its basic attributes. Each edge has a weight (int), starting vertex, and ending edges, which are ordered pairs of the starting vertex and the ending vertex. Each vertex has ID (int) vertex. Create the classes Vertex and Edge to represent the vertices and edges of a graph. Create a concrete derived class of Graph. The class represents an undirected graph, or DAG. Provide full code of the derived class. The definition of the abstract class Graph is provided below: C++ Program: Undirected graph A Graph is formally define as G=(NE) consisting of the set N of vertices (or nodes) and the set E of and value (int) as its basic attributes. Each edge has a weight (int), starting vertex, and ending edges, which are ordered pairs of the starting vertex and the ending vertex. Each vertex has ID (int) vertex. Create the classes Vertex and Edge to represent the vertices and edges of a graph. Create a concrete derived class of Graph. The class represents an undirected graph, or DAG. Provide full code of the derived class. The definition of the abstract class Graph is provided below

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

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

=+ Does it speak to you in a personal way? Does it solve a problem?

Answered: 1 week ago

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago