Need to transform given adjacency matrix to incidence , have func to make adj matrix , but don’t know how to transform it .
Trying to transform it to incidence by this func , but nothing work :
class Graph
{
public:
int verticles;
int edges;
int** adjMatrix;
void IncMatrix(int verticles,Graph graph)
{
int** matrix = graph.adjMatrix;
int col = 0, i, j, j_b = 0;
for (i = 0; i < verticles; i++)
for (j = 0; j < verticles; j++)
if (matrix[i][j])
col++;
col /= 2;
int** incMatrix = new int* [verticles];
for (i = 0; i < verticles; i++)
{
incMatrix[i] = new int[col];
for (j = 0; j < col; j++)
incMatrix[i][j] = 0;
}
for (i = 0; i < verticles; i++)
for (j = i + 1; j < verticles; j++)
if (matrix[i][j])
{
incMatrix[i][j_b] = 1;
incMatrix[j][j_b] = 1;
j_b++;
}
Source: Windows Questions C++