Readme for /directed
===========================
The code is an implementation of the hop-doubling algorithm for directed graphs in the following VLDB 2014 paper:
Hop Doubling Label Indexing for Point-to-Point Distance Querying on Scale-Free Networks. 

Usage:

(1) Machine:
The code is tested in Ubuntu Linux envionment with g++ complier. The default setting is to use 4GB memory, but you can also change it in the file "ioD.h". For example, setting the memory usage to 1GB can be done by changing the following line in "inD.h" from 
const long long memSize = 4LL * 1024 * 1024 * 1024 ;
to
const long long memSize = 1LL * 1024 * 1024 * 1024 ;

(2) Input file format:
Our input file is in text format. For a directed graph G=(V,E), there are |E|+1 lines in the input file. The first line is a number |V|. In the following |E| lines, each line contain 3 numbers, i.e. u v d, corresponding to an edge from vertex u to v with length d. We assume each vertex is an integer in [0, |V|-1], and each length is a small integer. One example is the file "exampleD.txt".

(3) Indexing: 
g++ ioD.h labelD.cpp -O3 && ./a.out inputFileName
For example, to index the file "exampleD.txt", we should use
g++ ioD.h labelD.cpp -O3 && ./a.out exampleD.txt

Some inforamtion about the indexing process can be found in the screen, e.g. indexing time, index size, # of iterations. One example is as follows:
"
exampleD.txt
iteration 1 begin
iteration 2 begin
iteration 3 begin
iteration 4 begin
iteration 5 begin
iteration 6 begin
iteration 7 begin
index begin
indexSize 61545755 64.764873 MB
tRun 5.424204 (sec)
"
After indexing, 3 files are generated as 2-hop index for querying, i.e. inputFileName.labelin, inputFileName.labelout, inputFileName.deg.

(4) External(disk-based) querying:
g++ ioD.h queryDE.cpp -O3 && ./a.out inputFileName
For example, to query the file "exampleD.txt", we should use
g++ ioD.h queryDE.cpp -O3 && ./a.out exampleD.txt

Some inforamtion about the querying process can be found in the screen, e.g. index loading time, average query time. One example is as follows,
"
load time 4.914000 (ms)
265214 vertices
average query time 6.888348 (ms)
"
Please remember to clear cache before running disk-based querying. One possible way is as follows.
sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

(5) Internal(memory-based) querying:
g++ ioD.h queryDI.cpp -O3 && ./a.out inputFileName
For example, to query the file "exampleD.txt", we should use
g++ ioD.h queryDI.cpp -O3 && ./a.out exampleD.txt

Some inforamtion about the querying process can be found in the screen, e.g. index loading time, average query time. One example is as follows,
"
265214 vertices
load time 469.094000 (ms)
average query time 0.000193 (ms)
"

