Question: c++ please #include Graph.h int main() { Graph g; g.addVertex(A); g.addVertex(B); g.addVertex(C); g.addVertex(D); g.addVertex(E); g.addVertex(G); g.addEdge(A, B); g.addEdge(A, C); g.addEdge(B, A); g.addEdge(C, E); g.addEdge(D, B);

c++ please

c++ please #include "Graph.h" int main() { Graph g; g.addVertex("A"); g.addVertex("B"); g.addVertex("C");

#include "Graph.h" int main() { Graph g; g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.addVertex("E"); g.addVertex("G"); g.addEdge("A", "B"); g.addEdge("A", "C"); g.addEdge("B", "A"); g.addEdge("C", "E"); g.addEdge("D", "B"); g.addEdge("E", "B"); g.addEdge("E", "D"); g.addEdge("G", "E"); g.printPath("A", "D"); g.printPath("B", "D"); g.printPath("A", "G"); } 

Submit your solution in a header file named Graph.h Write a class named Graph that implements an unweighted, directional graph. The book is correct in that there are many different ways to implement a Graph, and you are free to choose the implementation that is easiest to you. As such, the following UML diagram only specifies the methods you must have in your public interface. Any private attributes will depend on your implementation and so are left undefined in the diagram Graph +addVertex(name: string): void +addEdge(from: string, to: string): void +removeVertex(name: string): void +removeEdge(from: string, to: string): void +printPath(from: string, to: string) void Attribute Descriptions: . addVertex): takes the name of the Vertex as it's only argument. The vertex is added to the graph addEdge0: takes the name of the source Vertex as it's first argument, an the destination Vertex as it's second argument. Adds the edge to the graph. So, if the edge is supposed to be (A, D), then the first argument would be "A" and the second would be removeVertex0: takes the name of a Vertex as it's only argument. The matching Vertex is removed from the graph, along with all edges pointing to it. removeEdge0: takes the names of adjacent Vertices as it's only arguments. Removes the matching edge from the graph. printPath0: Accepts a starting Vertex and an ending Vertex as it's arguments. Uses either Breadth-first or Depth-first search (your choice) to print all the nodes from the starting Vertex to the ending Vertex to the screen. If the ending Vertex is not found, should print "NO PATH FOUND" to the screen

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!