Question: Programming language is C++, and please divide into files (.hpp and .cpp for classes). Thanks. Problem statement A Graph is formally define as G=(N,E) consisting

Programming language is C++, and please divide into files (.hpp and .cpp for classes). Thanks. Programming language is C++, and please divide into files (.hpp and

.cpp for classes). Thanks. Problem statement A Graph is formally define as

Problem statement A Graph is formally define as G=(N,E) consisting of the set N of vertices (or nodes) and the set E of edges, which are ordered pairs of the starting vertex and the ending vertex. Each vertex has ID (int) and value (int) as its basic attributes. Each edge has a weight (int), starting vertex, and ending vertex. A Graph can be a directed graph where vertices are connected by edges, and all the edges are directed from one vertex to another A Directed Acyclic Graph (DAG) is a finite directed graph with directed cycles. This means from any vertex v, there is no way to follow a sequence of edge that eventually loops back to v agairn An undirected graph is a graph where the edges are bidirectional The definition of the abstract class Graph is provided below. Note that all its member functions are pure virtual. This is because the implementation of these functions is different from one graph to another. You are allowed to slightly modify this class by adding new member functions class Graphf public: Graph ) virtual Graph (); //adds one vertex; returns bool if added successfully virtual bool addvertex (Vertex& v)=0; //Bonus question: 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; result, some nodes may remairn /Bonus question: removes a set of edges; as a //as orphan. //virtual bool addEdges (Edge* eArray) 0; /7 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; Problem statement A Graph is formally define as G=(N,E) consisting of the set N of vertices (or nodes) and the set E of edges, which are ordered pairs of the starting vertex and the ending vertex. Each vertex has ID (int) and value (int) as its basic attributes. Each edge has a weight (int), starting vertex, and ending vertex. A Graph can be a directed graph where vertices are connected by edges, and all the edges are directed from one vertex to another A Directed Acyclic Graph (DAG) is a finite directed graph with directed cycles. This means from any vertex v, there is no way to follow a sequence of edge that eventually loops back to v agairn An undirected graph is a graph where the edges are bidirectional The definition of the abstract class Graph is provided below. Note that all its member functions are pure virtual. This is because the implementation of these functions is different from one graph to another. You are allowed to slightly modify this class by adding new member functions class Graphf public: Graph ) virtual Graph (); //adds one vertex; returns bool if added successfully virtual bool addvertex (Vertex& v)=0; //Bonus question: 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; result, some nodes may remairn /Bonus question: removes a set of edges; as a //as orphan. //virtual bool addEdges (Edge* eArray) 0; /7 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

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!