Question: / / main . cpp #include GraphM.h #include #include using namespace std; int main ( ) { int v = 0 ; int temp
maincpp
#include "GraphM.h
#include
#include
using namespace std;
int main
int v ;
int temp ;
fstream input;
input.openoriginalmatrix.txt;
Gets number of vertices in the test file
while input temp
v;
input.close;
Sqrt of v items in a row of the matrix number of vertices
GraphM graph new GraphMintsqrtv;
int mark new intintsqrtv;
MST
int start ;
cout "Begin MST starting at Vertex endl endl;
graphread;
Primgraph mark, start;
graphwrite;
graphPrint;
cout "End of MST endl endl;
MST
graphInitsqrtv;
for int i ; i sqrtv; i
marki INFINITE;
start ;
markstart;
cout "Begin MST starting at Vertex endl endl;
graphread;
Primgraph mark, start;
graphwrite;
graphPrint;
cout "End of MST endl endl;
MST
graphInitsqrtv;
for int i ; i sqrtv; i
marki INFINITE;
start ;
markstart;
cout "Begin MST starting at Vertex endl endl;
graphread;
Primgraph mark, start;
graphwrite;
graphPrint;
cout "End of MST endl endl;
delete graph;
delete mark;
systempause;
return ;
Graphh
#ifndef GRAPHH
#define GRAPHH
class Graph
private:
void operator const Graph&
Graphconst Graph&
public:
Graph Default constructor
virtual ~Graph Base destructor
Initialize a graph of n vertices
virtual void Initint n;
Return: the number of vertices and edges
virtual int NumVertices;
virtual int NumEdges;
Return vs first neighbor
virtual int firstint v;
Return vs next neighbor
virtual int nextint v int w;
Set the weight for an edge
virtual void setEdgeint v int v int wght;
Delete an edge
virtual void deleteEdgeint v int v;
Determine if an edge is in the graph
virtual bool isEdgeint i int j;
Return an edges weight
virtual int weightint v int v;
Get and Set the mark value for a vertex
virtual int getMarkint v;
virtual void setMarkint v int val;
Used in Prim's Algorithm
virtual void AddEdgetoMSTint v int v;
;
#endif GRAPHH
GraphMh
#ifndef GRAPHMH
#define GRAPHMH
#include "book.h
#include "Graph.h
#include
#include
using namespace std;
class GraphM : public Graph
private:
int numVertex, numEdge;
int matrix;
int mark;
public:
GraphMint numVert
InitnumVert;
~GraphM
delete mark;
for int i; i "Illegal weight value";
if matrixvv
numEdge;
matrixvv wt;
void deleteEdgeint v int v
if matrixvv
numEdge;
matrixvv;
bool isEdgeint i int j
return matrixij;
int weightint v int v
return matrixvv;
int getMarkint v
return markv;
void setMarkint v int val
markv val;
void read
I am going to keep asking this question untill it is solve completely. Everytime it is not completely solved I will downvote. Do not think about answering unless you are going to give complete answer. The last couple people got downvoted because they didnt give me any useful code they gave instructions that are completely useless. READ THE INSTRUCTION I HAVE PROVIDED IN THE SCREENSHOT ATTATCHED. I PAY MONEY TO GET ANSWERS not for useless instructions I already get from the textbook.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
