Temporal Graph Visualization with TGX
Project description
Temporal Graph Analysis with TGX
This repository contains the code for the paper "Temporal Graph Analysis with TGX" (WSDM 2024, Demo Track).
TGX overview:
- TGX supports all datasets from TGB and Poursafaei et al. 2022 as well as any custom dataset in
.csv
format. - TGX provides numerous temporal graph visualization plots and statistics out of the box.
Dependecies
TGX implementation works with python >= 3.9
and can be installed as follows.
-
Set up virtual environment (conda should work as well).
python -m venv ~/tgx_env/ source ~/tgx_env/bin/activate
-
Install external packages
pip install -r requirements.txt
-
Install local dependencies under root directory
/TGX
.pip install -e .
-
[alternatively] Install from
test-pypi
.pip install -i https://test.pypi.org/simple/ py-tgx
You can specify the version with
==
, note that the pypi version might not always be the most updated version -
[optional] Install
mkdocs
dependencies to serve the documentation locally.pip install mkdocs-glightbox
Data Loading
For detailed tutorial on how to load datasets as a tgx.Graph
, see docs/tutorials/data_loader.ipynb
.
Here are some simple examples on loading different datasets.
-
Load TGB datasets.
import tgx dataset = tgx.tgb_data("tgbl-wiki") ctdg = tgx.Graph(dataset)
-
Load built-in datasets.
dataset = tgx.builtin.uci() ctdg = tgx.Graph(dataset)
-
Load custom datasets from
.csv
.from tgx.io.read import read_csv toy_fname = "docs/tutorials/toy_data.csv" edgelist = read_csv(toy_fname, header=True,index=False, t_col=0,) tgx.Graph(edgelist=edgelist)
Visualization and Statistics
For detailed tutorial on how to generate visualizations and compute statistics for temporal graphs, see docs/tutorials/data_viz_stats.ipynb
Here are examples showing some of the TGX's functionalities.
-
Discretize the network (required for some visualization).
dataset = tgx.builtin.uci() ctdg = tgx.Graph(dataset) time_scale = "weekly" dtdg, ts_list = ctdg.discretize(time_scale=time_scale, store_unix=True)
-
Plot the number of nodes over time.
tgx.degree_over_time(dtdg, network_name="uci")
-
Compute novelty index.
tgx.get_novelty(dtdg)
Citation
If TGX is useful for your work, please consider citing it:
@article{shirzadkhani2024temporal,
title={Temporal Graph Analysis with TGX},
author={Shirzadkhani, Razieh and Huang, Shenyang and Kooshafar, Elahe and Rabbany, Reihaneh and Poursafaei, Farimah},
journal={arXiv preprint arXiv:2402.03651},
year={2024}
}
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.