Remove cycles

This commit is contained in:
Guilherme Werner
2023-06-18 12:22:04 -03:00
parent 84b9021b22
commit 345111b01e
2 changed files with 6 additions and 5 deletions

View File

@ -116,6 +116,9 @@ Graph *Graph::ToTransitiveClosure()
} }
} }
cout << "TC:" << endl;
Graph::PrintAdjacencyMatrix(closure);
return new Graph(closure, closure.size()); return new Graph(closure, closure.size());
} }

View File

@ -5,11 +5,9 @@ int main()
int nodes = 4; int nodes = 4;
Graph *g1 = new Graph(nodes); Graph *g1 = new Graph(nodes);
g1->AddEdge(0, 1); // Edge 0 g1->AddEdge(0, 1);
g1->AddEdge(0, 2); // Edge 1 g1->AddEdge(2, 0);
g1->AddEdge(1, 2); // Edge 2 g1->AddEdge(2, 3);
g1->AddEdge(2, 0); // Edge 3
g1->AddEdge(2, 3); // Edge 4
cout << "M1:" << endl; cout << "M1:" << endl;
g1->PrintIncidenceMatrix(); g1->PrintIncidenceMatrix();