-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
39,650 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# sspexp_clone | ||
Clone from http://degroup.cis.umac.mo/sspexp/, the implementation of the VLDB'17 paper An Experimental Study on Hub Labeling based Shortest Path Algorithms. | ||
sspexp | ||
--------------- | ||
Clone from http://degroup.cis.umac.mo/sspexp/ (v1.0 updated on Jan-02-2018), the implementation of the VLDB'17 paper An Experimental Study on Hub Labeling based Shortest Path Algorithms [1]. | ||
|
||
Reference | ||
--------------- | ||
[1] **An Experimental Study on Hub Labeling based Shortest Path Algorithms** | ||
*Ye Li, Leong Hou U, Man Lung Yiu, Ngai Meng Kou.* PVLDB 11(4): 445-457 (2017). [link](http://www.vldb.org/pvldb/vol11/p445-li.pdf) | ||
|
||
|
||
Changes | ||
--------------- | ||
We revise the source code to fit the double-type of distances. | ||
|
||
If any authors do not want the soure code to be cloned here, | ||
please feel free to contact Yuxiang Zeng (Email: [email protected]). | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
An Experimental Study on Hub Labeling based Shortest Path Algorithms [Experiments and Analyses] | ||
|
||
Authors: Ye Li, Leong Hou U, Man Lung Yiu, Ngai Meng Kou | ||
Contact: [email protected] | ||
Affiliation: University of Macau | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 University of Macau | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
INCLUDE = /home/yzengal/icde20/software/sparsehash/include | ||
LIB = /home/yzengal/icde20/software/sparsehash/lib | ||
CXX = g++ | ||
CXXFLAGS = -g -w -Wall -Wextra -O3 -std=c++11 -fopenmp -I $(INCLUDE) -L $(LIB) | ||
|
||
all: bin bin/sspexp_run | ||
|
||
bin/sspexp_run: main.cpp | ||
$(CXX) $(CXXFLAGS) -Isrc -o $@ $^ | ||
|
||
bin: | ||
mkdir -p bin | ||
|
||
clean: | ||
rm -rf bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Installation: | ||
make | ||
|
||
Execution: | ||
bin/sspexp_run | ||
|
||
Command Usage: | ||
(the first parameter specifies the procedure be executed) | ||
------------------------------------------------------------------- | ||
(1) -x: Indexing by different ordering schemes: | ||
sspexp_run -x -d [directedGraphFlag] -w [weightedGraphFlag] -s [specialFlag] -m [orderingSchemes] [-a [s_beta]] -g [graphFileName] -e [exportLabelFileName] | ||
------------------------------------------------------------------- | ||
(2) -q: Query testing for a label file: | ||
sspexp_run -q -d [directedGraphFlag] -s [specialFlag] [-o [orderFileName]] -l [inputLabelFileName] -n [queryNum] | ||
------------------------------------------------------------------- | ||
(3) -y: Indexing by different construction paradigms (given ordering file): | ||
sspexp_run -y -d [directedGraphFlag] -w [weightedGraphFlag] -m [consturctionParadigms] -g [graphFileName] -o [orderFileName] -e [exportLabelFileName] | ||
------------------------------------------------------------------- | ||
Parameter explanation: | ||
[directedGraphFlag]: 0 or 1, for undirected and directed graphs, default is 0 | ||
[weightedGraphFlag] = 0 or 1, for unweighted and weighted graphs, default is 0 | ||
[specialFlag] = 0: default label | ||
1: path label | ||
2: bp label | ||
3: HLC label | ||
4: HLCM label | ||
[orderingSchemes] = 0: DHP | ||
1: BHP | ||
2: SHP | ||
[s_beta]: [Optional]trade-off parameter for BHP, default is 1 | ||
[queryNum]: the number of randomly generated non-duplicated reachable queries. Extra half of queryNum will be generated for warm-up | ||
[orderFileName]: only required for path query processing | ||
[consturctionParadigms] = 0: Hub Pushing Algorithm | ||
1: Hub Pulling Algorithm | ||
------------------------------------------------------------------- | ||
Examples: | ||
Indexing SHP with BP optimization for directed unweighted graph a.txt, outputing alabel.label and alabel.order | ||
sspexp_run -x -d 1 -w 0 -s 2 -m 2 -g a.txt -e alabel | ||
Indexing Hub Pushing Algorithm given odering file alabel.order for directed unweighted graph a.txt, outputing alabel.label | ||
sspexp_run -y -d 1 -w 0 -m 0 -g a.txt -o alabel.order -e alabel | ||
Query processing for 1000000 random queries for directed path label alabel_path.label | ||
sspexp_run -q -d 1 -s 1 -l alabel_path.label -n 1000000 | ||
Query processing for 1000000 random queries for directed HLC label alabel_hlc.label with alabel_hlc.order | ||
sspexp_run -q -d 1 -s 1 -o alabel_hlc.order -l alabel_hlc.label -n 1000000 | ||
|
||
Datasets: | ||
(example unweighted graph) | ||
0 1 | ||
1 3 | ||
2 3 | ||
3 0 | ||
|
||
(example weighted graph) | ||
0 1 2 | ||
1 3 1 | ||
2 3 3 | ||
3 0 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
#ifndef _COMMAND_H | ||
#define _COMMAND_H | ||
|
||
#include <math.h> | ||
|
||
class Command { | ||
public: | ||
virtual ~Command() {}; | ||
virtual int main(int argc, char *argv[]) = 0; | ||
}; | ||
|
||
#endif // _COMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
#ifndef _COMMAND_CONSTRUCTION_PARADIGMS | ||
#define _COMMAND_CONSTRUCTION_PARADIGMS | ||
|
||
#include "../src/graph.h" | ||
#include "../src/ordering.h" | ||
#include "../src/construction.h" | ||
#include "../src/coverage_ordering.h" | ||
#include "../src/coverage_ordering_path.h" | ||
#include "../src/coverage_ordering_bp.h" | ||
#include "../src/coverage_ordering_compress.h" | ||
#include "../src/labels.h" | ||
#include "../src/time_util.h" | ||
#include "../command.h" | ||
#include<cstring> | ||
|
||
using namespace time_util; | ||
|
||
namespace command{ | ||
class ConstructionParadigms: public Command{ | ||
public: | ||
void exit_with_help(){ | ||
printf("Usage:\n"); | ||
printf("\tsspexp_run -y -d [directedGraphFlag] -w [weightedGraphFlag] -m [consturctionParadigms] -g [graphFileName] -o [orderFileName] -e [exportLabelFileName] \n"); | ||
printf("-------------------------------------------------------------------\n"); | ||
printf("Parameter explanation:\n"); | ||
printf("\t[directedGraphFlag]: 0 or 1, for undirected and directed graphs, default is 0\n"); | ||
printf("\t[weightedGraphFlag] = 0 or 1, for unweighted and weighted graphs, default is 0\n"); | ||
printf("\t[specialFlag] = 0: default label\n \t\t\t1: path label\n \t\t\t2: bp label\n \t\t\t3: HLC label\n \t\t\t4: HLCM label\n"); | ||
printf("\t[consturctionParadigms] = 0: Hub Pushing Algorithm \n \t\t\t\t1: Hub Pulling Algorithm\n"); | ||
printf("-------------------------------------------------------------------\n"); | ||
printf("Examples:\n"); | ||
printf("Indexing Hub Pushing Algorithm given odering file alabel.order for directed unweighted graph a.txt, outputing alabel.label\n"); | ||
printf("\tsspexp_run -y -d 1 -w 0 -m 0 -g a.txt -o alabel.order -e alabel \n"); | ||
printf("-------------------------------------------------------------------\n"); | ||
exit(1); | ||
} | ||
int main(int argc, char *argv[]) | ||
{ | ||
char graphFileName[255] = ""; | ||
char labelFileName[255] = ""; | ||
char orderFileName[255] = ""; | ||
int t_directed_flag = 0; | ||
int t_weighted_flag = 0; | ||
int t_construction_flag = 0; | ||
double beta = 1; | ||
DIRECTED_FLAG = false; | ||
WEIGHTED_FLAG = false; | ||
|
||
if(argc < 14) | ||
exit_with_help(); | ||
|
||
for(int i = 2; i < argc; i++){ | ||
if(argv[i][0] != '-') break; | ||
if(++i >= argc) | ||
exit_with_help(); | ||
switch (argv[i-1][1]){ | ||
case 'g': | ||
strcpy(graphFileName,argv[i]); | ||
break; | ||
case 'o': | ||
strcpy(orderFileName,argv[i]); | ||
break; | ||
case 'd': | ||
t_directed_flag = atoi(argv[i]); | ||
break; | ||
case 'w': | ||
t_weighted_flag = atoi(argv[i]); | ||
break; | ||
case 'm': | ||
t_construction_flag = atoi(argv[i]); | ||
break; | ||
case 'e': | ||
strcpy(labelFileName, argv[i]); | ||
break; | ||
default: | ||
exit_with_help(); | ||
} | ||
} | ||
|
||
if (t_directed_flag == 1) | ||
DIRECTED_FLAG = true; | ||
if (t_weighted_flag == 1) | ||
WEIGHTED_FLAG = true; | ||
|
||
if(t_directed_flag != 1 && t_directed_flag != 0) | ||
exit_with_help(); | ||
if(t_weighted_flag != 1 && t_weighted_flag != 0) | ||
exit_with_help(); | ||
if(t_construction_flag <0 || t_construction_flag > 2) | ||
exit_with_help(); | ||
|
||
Graph graph; | ||
WGraph wgraph; | ||
CHGraph chgraph; | ||
if(t_construction_flag == 0){ | ||
if(WEIGHTED_FLAG == true){ | ||
wgraph.load_graph(graphFileName); | ||
}else{ | ||
graph.load_graph(graphFileName); | ||
} | ||
}else if (t_construction_flag == 1){ | ||
if(WEIGHTED_FLAG == true){ | ||
chgraph.load_wgraph(argv[1]); | ||
}else{ | ||
chgraph.load_graph(argv[1]); | ||
} | ||
} | ||
cout << numOfVertices << " nodes and " << numOfEdges << " arcs " << endl; | ||
|
||
if (numOfVertices == 0 || numOfEdges == 0){ | ||
cout << "Corruptted graph file" << endl; | ||
return 0; | ||
} | ||
|
||
// Indexing | ||
if (DIRECTED_FLAG == true){ | ||
if( WEIGHTED_FLAG == true){ | ||
if(t_construction_flag == 0){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName, wgraph); | ||
PL_W pl_w(wgraph, given_order, DIRECTED_FLAG); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
pl_w.dlabels.save_labels(labelFile.c_str()); | ||
return 0; | ||
}else if (t_construction_flag == 1){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName); | ||
double _contracting_time = 0; | ||
Bottomup bu(chgraph, given_order, _contracting_time); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
cout << "Contracting time:" << _contracting_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
bu.dlabels.save_labels(labelFile.c_str()); | ||
return 0; | ||
} | ||
}else{ | ||
if(t_construction_flag == 0){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName, graph); | ||
PL pl(graph, given_order, DIRECTED_FLAG); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
pl.dlabels.save_labels(labelFile.c_str()); | ||
return 0; | ||
}else if (t_construction_flag == 1){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName); | ||
double _contracting_time = 0; | ||
Bottomup bu(chgraph, given_order, _contracting_time); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
cout << "Contracting time:" << _contracting_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
bu.dlabels.save_labels(labelFile.c_str()); | ||
return 0; | ||
} | ||
} | ||
}else{ | ||
if( WEIGHTED_FLAG == true){ | ||
if(t_construction_flag == 0){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName, wgraph); | ||
PL_W pl_w(wgraph, given_order); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
pl_w.labels.save_labels(labelFile.c_str()); | ||
return 0; | ||
}else if (t_construction_flag == 1){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName); | ||
double _contracting_time = 0; | ||
Bottomup bu(chgraph, given_order, _contracting_time); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
cout << "Contracting time:" << _contracting_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
bu.labels.save_labels(labelFile.c_str()); | ||
return 0; | ||
} | ||
}else{ | ||
if(t_construction_flag == 0){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName, graph); | ||
PL pl(graph, given_order); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
pl.labels.save_labels(labelFile.c_str()); | ||
return 0; | ||
}else if (t_construction_flag == 1){ | ||
double _labeling_time = GetCurrentTimeSec(); | ||
Given_Ordering given_order(orderFileName); | ||
double _contracting_time = 0; | ||
Bottomup bu(chgraph, given_order, _contracting_time); | ||
_labeling_time = GetCurrentTimeSec() - _labeling_time; | ||
cout << "Indexing time:" << _labeling_time << endl; | ||
cout << "Contracting time:" << _contracting_time << endl; | ||
|
||
string labelFile(labelFileName); | ||
labelFile.append(".label"); | ||
bu.labels.save_labels(labelFile.c_str()); | ||
return 0; | ||
} | ||
} | ||
} | ||
|
||
} | ||
}; | ||
} | ||
#endif | ||
|
Oops, something went wrong.