Update italiano::remove

This commit is contained in:
stefiosif
2022-09-16 15:17:50 +03:00
parent 037560949d
commit 0b16ebc677
3 changed files with 80 additions and 41 deletions

View File

@@ -4,6 +4,7 @@
#include "algorithm/decremental_scc.h"
#include "algorithm/italiano.h"
#include "algorithm/frigioni.h"
#include "algorithm/tarjan.h"
#include <fstream>
@@ -12,9 +13,22 @@ using namespace graph;
TEST_SUITE("Decremental algorithms") {
TEST_CASE("Decremental maintenance of SCCs 1") {
std::ifstream infile("resources/data.txt");
std::ifstream infile("resources/dag.txt");
std::uint16_t u, v;
Digraph<std::uint16_t> G;
//while (infile >> u >> v) {}
while (infile >> u >> v)
G.insert(u, v);
auto SCCs = algo::Tarjan<std::uint16_t>(G.adjMatrix).execute();
// Testing whether an scc is a 1-vertex scc which after the normalization
// has no edges, in this case we know tgat there exist no 2-vertex sccs
for (auto& scc : SCCs) {
CHECK_EQ(std::all_of(scc.adjMatrix.begin(), scc.adjMatrix.end(),
[](const auto& p) {
return p.second.size() == 0;
}), true);
}
}
}