# Homework Solution: CUsers eleel Desktop Test Debugl TestLee.exe Before inserting edges into the adjacecy matrix: 4 0 [01 0101 G1 01 1 [0101 01 01 01 2 [01 0101 G1 01…

Given the following driver file, implement the adjacency matrix functions to print out the following adjacency matrix graphs: #include <iostream> using namespace std; struct Edge { int start, end; }; const int N = 5; class AdjMat { int Vcnt, Ecnt; int adj[N][N]; bool digraph; public: AdjMat(int, bool); //constructor – all values in the adjacency matrix are zero // and undirected graph void insert(Edge); //insert edge void remove(Edge); //remove edge bool edge(int, int); //check whether the edge is in the graph bool const directed(); //check whether the graph is directed void showGraph(); //print adjacent matrix int V() const; //number of vertices int E() const; //number of edges bool directed() const; //check whether digraph }; int main() { int countEdges, countNodes; AdjMat mat(N, 0); Edge e1, e2, e3, e4, e5, e6, e7; //implement all edges cout << "Before inserting edges into the adjacecy matrix: " << endl; mat.showGraph(); countNodes = mat.V(); countEdges = mat.E(); cout << "There are " << countNodes << " vertices in the graph. " << endl; cout << "There are " << countEdges << " edges in the graph. " << endl; cout << endl; mat.insert(e1); mat.insert(e2); mat.insert(e3); mat.insert(e4); mat.insert(e5); mat.insert(e6); mat.insert(e7); cout << "After inserting edges into the adjacecy matrix: " << endl; mat.showGraph(); countNodes = mat.V(); countEdges = mat.E(); cout << "There are " << countNodes << " vertices in the graph. " << endl; cout << "There are " << countEdges << " edges in the graph. " << endl; cout << endl; mat.remove(e2); mat.remove(e3); cout << "After removing edges into the adjacecy matrix: " << endl; mat.showGraph(); countNodes = mat.V(); countEdges = mat.E(); cout << "There are " << countNodes << " vertices in the graph. " << endl; cout << "There are " << countEdges << " edges in the graph. " << endl; cout << endl; system("pause"); return 0; } The output should look as follows: I need the source code for the implementation of this program. Please and thank you.
CUsers eleel Desktop Test Debugl TestLee.exe Before inserting edges into the adjacecy matrix: 4 0 [01 0101 G1 01 1 [0101 01 01 01 2 [01 0101 G1 01 3 [0101 01 01 01 4 01 0101 G1 01 There are 5 ertices in the graph. There are edges in the graph- After inserting edges into the adjacecy matrix: 4 0 [01 11 01 01 [11 1 1 01 L1 1 L11 2 001 11 01 1 [01 3 01 11 L1 1 L11 4 1 1 01 1 01 There are 5 ertices in the graph. There are edges in the graph. After removing edges into the adjacecy matrix: 4 0 [01 11 01 01 [01 1 1 01 01 1 L11 2 001 1 01 1 [01 3 01 11 L1 1 L11 4 01 1 01 1 01 There are 5 ertices in the graph. There are 5 eges in the graph. Press any key to continue .. .

Given the subjoined driver refine, instrument the adjacency entraprix functions to imimprint quenched the subjoined adjacency entraprix graphs:

#include <iostream>

using namespace std;

struct Behalf

{

int initiate, end;

};

const int N = 5;

{

int Vcnt, Ecnt;

bool digraph;

public:

AdjMat(int, bool); //constructor – perfect values in the adjacency entraprix are zero

// and undirected graph

void implant(Edge); //implant behalf

void migrate(Edge); //migrate behalf

bool behalf(int, int); //check whether the behalf is in the graph

bool const directed(); //check whether the graph is directed

void showGraph(); //imprint nigh entraprix

int V() const; //number of vertices

int E() const; //number of behalfs

bool directed() const; //check whether digraph

};

int ocean()

{

int countEdges, countNodes;

Behalf e1, e2, e3, e4, e5, e6, e7;

//instrument perfect behalfs

cquenched << “Before implanting behalfs into the adjacecy entraprix: ” << endl;

mat.showGraph();

countNodes = entrap.V();

countEdges = entrap.E();

cquenched << “There are ” << countNodes << ” vertices in the graph. ” << endl;

cquenched << “There are ” << countEdges << ” behalfs in the graph. ” << endl;

cquenched << endl;

mat.insert(e1);

mat.insert(e2);

mat.insert(e3);

mat.insert(e4);

mat.insert(e5);

mat.insert(e6);

mat.insert(e7);

cquenched << “After implanting behalfs into the adjacecy entraprix: ” << endl;

mat.showGraph();

countNodes = entrap.V();

countEdges = entrap.E();

cquenched << “There are ” << countNodes << ” vertices in the graph. ” << endl;

cquenched << “There are ” << countEdges << ” behalfs in the graph. ” << endl;

cquenched << endl;

mat.remove(e2);

mat.remove(e3);

cquenched << “After removing behalfs into the adjacecy entraprix: ” << endl;

mat.showGraph();

countNodes = entrap.V();

countEdges = entrap.E();

cquenched << “There are ” << countNodes << ” vertices in the graph. ” << endl;

cquenched << “There are ” << countEdges << ” behalfs in the graph. ” << endl;

cquenched << endl;

system(“pause”);

return 0;

}

The quenchedput should face as follows: I scarcity the origin enactment coercion the instrumentation of this program. Please and cheer you.

CUsers eleel Desktop Test Debugl TestLee.exe Before implanting behalfs into the adjacecy entraprix: 4 0 [01 0101 G1 01 1 [0101 01 01 01 2 [01 0101 G1 01 3 [0101 01 01 01 4 01 0101 G1 01 There are 5 ertices in the graph. There are behalfs in the graph- After implanting behalfs into the adjacecy entraprix: 4 0 [01 11 01 01 [11 1 1 01 L1 1 L11 2 001 11 01 1 [01 3 01 11 L1 1 L11 4 1 1 01 1 01 There are 5 ertices in the graph. There are behalfs in the graph. After removing behalfs into the adjacecy entraprix: 4 0 [01 11 01 01 [01 1 1 01 01 1 L11 2 001 1 01 1 [01 3 01 11 L1 1 L11 4 01 1 01 1 01 There are 5 ertices in the graph. There are 5 eges in the graph. Press any solution to abide .. .

{

int i,j;

for(i=0;i<a;i++)

{

for(j=0;j<a;j++)

}

digraph = val;

Vcnt = N;

Ecnt = 0;

}

{

int i,j,k=0,l=0;

for(i=0;i<N;i++)

{

if(i==0)

{

while(k<5)

{

cout<<” “;

cout<<k;

k++;

}

cout<<endl;

}

for(int j=0;j<N;j++)

{

if(j==0)

{

cout<<l<<” “;

l++;

}

/* cout<<“N=”<<N<<endl;

cout<<“j=”<<j<<endl;

cout<<“pass”<<endl;*/

}

//cout<<“pass2″<<endl;

cout<<endl;

}

}

{

int p = e1.start;

int q = e1.end;

Ecnt++;

}

{

int p = e1.start;

int q = e1.end;

Ecnt–;

}

{

return Vcnt;

}

{

return Ecnt;

}