mirror of
https://github.com/guilhermewerner/paa
synced 2025-06-16 05:24:18 +00:00
Remove cycles
This commit is contained in:
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
Reference in New Issue
Block a user