Skip to content

Commit

Permalink
update mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
shenyangHuang committed Feb 14, 2024
1 parent 943e750 commit a1f1ce3
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 151 deletions.
56 changes: 48 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
<!-- # TGB -->
![TGB logo](imgs/2023_TGX_logo.png)
<!-- # TGX -->
![TGX logo](imgs/2023_TGX_logo.png)

# Temporal Graph Analysis with TGX (WSDM 2024 Demo Track)
<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>

<!-- <a href="https://pypi.org/project/py-tgb/"><img src="https://img.shields.io/pypi/v/py-tgb.svg?color=brightgreen"></a>
<a href="https://tgb.complexdatalab.com/"><img src="https://img.shields.io/badge/website-blue"></a> -->
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)
```


Expand Down
181 changes: 56 additions & 125 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,175 +1,106 @@
# Welcome to TGX
<!-- # TGX -->
![TGX logo](2023_TGX_logo.png)

# Temporal Graph Analysis with TGX (WSDM 2024 Demo Track)
<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

### 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)
```

<!-- ### Links and Datasets
<!-- The project website can be found [here](https://tgb.complexdatalab.com/). -->

<!-- The API documentations can be found [here](https://shenyanghuang.github.io/TGB/). -->

<!-- all dataset download links can be found at [info.py](https://github.com/shenyangHuang/TGB/blob/main/tgb/utils/info.py)
TGB dataloader will also automatically download the dataset as well as the negative samples for the link property prediction datasets. -->


<!-- ### Install dependency -->
### 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

<!-- ### Instruction for tracking new documentation and running mkdocs locally
1. first run the mkdocs server locally in your terminal
```
mkdocs serve
tgx.degree_over_time(dtdg, network_name="uci")
```

2. go to the local hosted web address similar to
3. Compute novelty index
```
[14:18:13] Browser connected: http://127.0.0.1:8000/
``` -->

<!-- Example: to track documentation of a new hi.py file in tgb/edgeregression/hi.py -->


<!-- 3. create docs/api/tgb.hi.md and add the following
tgx.get_novelty(dtdg)
```
# `tgb.edgeregression`

::: tgb.edgeregression.hi
``` -->

<!-- 4. edit mkdocs.yml
```
nav:
- Overview: index.md
- About: about.md
- API:
other *.md files
- tgb.edgeregression: api/tgb.hi.md
``` -->
### 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`
<!-- ```
pip install -e py-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 .
```



<!-- ## Code blocks
`pip install tgb` -->



<!--
### Plain codeblock
A plain codeblock:
3. [alternatively] install from test-pypi

```
Some code here
def myfunction()
// some comment
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

#### Code for a specific language

Some more code with the `py` at the start:
``` py
import tensorflow as tf
def whatever()
4. [optional] install mkdocs dependencies to serve the documentation locally
```
#### With a title
``` py title="bubble_sort.py"
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
pip install mkdocs-glightbox
```

#### With line numbers
### Creating new branch ###

``` py linenums="1"
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
first create the branch on github
```
git fetch origin
#### Highlighting lines
``` py hl_lines="2 3"
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
git checkout -b test origin/test
```
## Icons and Emojs
:smile:
:fontawesome-regular-face-laugh-wink:
:fontawesome-brands-twitter:{ .twitter }
:octicons-heart-fill-24:{ .heart } -->
25 changes: 7 additions & 18 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit a1f1ce3

Please sign in to comment.