forked from dacapo1142/clustering-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseparate.cpp
35 lines (31 loc) · 869 Bytes
/
separate.cpp
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
#include "clusters.hpp"
#include <chrono>
#include <fstream>
#include <iostream>
using namespace std;
using namespace std::chrono;
int main(int argc, char *argv[]) {
const char *filename = argv[1];
size_t n = atoi(argv[2]);
string ofname = string(argv[3]);
ifstream file(filename);
Clusters clusters(n, n, file, Clusters::InputFormat::TWO_COLOUMN);
file.close();
bool improve = true;
int count = 0;
while (improve) {
improve = clusters.partition_procedure(
Clusters::PartitionMethod::PARTITION_INPUT);
if (improve) {
clusters.NodeAggregate();
string name = ofname + to_string(count);
ofstream f(name.c_str());
clusters.print_communities(f);
f.close();
count++;
} else {
break;
}
}
return 0;
}