Official code for the paper:
When Speed meets Accuracy: an Efficient and Effective Graph Model for Temporal Link Prediction
Required packages and versions:
matplotlib==3.8.4networkx==3.3numba==0.60.0numpy==1.26.4ogb==1.3.6pandas==1.5.3pyg-lib==0.4.0+pt20cu118scikit-learn==1.5.2scipy==1.13.1torch==2.0.1+cu118torch_geometric==2.5.3
We can install the required dependencies with:
pip install -r requirements.txtWe conducted experiments on the Contacts, LastFM, Wikipedia, Reddit, AskUbuntu, SuperUser, and Wiki-Talk datasets.
The raw dataset files can be obtained from the following link:
Please place them under ./data/ before running codes.
Note: For our experimental setup, we generated 99 negative samples for each sample in the test set. For details on data processing, please refer to our code.
We conducted experiments on the Trade, Genre, Reddit, and Token datasets, using the raw dataset files and splits provided by TGB Datasets.
To install the TGB dependency, run:
pip install py-tgbWe recommend using the TGB's interface, which includes downloading and standardized splitting.
For further details, please consult the TGB documentation.
To run EAGLE-Structure, use the following command:
cd link_prediction
python train_structure.py --dataset_name wikipedia --topk 100 --alpha 0.9 --beta 0.8 --gpu 0The optimal parameters are as follows:
| Dataset | topk |
|
|
|---|---|---|---|
| Contacts | 100 | 0.3 | 0.3 |
| LastFM | 100 | 0.9 | 0.2 |
| Wikipedia | 100 | 0.9 | 0.8 |
| 100 | 0.9 | 0.9 | |
| AskUbuntu | 50 | 0.3 | 0.5 |
| SuperUser | 50 | 0.2 | 0.5 |
| WikiTalk | 100 | 0.5 | 0.5 |
To run EAGLE-Time, use the following command:
cd link_prediction
python train_time.py --dataset_name wikipedia --topk 15 --lr 0.001 --weight_decay 5e-5 --gpu 0The optimal parameters are as follows:
| Dataset | top-kr in Equation (6) | learning_rate | weight_decay |
|---|---|---|---|
| Contacts | 30 | 0.0001 | 5e-05 |
| lastfm | 20 | 0.0001 | 5e-05 |
| wikipedia | 15 | 0.001 | 5e-05 |
| 50 | 0.001 | 0.0 | |
| askubuntu | 30 | 0.0001 | 0.0 |
| superuser | 30 | 0.0001 | 0.0 |
| wikitalk | 30 | 0.001 | 0.0 |
To run EAGLE-Hybrid, use the following command:
cd link_prediction
python train_hybrid.py --dataset_name wikipedia --gpu 0Note: EAGLE-Hybrid is a weighted combination of EAGLE-Structure and EAGLE-Time. You need to first run structure module and time module with their optimal parameters listed above before training EAGLE-Hybrid.
To run EAGLE, use the following command:
cd node_classification
python train.py --dataset_name tgbn-trade --k 50 --tppr_alpha 0.6 --tppr_beta 0.9 --gamma 0.9 --window 4 --gpu 0The optimal parameters are as follows:
| Dataset | topk |
|
|
self_weight |
window_size |
|---|---|---|---|---|---|
| tgbn-trade | 50 | 0.6 | 0.9 | 0.9 | 4 |
| tgbn-genre | 20 | 0.1 | 0.1 | 0.1 | 7 |
| tgbn-reddit | 20 | 0.1 | 0.1 | 0.1 | 6 |
| tgbn-token | 20 | 0.1 | 0.1 | 0.1 | 5 |
❤️ Thank you for your interest in our work! ❤️