TGLib
TGLib Documentation

Introduction to 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.

GitLab Repository

Compilation and Installation

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.

Building the Python library

For compiling the PyBind11 binding and the Doxygen documentation, first clone the repository recursively to obtain the PyBind11 submodule via

git clone --recurse-submodules https://gitlab.com/tgpublic/tglib.git

Then, run the following:

cd tglib/tglib_cpp
mkdir build-release
cd build-release
cmake .. -DCMAKE_BUILD_TYPE=Release
make

After the compilation, the Python binding is in the subfolder build-release/src/python-binding.

Importing the Python library

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.

Python version

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).

Building the 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.

Quick Start

First example

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.

import pytglib as tgl
tg = tgl.load_ordered_edge_list("temporal_graph_file")
stats = tgl.get_statistics(tg)
print(stats)

The folder tglib_python contains further examples for the usage of TGLib in Python.

Temporal graph file format

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.

Implemented Data Structures and Algorithms

Data structures

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.

Algorithms and network properties

So far, we implemented the following algorithms and measures, e.g.,

C++ Documentation

The C++ code is fully documented using Doxygen. You can read the documentation online here.

Contact and Cite

Contact information can be found here.

Please cite our paper (arxiv version), and the respective papers of the methods used, if you use TGLib:

@inproceedings{oettershagen2022tglib,
title={Tglib: an open-source library for temporal graph analysis},
author={Oettershagen, Lutz and Mutzel, Petra},
booktitle={2022 IEEE International Conference on Data Mining Workshops (ICDMW)},
pages={1240--1245},
year={2022},
organization={IEEE}
}

License

TGLib is released under MIT license. See LICENSE.md for details.