-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrderingListingSampling.cpp
More file actions
42 lines (37 loc) · 1.45 KB
/
OrderingListingSampling.cpp
File metadata and controls
42 lines (37 loc) · 1.45 KB
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
#include "OrderingListingSampling.hpp"
void OrderingListingSampling(Model &model) {
clock_t start = clock();
vector<Edge> ordering_edge;
for (auto &u: model.node_l) {
for (auto &edge: model.neighbor[u]) {
ordering_edge.push_back(edge);
}
}
sort(ordering_edge.begin(), ordering_edge.end(),
[&](const Edge &e1, const Edge &e2) {
return e1.weight > e2.weight;
});
model.DEBUG = 0;
for (int i = 0; i < 200; i++) {
// cout << i << " / " << 100 <<"\n";
OrderingMaximumButterfly(model, ordering_edge);
model.DEBUG++;
}
vector<Butterfly> candidate_butterfly_set;
for (auto &[butterfly, times]: model.result) {
candidate_butterfly_set.push_back(butterfly);
}
model.result.clear();
sort(candidate_butterfly_set.begin(), candidate_butterfly_set.end(),
[&](const Butterfly &b1, const Butterfly &b2) {
return b1.weight > b2.weight;
});
cout << "size = " << candidate_butterfly_set.size() << endl;
clock_t end = clock();
cout << "Ordering Time : " << (double) (end - start) / CLOCKS_PER_SEC << " s " << endl;
start = clock();
ProbabilityEstimation(model, candidate_butterfly_set);
// ProbabilityEstimationKarpLuby(model, candidate_butterfly_set);
end = clock();
cout << "Sampling Time : " << (double) (end - start) / CLOCKS_PER_SEC << " s " << endl;
}