diff --git a/README.md b/README.md index 89ca48b..ed7dc7a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ - -![TGB logo](imgs/2023_TGX_logo.png) + +![TGX logo](imgs/2023_TGX_logo.png) # Temporal Graph Analysis with TGX (WSDM 2024 Demo Track)

@@ -7,15 +7,55 @@

- +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 -### Example Usage ### -TGX provides many built in datasets as well as supporting TGB datasets. In addition, TGX provides dataset discretization and visualization. -To get started, see our [starting example](https://github.com/ComplexData-MILA/TGX/blob/master/starting_example.py) +### 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) +``` + +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) +``` + +### 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) + +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 + +``` +tgx.degree_over_time(dtdg, network_name="uci") +``` + +3. Compute novelty index ``` -python starting_example.py -d tgbl-wiki -t daily +tgx.get_novelty(dtdg) ``` diff --git a/docs/index.md b/docs/index.md index f0a452f..db941f5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,175 +1,106 @@ -# Welcome to TGX + +![TGX logo](2023_TGX_logo.png) +# Temporal Graph Analysis with TGX (WSDM 2024 Demo Track) +

+ + +

+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 -### Pip Install -You can install TGX via [pip](https://pypi.org/project/py-tgb/) +### 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 ``` -pip install py-tgx +import tgx +dataset = tgx.tgb_data("tgbl-wiki") +ctdg = tgx.Graph(dataset) ``` - - - - - - - - -### 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) +2. Load built-in datasets ``` -python -m venv ~/tgx_env/ -source ~/tgx_env/bin/activate +dataset = tgx.builtin.uci() +ctdg = tgx.Graph(dataset) ``` -2. install external packages +3. Load custom datasets from `.csv` ``` -pip install -r requirements.txt +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`](https://github.com/ComplexData-MILA/TGX/blob/master/docs/tutorials/data_viz_stats.ipynb) +1. Discretize the network (required for viz) -3. install local dependencies under root directory `/TGX` ``` -pip install -e py-tgx +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 - - - - - - - +### Install dependency +Our implementation works with python >= 3.9 and can be installed as follows -### Creating new branch ### +1. set up virtual environment (conda should work as well) ``` -git fetch origin - -git checkout -b test origin/test +python -m venv ~/tgx_env/ +source ~/tgx_env/bin/activate ``` -### dependencies for mkdocs (documentation) +2. install external packages ``` -pip install mkdocs -pip install mkdocs-material -pip install mkdocstrings-python -pip install mkdocs-jupyter -pip install notebook -pip install mkdocs-glightbox +pip install -r requirements.txt ``` - -### full dependency list -Our implementation works with python >= 3.9 and has the following dependencies +3. install local dependencies under root directory `/TGX` + ``` -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 -tgb==0.9.0 +pip install -e . ``` - - - - - \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 6fe62b9..c8ab89a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: TGX +site_name: Temporal Graph Analysis with TGX site_url: https://shenyanghuang.github.io/TGX nav: - Home: index.md @@ -62,21 +62,15 @@ nav: theme: name: material features: + - navigation.tabs + - toc.integrate - navigation.footer - navigation.indexes - # - navigation.instant - # - navigation.instant.prefetch - # - navigation.instant.progress - # - navigation.prune - navigation.sections - - navigation.tabs - navigation.top - navigation.tracking - navigation.tabs.sticky - # - navigation.sections - navigation.expand - # - toc.integrate - # - navigation.top - search.suggest - search.highlight - content.tabs.link @@ -94,11 +88,13 @@ theme: toggle: icon: material/toggle-switch name: Switch to light mode - primary: orange + primary: blue accent: lime plugins: + - search + - glightbox: touchNavigation: true loop: false @@ -131,16 +127,9 @@ plugins: - mkdocs-jupyter: execute: false -# handlers: -# python: -# paths: [.] + markdown_extensions: - pymdownx.arithmatex: generic: true - attr_list - md_in_html - -# extra_javascript: -# - javascripts/mathjax.js -# - https://polyfill.io/v3/polyfill.min.js?features=es6 -# - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js \ No newline at end of file