-
Notifications
You must be signed in to change notification settings - Fork 5
/
mainPLL.cpp
97 lines (81 loc) · 2.9 KB
/
mainPLL.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
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
/*
* CHupd.cpp
*
* Created on: 22 Dec 2020
* Author: zhangmengxuan
*/
#include "head.h"
int main(){
std::chrono::high_resolution_clock::time_point t1, t2;
std::chrono::duration<double> time_span;
double runT;
string DesFile="./data/";
vector<pair<pair<int,int>,int>> Testdata;
Graph g;
//read graph
string destiGraph=DesFile+"Graphsw10k5";
string orderfile=DesFile+"Order";
string PLLfile=DesFile+"PLL";
string PLLpointfile=DesFile+"PLLPoint";
g.ReadGraph(destiGraph);
//index construction
g.StartPLL(PLLfile, PLLpointfile, orderfile);
g.CorCheckPLL();
//index contruction without write & read
/*t1=std::chrono::high_resolution_clock::now();
g.PLLcon(orderfile);//not read & write index
t2=std::chrono::high_resolution_clock::now();
time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2-t1);
runT= time_span.count();
cout<<"PLL construction time "<<runT<<endl;*/
//index size & efficiency
string ODfile=DesFile+"OD";
g.PLLindexsize();
g.PrunePointsize();
g.EffiCheckPLL(ODfile);
//index update
string updateFile=DesFile+"Update";
vector<pair<pair<int,int>,int>> testdata;
g.ReadIns(updateFile, testdata);
//PLL-p decrease
Graph g1=g;
t1=std::chrono::high_resolution_clock::now();
for(int k=0;k<testdata.size();k++){
g1.PSLdec(testdata[k].first.first, testdata[k].first.second, testdata[k].second, testdata[k].second*0.5);
}
t2=std::chrono::high_resolution_clock::now();
time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2-t1);
runT= time_span.count();
cout<<"PLL-p decrease "<<runT<<" "<<runT/testdata.size()<<endl;
//PLL-p increase
Graph g2=g;
t1=std::chrono::high_resolution_clock::now();
for(int k=0;k<testdata.size();k++){
g2.PSLinc(testdata[k].first.first, testdata[k].first.second, testdata[k].second, testdata[k].second*1.5);
}
t2=std::chrono::high_resolution_clock::now();
time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2-t1);
runT= time_span.count();
cout<<"PLL-p increase "<<runT<<" "<<runT/testdata.size()<<endl;
//PLL-s decrease
Graph g3=g;
t1=std::chrono::high_resolution_clock::now();
for(int k=0;k<testdata.size();k++){
g3.PLLdec(testdata[k].first.first, testdata[k].first.second, testdata[k].second, testdata[k].second*0.5);
}
t2=std::chrono::high_resolution_clock::now();
time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2-t1);
runT= time_span.count();
cout<<"PLL-s decrease "<<runT<<" "<<runT/testdata.size()<<endl;
//PLL-s increase
Graph g4=g;
t1=std::chrono::high_resolution_clock::now();
for(int k=0;k<testdata.size();k++){
g4.PLLinc(testdata[k].first.first, testdata[k].first.second, testdata[k].second, testdata[k].second*1.5);
}
t2=std::chrono::high_resolution_clock::now();
time_span = std::chrono::duration_cast<std::chrono::duration<double>>(t2-t1);
runT= time_span.count();
cout<<"PLL-s increase "<<runT<<" "<<runT/testdata.size()<<endl;
return 0;
}