##. I have done some part of this program I just need to work on the remaining functions such as dislayDFS, displayBSF, and bool isBipartite. You should not use additional functions and everything nee

We're the ideal place for homework help. If you are looking for affordable, custom-written, high-quality and non-plagiarized papers, your student life just became easier with us. Click either of the buttons below to place your order.


Order a Similar Paper Order a Different Paper

##. I have done some part of this program I just need to work on the remaining functions such as dislayDFS, displayBSF, and bool isBipartite. You should not use additional functions and everything need to be iterative NO RECURSIVE

Write a C++ class definition for an abstract data type called Graph that models an undirected graph. Vertices are labeled by number from 0 to n-1 where n is the number of vertices in the graph. Implement the following public member functions. • Graph(char *fileName): A constructor that creates the graph using the file passed into the function. o The format of the file is described later in the document. • ~Graph(): An appropriate destructor. • void display() const: Displays the graph’s adjacency matrix to the screen using this format (see examples later): o Single space between digits. o First row (top) and first column (left) is vertex 0, second row and column is vertex 1, …, last row (bottom) and last column (right) is vertex n – 1. • void displayDFS(int vertex) const: Displays the result of a depth first search starting at the provided vertex. o When you have a choice between selecting two vertices, pick the vertex with the lower number. • void displayBFS(int vertex) const: Displays the result of a breadth first search starting at the provided vertex. o When you have a choice between selecting two vertices, pick the vertex with the lower number. • bool isBipartite() const: Returns true if the graph is bipartite and false otherwise.

##. I have done some part of this program I just need to work on the remaining functions such as dislayDFS, displayBSF, and bool isBipartite. You should not use additional functions and everything nee
// FILE: StackInt.cpp// DESCRIPTION: Class implementation for a stack of integers// NOTE: You are not allowed to modify this file.#include #include using namespace std;#include “StackInt.h”// Add an integer to the top of the stack.void StackInt::push(int val){stackObj.push(val);}// Removes and returns an integer from the top of the stack. Aborts the// program is the stack is empty.int StackInt::pop(){int val = top();stackObj.pop(); return val;}// Returns but does not remove the integer at the top of the stack. Aborts the// program is the stack is empty.int StackInt::top() const{if (isEmpty()) { cerr << "Tried to access empty stack --> aborting program” << endl;exit(-1);}return stackObj.top();}// Returns true if the stack is empty.bool StackInt::isEmpty() const{return stackObj.empty();} // FILE: QueueInt.cpp// DESCRIPTION: Class implementation for a queue of integers// NOTE: You are not allowed to modify this file.#include #include using namespace std;#include “QueueInt.h”// Add an integer to the back of the queue.void QueueInt::enqueue(int val){ queueObj.push(val);}// Removes and returns an integer from the front of the queue. Aborts the// program is the queue is empty.int QueueInt::dequeue(){int val = front();queueObj.pop(); return val;}// Returns but does not remove the integer at the front of the queue. Aborts the// program is the queue is empty.int QueueInt::front() const{if (isEmpty()) { cerr << "Tried to access empty queue --> aborting program” << endl;exit(-1);}return queueObj.front();}// Returns true if the queue is empty.bool QueueInt::isEmpty() const{return queueObj.empty();} / FILE: main.cpp// DESCRIPTION: Tests Graph class// NOTE: You are not allowed to modify this file.#include using namespace std;#include “Graph.h”int main(int argc, char *argv[]){ argv[1] = “graph0.txt”;Graph g(argv[1]);cout << endl << "Adjacency Matrix" << endl;g.display();g.displayDFS(0);g.displayBFS(0);cout << "Bipartite: "; if (g.isBipartite()) cout << "TRUE"; elsecout << "FALSE";cout << endl; return 0;} // FILE: Graph.cpp// DESCRIPTION: Implementation of the Graph class.#include #include #include #include using namespace std;#include “Graph.h”#include “QueueInt.h”#include “StackInt.h”// Constructor: load the graph from a fileGraph::Graph(char *filename){ifstream myfile;myfile.open (filename); // open file named filenameif ( myfile.is_open() ) { // check if the file is opencout<<"n"<

Writerbay.net

Do you need academic writing help? Our quality writers are here 24/7, every day of the year, ready to support you! Instantly chat with a customer support representative in the chat on the bottom right corner, send us a WhatsApp message or click either of the buttons below to submit your paper instructions to the writing team.


Order a Similar Paper Order a Different Paper
Writerbay.net