-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (41 loc) · 739 Bytes
/
main.cpp
File metadata and controls
46 lines (41 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cassert>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;
#include "adjacency.h"
ifstream fin("hypergraph.in");
HyperGraph read_input() {
HyperGraph hg;
fin >> hg.n >> hg.m;
string line;
getline(fin,line);
for (int i=0;i<hg.m;i++) {
getline(fin,line);
stringstream ss(line);
Vect edge;
int tok;
while (ss >> tok) {
edge.push_back(tok);
}
hg.edges.push_back(edge);
}
return hg;
}
Vect2 naive(HyperGraph &hg) {
Vect2 a = Vect2(hg.n, Vect(hg.n));
for (Vect &edge : hg.edges) {
for (int x : edge) {
for (int y : edge) {
a[x][y]=1;
}
}
}
return a;
}
int main() {
HyperGraph hg = read_input();
hg.adjacency_matrix();
assert(hg.adj==naive(hg));
return 0;
}