TGLib
|
TGLib is an open-source temporal graph library focusing on temporal distance and centrality computations, and other local and global temporal graph statistics.
TGLib is designed for performance and usability by an efficient and modular C++ implementation of the core data structures and algorithms and an easy-to-use Python front-end provided by PyBind11.
The C++ part of TGLib is a header-only template library that can be directly used in other C++ projects by including the headers in your project.
For compiling the PyBind11 binding and the Doxygen documentation, first clone the repository recursively to obtain the PyBind11 submodule via
Then, run the following:
After the compilation, the Python binding is in the subfolder build-release/src/python-binding
.
Running the above commands will produce a binary module file that can be imported to Python. Assuming that the compiled module is located in the current directory, TGLib can be imported in Python with import pytglib as tgl
.
Note that the CMake will try to automatically detect the installed Python version and link against that. You can specify a version by adding -DPYTHON_EXECUTABLE=$(which python)
when calling cmake
, where $(which python) a path to Python (see PyBind11 documentation).
In order to additionally generate the C++ documentation, call make doxygen
. The documentation can be found in the subfolder build-release/html
. Note that you need Doxygen for generating the documentation.
The following Python code loads a temporal graph from the file with name temporal_graph_file
and computes basic network statistics by calling get_statistics
. The results is printed using the print
command.
The folder tglib_python
contains further examples for the usage of TGLib in Python.
Temporal graphs can be read from text files that contain edge lists in which each line represents the information of the edge. Each edge can consists of three or four values: u v t
or u v t tt
where u
is the tail, v
the head, t
the time stamp (availability time), and tt
an optional transition time.
The folder example_datasets
contains examples.
TGLib supports the temporal edge stream data structure from Wu et al., the incident lists data structure used in Oettershagen and Mutzel, and the time-respecting static graph representation introduced in Gheibi et al.. Furthermore, TGLib supports further static graph representations, e.g., the weighted aggregated underlying graph or directed line graph representation.
So far, we implemented the following algorithms and measures, e.g.,
The C++ code is fully documented using Doxygen. You can read the documentation online here.
Contact information can be found here.
Please cite our paper (arxiv version), and the respective papers of the methods used, if you use TGLib:
TGLib is released under MIT license. See LICENSE.md for details.