-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCycleRootFinder.h
116 lines (84 loc) · 3.85 KB
/
CycleRootFinder.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// Created by Rohit on 04-Sep-17.
//
#ifndef CYCLEDETECTION_CYCLEROOTFINDER_H
#define CYCLEDETECTION_CYCLEROOTFINDER_H
#include <string>
#include <fstream>
#include "DetectCycle.h"
#include "bloom_filter.hpp"
struct tnode {
std::string vertex;
long time;
bool operator==(const tnode &rhs) const {
if ((vertex.compare(rhs.vertex) == 0 & time == rhs.time)) {
return true;
} else {
false;
}
}
bool operator<(const tnode &rhs) const {
if (time == rhs.time) {
return vertex < rhs.vertex;
} else
return time < rhs.time;
}
};
struct cycle_time {
int start_time;
int end_time;
bool operator==(const cycle_time &rhs) const {
if ((start_time == rhs.start_time & end_time == rhs.end_time)) {
return true;
} else {
false;
}
}
bool operator<(const cycle_time &rhs) const {
if (start_time == rhs.start_time) {
return end_time < rhs.end_time;
} else
return start_time < rhs.start_time;
}
};
int findRootNodesNew(std::string input, std::string output, int window, int cleanUpLimit, bool reverseEdge);
set<int> getCandidatesNew(map<int, int> *summary, int t_s, int t_e);
int cleanupNew(std::map<int, map<int, int>> *completeSummary, int timestamp, int window_bracket, bool forward);
set<int> getCandidates(std::map<int, int> *summary, int t_s, int t_e);
vector<string>
updateSummaries(map<int, map<int, set<int>>> *completeSummary, int timestamp,
int window_bracket, int src, int dst);
int
cleanup(map<int, bloom_filter> *completeSummary, map<int, int> *node_update_time, int timestamp, int window_bracket);
int findRootNodesApprox(std::string input, std::string output, int window, int cleanUpLimit, bool reverseEdge);
set<approxCandidatesNew>
findRootNodesApproxBothDirectionWithSerialization(std::string input, std::string output, int window, int cleanUpLimit,
bool reverseEdge,std::string tempFolder);
int findCandidateFromApprox(std::string input, string root_file, std::string output, int window, int cleanUpLimit,
bool reverseEdge);
pair<int, pair<int, int>>
updateSummary(int src, int dst, int timestamp, int window_bracket, map<int, bloom_filter> *summary,
bloom_parameters parameters, map<int, int> *update_time);
void mergeSummaries(map<int, set<int>> *summary, exactCandidates *ac, int start_time);
pair<int,pair<int, int>>
updateSummaryExact(int src, int dst, int timestamp, int window_bracket, map<int, set<int>> *summary,
map<int, int> *update_time);
set<approxCandidatesNew>
findRootNodesApproxBothDirectionNew(std::string input, std::string output, int window, int cleanUpLimit,
bool reverseEdge,int projected_element_count);
set<exactCandidates>
compressRootCandidates(map<int, map<cycle_time, map<int, set<int>>>> *root_candidates,
int window_bracket);
set<exactCandidates>
findRootNodesExactBothDirection(std::string input, std::string output, int window, int cleanUpLimit,
bool reverseEdge);
void print(map<int, map<cycle_time, map<int, set<int>>>> root_candidate_exact);
void print(set<exactCandidates> final_roots);
int cleanup(map<int, set<int>> *completeSummary, map<int, int> *node_update_time, int timestamp, int window_bracket);
string combineSeeds(std::string root_file, int window);
set<approxCandidatesNew>
compressRootCandidatesNew(map<int, map<cycle_time, map<int, bloom_filter>>> *root_candidates,
int window_bracket);
void printCandidates(set<approxCandidatesNew> final_roots,string path);
set<approxCandidatesNew> filterRoots(set<approxCandidatesNew> final_roots, string root_file);
#endif //CYCLEDETECTION_CYCLEROOTFINDER_H