Add Floyd Warshall Algorithm

This commit is contained in:
Guilherme Werner
2023-06-10 16:16:49 -03:00
parent ee21a62ef6
commit 948198a69b
3 changed files with 69 additions and 18 deletions

View File

@ -2,27 +2,17 @@
int main()
{
int length = 9;
int length = 4;
Graph *g1 = new Graph(length);
g1->Insert(0, 1);
g1->Insert(0, 3);
g1->Insert(0, 4);
g1->Insert(1, 2);
g1->Insert(1, 3);
g1->Insert(1, 4);
g1->Insert(2, 3);
g1->Insert(2, 4);
g1->Insert(2, 5);
g1->Insert(3, 5);
g1->Insert(4, 5);
g1->Insert(5, 6);
g1->Insert(6, 7);
g1->Insert(6, 8);
g1->Insert(7, 8);
g1->InsertD(0, 1);
g1->InsertD(0, 2);
g1->InsertD(1, 2);
g1->InsertD(2, 0);
g1->InsertD(2, 3);
cout << "-- GRAFO --\n\n";
g1->Print();
cout << "-- TRANSITIVE CLOSURE --\n\n";
g1->TransitiveClosure();
return 0;
}