Question #15389

#include<iostream>

#include<stdlib.h>

using namespace std;

class Graph {

private:

bool** adjacencyMatrix;

int vertexCount;

public:

Graph(int vertexCount) {

this->vertexCount = vertexCount;

adjacencyMatrix = new bool*[vertexCount];

for (int i = 0; i < vertexCount; i++) {

adjacencyMatrix[i] = new bool[vertexCount];

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

adjacencyMatrix[i][j] = false;

}

}

void addEdge(int i, int j) {

if (i >= 0 && i < vertexCount && j >= 0 && j < vertexCount) {

adjacencyMatrix[i][j] = true;

// adjacencyMatrix[j][i] = true;

}

}

void removeEdge(int i, int j) {

if (i >= 0 && i < vertexCount && j >= 0 && j < vertexCount) {

adjacencyMatrix[i][j] = false;

// adjacencyMatrix[j][i] = false;

}

#include<stdlib.h>

using namespace std;

class Graph {

private:

bool** adjacencyMatrix;

int vertexCount;

public:

Graph(int vertexCount) {

this->vertexCount = vertexCount;

adjacencyMatrix = new bool*[vertexCount];

for (int i = 0; i < vertexCount; i++) {

adjacencyMatrix[i] = new bool[vertexCount];

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

adjacencyMatrix[i][j] = false;

}

}

void addEdge(int i, int j) {

if (i >= 0 && i < vertexCount && j >= 0 && j < vertexCount) {

adjacencyMatrix[i][j] = true;

// adjacencyMatrix[j][i] = true;

}

}

void removeEdge(int i, int j) {

if (i >= 0 && i < vertexCount && j >= 0 && j < vertexCount) {

adjacencyMatrix[i][j] = false;

// adjacencyMatrix[j][i] = false;

}

Expert's answer

Dear visitor

Unfortunately, the statement of your question is a bit confusing.

What do you need to be done? Please, give us the details so we could help you

Unfortunately, the statement of your question is a bit confusing.

What do you need to be done? Please, give us the details so we could help you

Learn more about our help with Assignments: C++

## Comments

## Leave a comment