-
Notifications
You must be signed in to change notification settings - Fork 2
/
PathTree.h
65 lines (53 loc) · 1.69 KB
/
PathTree.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
#ifndef _PATH_TREE_H
#define _PATH_TREE_H
#include "GraphUtil.h"
#include "DWGraphUtil.h"
#include "DataComp.h"
// test switch
#define _TEST_
class PathTree {
public:
Graph& g;
DWGraph pg;
Graph ng; // equivalent weight graph
DWGraph branch;
Graph newbranch;
int maxeid;
vector<int> nextVertex;
// vector<set<int> > out_uncover;
vector<vector<int> > out_uncover;
map<int,vector<int> > comp_table;
vector<vector<int> > pathMap;
vector<int> grts; // graph reverse topological sort
int** labels;
bool effective;
map<pair<int,int>, bool> tcm; // for test
struct timeval after_time, before_time;
float run_time;
public:
PathTree(Graph& graph);
PathTree(Graph& graph, vector<int> ts);
~PathTree();
void buildWeightPathGraph(int type);
void buildWeightPathGraph_Pred(); // update weight by pred size
void buildEquGraph();
void createLabels(int type, ifstream& cfile, bool compress);
void displayLabels();
// void pathDFS(int vid, int& order, int& first_order);
void pathDFS(int vid, int& order, int& first_order, vector<bool>& visited);
void transform(DWGraph dg, Graph& graph);
void readPathMap(ifstream& cfile);
void compute_tcm();
bool reach(int src, int trg);
bool reach_dc(int src, int trg);
bool test_reach(int src, int trg);
bool test_reach_dc(int src, int trg);
void index_size(int* ind_size);
void insertSet(set<int>& s1, set<int>& s2);
void mergeVector(vector<int>& v1, vector<int>& v2);
void buildEquEdgeset(map<int,set<int> >& pathtopo, Graph& equgraph);
double cover_ratio();
double compress_ratio();
void save_labels(ofstream& labels_file);
};
#endif