first commit

This commit is contained in:
2025-11-02 21:46:02 +08:00
commit 17ba627f72
5 changed files with 358 additions and 0 deletions

31
main.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include <iostream>
#include "HyperGraph.hpp"
int main() {
HyperGraph g;
// v0~v7
for (int i{0}; i <= 7; ++i) {
g.add_vertex(i);
}
// e0: v1, v2
g.add_edge({1, 2}, 0);
// e1: v2, v6
g.add_edge({2, 6}, 1);
// e2: v0, v2, v4, v7
g.add_edge({0, 2, 4, 7}, 2);
// e3: v0, v3, v5, v7
g.add_edge({0, 3, 5, 7}, 3);
auto res = g.PR();
double total = 0;
for (const auto &val: res) {
total += val;
std::cout << val << " ";
}
std::cout << "\nTotal: " << total << std::endl;
auto chg = CompressedHyperGraph<int, int>::from_hypergraph(g);
return 0;
}