Author: Patrick Steil
This repository implements a hub labeling algorithm for efficient reachability queries on directed acyclic graphs (DAGs).
The events per stop form a natural chain decomposition that is later used for the PPL algorithm.
This involves computing hub labels for both forward (outgoing) and backward (incoming) reachability queries on the DAG.
To build the project, run the provided compile.sh script:
./compile.shAlternatively, to build only the release version:
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
makeThe project supports two build configurations:
- Release: Optimized for performance.
- Debug: Includes debug symbols and error checks.
To build and run the release versions:
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
./PPL -hThe output file contains hub labels for all vertices in the graph. Each vertex has exactly two lines:
oline – outgoing hubs (forward labels).iline – incoming hubs (backward labels).
- First line contains
Vfollowed by the number of vertices. - Outgoing Hubs (
oline)- Starts with
o. - Followed by the vertex ID.
- Followed by pairs of (path id, path position)
- Example:
o 0 1 3→ Vertex0has outgoing hubs path id1and path position3.
- Starts with
- Incoming Hubs (
iline)- Starts with
i. - Followed by the vertex ID.
- Followed by pairs of (path id, path position)
- Example:
i 0 2 4→ Vertex0has incoming hubs path id2and path position4.
- Starts with
- Each vertex contributes exactly two lines to the file (
oandi). - The total number of lines is
2 × number of vertices + 1.
Here is an example of running the PPL algorithm on a graph read from a DIMACS file:
./PPL -b -i ../datasets/swiss_te.dimacs -p ../datasets/swiss_paths.txt -c -sExample Output:
Reading graph from dimacs ... done [4203ms]
Graph Statistics:
Number of vertices: 5860345
Number of edges: 12713790
Min degree: 0
Max degree: 30
Average degree: 2.16946
Number of isolated vertices: 1503
Build and sort edges topologically ... done [1612ms]
Compute Path Stats ... Path Statistics:
Total Paths: 29045
Min Length: 1
Max Length: 5020
Average Length: 201.768
done [1ms]
Computing Iterative Centrality ... done [106904ms]
Computing Path Labels ... done [42412ms]
Compute Label Stats ... Forward Labels Statistics:
Min Size: 1
Max Size: 79
Avg Size: 32.4293
Backward Labels Statistics:
Min Size: 1
Max Size: 79
Avg Size: 32.0704
FWD # count: 190046825
BWD # count: 187943558
Both # count: 377990383
Total memory consumption [megabytes]:
1799.61
done [278ms]
100000 queries: total 3.83034e+07 ns, avg 383.034 ns/query, counter=36558
Loading labels into DeltaFlatBuffer ... done [4194ms]
FWD Memory: 593.572 MB
BWD Memory: 587.39 MB
Total Memory: 1180.96 MB
100000 queries: total 4.57595e+07 ns, avg 457.595 ns/query, counter=36558The Pruned Path Labeling algorithm is based on: