No project description provided
Project description
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.
Easy Python Usage
New: TGLib is now easily installable via PyPI! You can install it using pip:
pip install temporalgraphlib
This installs the precompiled Python bindings for TGLib, allowing you to use it directly in your Python environment without building from source.
After installation, TGLib can be used in python as follows:
import pytglib as tgl
tgs = tgl.load_ordered_edge_list("example_datasets/example_from_paper.tg")
stats = tgl.get_statistics(tgs)
print(stats)
Easy C++ Usage
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.
Compilation and Installation
The following describes how to compile the python bindings.
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.,
- Temporal paths and distance algorithms: Based on
Wu et al.,
Oettershagen and Mutzel,
Gheibi et al., (and new techniques), for
- minimum duration paths
- earliest arrival paths
- latest departure paths
- shortest paths
- minimum hops paths
- Temporal centrality measures:
- temporal closeness (Oettershagen and Mutzel and new variants)
- temporal edge betweenness (new)
- temporal Katz (Béres et al.)
- temporal PageRank (Rozenshtein and Gionis)
- temproal walk centrality (Oettershagen et al.)
- Temporal graph properties:
- edge/node burstiness (Goh and Barabási)
- topological overlap (Tang et al.)
- temporal clustering coefficient (Tang et al.)
- temporal eccentricity and diameter
- temporal efficiency (Tang et al.)
- temporal (k,h)-core decomposition (Wu et al.)
- temporal (L,K)-lasting core (Hung and Tseng)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file temporalgraphlib-1.7.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: temporalgraphlib-1.7.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 437.2 kB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
493ecf65525ff197d18b32a5873f40ca9f01374f8f2aa3e9a173ee3e35cf013e
|
|
| MD5 |
c7d63af6478d512ba0a1ef9e0fa52f63
|
|
| BLAKE2b-256 |
ebb70e966ec0bec6a65f9e4d2cbe1a7cb8de2801a6e5fc99400e2aa8762ddd6c
|
File details
Details for the file temporalgraphlib-1.7.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: temporalgraphlib-1.7.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 437.3 kB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5709d6fdc42227729ef600db2b7b80721d836657dd70a5948647525ae4d6f1da
|
|
| MD5 |
adf206ee29065cd4a5ea0a9997fbb214
|
|
| BLAKE2b-256 |
086d9309d539a1a657ca2bd4af725e140ad3c0dd6dea6a9fb8e5147c30f1885c
|
File details
Details for the file temporalgraphlib-1.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: temporalgraphlib-1.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 437.3 kB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
505e91463700071bcf58f5265519486271a8014624b31b332aaf09cd9840c041
|
|
| MD5 |
059864f3eac4791c5a0e4243e87e3433
|
|
| BLAKE2b-256 |
f8b54dba5356f3eb003844c8f08a824439b93e40e97821e824570e625b38ca67
|
File details
Details for the file temporalgraphlib-1.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: temporalgraphlib-1.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 437.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8a1200afaa43db93ba88c128854fb5d7e6f9ed02eb0c77d40c754dd3178281e
|
|
| MD5 |
2b85eb05dbb293f2e7729f366ec978b9
|
|
| BLAKE2b-256 |
1231827f93e7263181b5c6219bb1eec37a574c2b6c54d97eb8f15a94c951b681
|
File details
Details for the file temporalgraphlib-1.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: temporalgraphlib-1.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 437.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f033485083beb34c596cd9965b83a1900fc7f6d4fd80ff46459afd983bb8c25
|
|
| MD5 |
a999baaf7d61605a2280bb12f2d36eae
|
|
| BLAKE2b-256 |
3f4fcf301a3c231d4fd855adebcf791507d6fa4e50b5ef7e1a3fe102b1a10919
|
File details
Details for the file temporalgraphlib-1.7.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: temporalgraphlib-1.7.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 437.9 kB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
168798962572903d81f65a9c87ca378361c90e4abee52502da339f834e5c3c2d
|
|
| MD5 |
87d28d6e7c661b4011f119b65c54880b
|
|
| BLAKE2b-256 |
648edfd7d63fea4809c5822a1674468074225b608f7bb7410aad8151100b13f2
|