-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
176 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,125 @@ | ||
<!-- # TGX --> | ||
![TGX logo](imgs/2023_TGX_logo.png) | ||
|
||
# Temporal Graph Analysis with TGX (WSDM 2024 Demo Track) | ||
# Temporal Graph Analysis with TGX | ||
<h4> | ||
<a href="https://arxiv.org/abs/2402.03651"><img src="https://img.shields.io/badge/arXiv-pdf-yellowgreen"></a> | ||
<a href="https://complexdata-mila.github.io/TGX/"><img src="https://img.shields.io/badge/docs-orange"></a> | ||
</h4> | ||
|
||
TGX supports all datasets from [TGB](https://tgb.complexdatalab.com/) and [Poursafaei et al. 2022](https://openreview.net/forum?id=1GVpwr2Tfdg) as well as any custom dataset in `.csv` format. | ||
TGX provides numerous temporal graph visualization plots and statistics out of the box | ||
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](https://tgb.complexdatalab.com/) and [Poursafaei et al. 2022](https://openreview.net/forum?id=1GVpwr2Tfdg) as well as any custom dataset in `.csv` format. | ||
- TGX provides numerous temporal graph visualization plots and statistics out of the box. | ||
|
||
### Data Loading ### | ||
For detailed tutorial on how to load the datasets into `tgx.Graph`, see [`docs/tutorials/data_loader.ipynb`](https://github.com/ComplexData-MILA/TGX/blob/master/docs/tutorials/data_loader.ipynb) | ||
|
||
1. Load TGB datasets | ||
``` | ||
import tgx | ||
dataset = tgx.tgb_data("tgbl-wiki") | ||
ctdg = tgx.Graph(dataset) | ||
``` | ||
## Dependecies | ||
TGX implementation works with `python >= 3.9` and can be installed as follows. | ||
|
||
2. Load built-in datasets | ||
``` | ||
dataset = tgx.builtin.uci() | ||
ctdg = tgx.Graph(dataset) | ||
``` | ||
1. Set up virtual environment (conda should work as well). | ||
``` | ||
python -m venv ~/tgx_env/ | ||
source ~/tgx_env/bin/activate | ||
``` | ||
|
||
3. 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) | ||
``` | ||
2. Install external packages | ||
``` | ||
pip install -r requirements.txt | ||
``` | ||
|
||
### Visualization and Statistics ### | ||
For detailed tutorial on how to generate visualizations and compute statistics for temporal graphs, see [`docs/tutorials/data_viz_stats.ipynb`](https://github.com/ComplexData-MILA/TGX/blob/master/docs/tutorials/data_viz_stats.ipynb) | ||
3. Install local dependencies under root directory `/TGX`. | ||
<!-- ``` | ||
pip install -e py-tgx | ||
``` --> | ||
``` | ||
pip install -e . | ||
``` | ||
|
||
1. Discretize the network (required for viz) | ||
|
||
``` | ||
dataset = tgx.builtin.uci() | ||
ctdg = tgx.Graph(dataset) | ||
time_scale = "weekly" | ||
dtdg, ts_list = ctdg.discretize(time_scale=time_scale, store_unix=True) | ||
``` | ||
|
||
2. Plot the number of nodes over time | ||
4. [alternatively] Install from `test-pypi`. | ||
|
||
``` | ||
tgx.degree_over_time(dtdg, network_name="uci") | ||
``` | ||
``` | ||
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 | ||
|
||
3. Compute novelty index | ||
``` | ||
tgx.get_novelty(dtdg) | ||
``` | ||
|
||
5. [optional] Install `mkdocs` dependencies to serve the documentation locally. | ||
``` | ||
pip install mkdocs-glightbox | ||
``` | ||
|
||
### Install dependency | ||
Our implementation works with python >= 3.9 and can be installed as follows | ||
|
||
1. set up virtual environment (conda should work as well) | ||
``` | ||
python -m venv ~/tgx_env/ | ||
source ~/tgx_env/bin/activate | ||
``` | ||
|
||
2. install external packages | ||
``` | ||
pip install -r requirements.txt | ||
``` | ||
## Data Loading | ||
For detailed tutorial on how to load datasets as a `tgx.Graph`, see [`docs/tutorials/data_loader.ipynb`](https://github.com/ComplexData-MILA/TGX/blob/master/docs/tutorials/data_loader.ipynb). | ||
Here are some simple examples on loading different datasets. | ||
|
||
3. install local dependencies under root directory `/TGX` | ||
<!-- ``` | ||
pip install -e py-tgx | ||
``` --> | ||
``` | ||
pip install -e . | ||
``` | ||
1. Load TGB datasets. | ||
``` | ||
import tgx | ||
dataset = tgx.tgb_data("tgbl-wiki") | ||
ctdg = tgx.Graph(dataset) | ||
``` | ||
|
||
2. Load built-in datasets. | ||
``` | ||
dataset = tgx.builtin.uci() | ||
ctdg = tgx.Graph(dataset) | ||
``` | ||
|
||
3. 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) | ||
``` | ||
|
||
3. [alternatively] install from test-pypi | ||
## Visualization and Statistics | ||
For detailed tutorial on how to generate visualizations and compute statistics for temporal graphs, see [`docs/tutorials/data_viz_stats.ipynb`](https://github.com/ComplexData-MILA/TGX/blob/master/docs/tutorials/data_viz_stats.ipynb) | ||
Here are examples showing some of the TGX's functionalities. | ||
|
||
``` | ||
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 | ||
1. **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) | ||
``` | ||
|
||
2. Plot the **number of nodes over time**. | ||
|
||
4. [optional] install mkdocs dependencies to serve the documentation locally | ||
``` | ||
pip install mkdocs-glightbox | ||
``` | ||
``` | ||
tgx.degree_over_time(dtdg, network_name="uci") | ||
``` | ||
|
||
3. Compute **novelty** index. | ||
``` | ||
tgx.get_novelty(dtdg) | ||
``` | ||
|
||
### Creating new branch ### | ||
|
||
<!-- | ||
### Creating new branch | ||
first create the branch on github | ||
``` | ||
git fetch origin | ||
git checkout -b test origin/test | ||
``` | ||
``` --> | ||
|
||
|
||
### Citation | ||
If TGX is useful for your work, please consider citing it: | ||
```bibtex | ||
@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} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,63 @@ | ||
matplotlib>=3.8.0 | ||
pandas>=2.1.1 | ||
numpy>=1.26.0 | ||
seaborn>=0.13.0 | ||
tqdm>=4.66.1 | ||
scikit-learn>=1.3.1 | ||
py-tgb>=0.9.0 | ||
appdirs==1.4.4 | ||
args==0.1.0 | ||
certifi==2022.12.7 | ||
charset_normalizer==3.1.0 | ||
click==8.1.7 | ||
clint==0.5.1 | ||
contourpy==1.0.7 | ||
cycler==0.11.0 | ||
Cython==3.0.8 | ||
decorator==4.4.2 | ||
distlib==0.3.1 | ||
docker-pycreds==0.4.0 | ||
filelock==3.0.12 | ||
fonttools==4.41.0 | ||
geoopt==0.5.1 | ||
gitdb==4.0.11 | ||
GitPython==3.1.41 | ||
idna==3.4 | ||
importlib_resources==6.0.0 | ||
Jinja2==3.1.2 | ||
joblib==1.3.1 | ||
kiwisolver==1.4.4 | ||
MarkupSafe==2.1.2 | ||
matplotlib==3.7.0 | ||
more-itertools==8.7.0 | ||
mpmath==1.3.0 | ||
networkx==3.1 | ||
numpy==1.24.2 | ||
packaging==23.1 | ||
pandas==1.5.3 | ||
Pillow==9.5.0 | ||
protobuf==4.25.2 | ||
psutil==5.9.4 | ||
py-tgb==0.9.2 | ||
-e git+ssh://[email protected]/ComplexData-MILA/TGX.git@bf47a2946ef35c5f96ba8cbe9c3e397d39c5e58e#egg=py_tgx | ||
pyparsing==3.0.9 | ||
python-dateutil==2.8.2 | ||
pytz==2023.3 | ||
PyYAML==6.0.1 | ||
requests==2.28.2 | ||
scikit_learn==1.3.0 | ||
scipy==1.10.1 | ||
seaborn==0.13.2 | ||
sentry-sdk==1.40.3 | ||
setproctitle==1.3.2 | ||
setuptools-scm==6.0.1 | ||
six==1.16.0 | ||
sklearn==0.0 | ||
smmap==5.0.1 | ||
sympy==1.12 | ||
threadpoolctl==3.2.0 | ||
torch==2.0.1 | ||
torch-geometric-temporal==0.54.0 | ||
torch_geometric==2.3.1 | ||
torch_scatter==2.1.1 | ||
torch_sparse==0.6.17 | ||
tqdm==4.65.0 | ||
typing_extensions==4.7.1 | ||
tzdata==2023.3 | ||
urllib3==1.26.15 | ||
virtualenv==20.0.18 | ||
wandb==0.16.3 | ||
zipp==3.15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,29 @@ def readme(): | |
|
||
setup( | ||
name="py-tgx", | ||
version="0.2.2", | ||
description="Temporal graph", | ||
long_description=readme(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/fpour/tgx", | ||
author="Razieh Shirzadkhani", | ||
author_email="[email protected]", | ||
keywords="Temporal Graph visualization", | ||
version="0.3.0", | ||
description="Temporal Graph Visualization with TGX", | ||
url="https://github.com/ComplexData-MILA/TGX", | ||
keywords="Temporal Graph Visualization", | ||
license="MIT", | ||
packages=find_packages(), | ||
install_requires=[], | ||
include_package_data=True, | ||
install_requires=[ | ||
'appdirs==1.4.4', | ||
'networkx==3.1', | ||
'numpy==1.24.2', | ||
'pandas==1.5.3', | ||
'py-tgb==0.9.2', | ||
'requests==2.28.2', | ||
'scikit_learn==1.3.0', | ||
'scipy==1.10.1', | ||
'seaborn==0.13.2', | ||
'sklearn==0.0', | ||
'torch==2.0.1', | ||
'torch-geometric-temporal==0.54.0', | ||
'torch_geometric==2.3.1', | ||
'torch_scatter==2.1.1', | ||
'torch_sparse==0.6.17', | ||
'tqdm==4.65.0', | ||
'wandb==0.16.3', | ||
], | ||
) |