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

 ***(Create a test driver)*** class Graph{ public: Graph(); virtual ~Graph(); //

***(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

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!