Question: Output: Write a C++ or Java class definition for an abstract data type called Graph that models an undirected graph. Implement the following public member

 Output: Write a C++ or Java class definition for an abstract

data type called Graph that models an undirected graph. Implement the followingpublic member functions: A constructor that creates an empty graph An appropriate

Output:

destructor. No need if you use Java. void load (char *filename): Creates

Write a C++ or Java class definition for an abstract data type called Graph that models an undirected graph. Implement the following public member functions: A constructor that creates an empty graph An appropriate destructor. No need if you use Java. void load (char *filename): Creates the graph using the file passed into the function. The format of the file is described later. You may assume load is only called once for a graph. You may modify the argument type of this function if you use Java. void display ():Displays the graph's adjacency matrix to the screen. void displayDFS (int vertex): Displays the result of a depth first search starting at the provided vertex. When you have a choice between selecting two vertices, pick the vertex with the lower number void displayBFS (int vertex): Displays the result of a breadth first search starting at the provided vertex. When you have a choice between selecting two vertices, pick the vertex with the lower number You are permitted to add extra member functions you feel are helpful. DFS must be implemented using recursion. You can use "queue" in STL in the implementation of BFS Other forms of using STL are not permitted Additional requirements and reminders: Loops are allowed but multiple edges are not allowed. Vertices are labeled numerically from 0 to n-1 where n is the number of vertices in the graph If using C++, name your files Graph.h, Graph.cpp and HW4.cpp. If using Java, name your files Graph.java and HW4.java

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!