This project implements two variants of Temporal Graph Network (TGN) architectures for community detection and link prediction in dynamic graphs. The implementation is based on the original TGN paper from Twitter Research: Temporal Graph Networks for Deep Learning on Dynamic Graphs.
The project provides:
- Standard TGN Model: Complete implementation of the original TGN architecture with configurable temporal attention mechanisms.
- Decay TGN Model: Enhanced TGN with decay-based temporal attention that models how the importance of historical interactions decreases over time.
- Comparative Analysis: Framework for comparing the performance of both models on community detection and link prediction tasks.
- Graph Visualization: Comprehensive visualization capabilities to analyze temporal evolution of communities and network structures.
-
Clone the repository:
git clone https://github.com/mohak34/CommDec-DBTA cd CommunityDetection -
Install dependencies:
pip install -r requirements.txt
The main implementation is available in src/enhanced_tgn.py. This file contains the complete implementation of the standard Temporal Graph Network with the Reddit dataset.
The enhanced Decay TGN model with temporal attention decay is implemented in src/decay_tgn.py. This model includes:
- Configurable decay factors for temporal attention
- Memory modules with decay-based temporal attention
- Adaptive decay mechanisms for learning temporal patterns
To compare both models:
- Use the standard TGN implementation in
notebooks/Enhanced_TGN.ipynb - Use the Decay TGN implementation with different decay factors via
src/decay_tgn.py - Run experiments with various decay factors to analyze their impact on performance
The standard TGN implementation includes:
- Temporal attention mechanisms for modeling dynamic graph interactions
- Memory modules for storing and updating node states over time
- Message passing and aggregation for community detection
- Link prediction capabilities
The Decay TGN model extends the standard TGN with:
- Configurable decay factors for temporal attention weights
- Adaptive decay mechanisms that learn optimal decay rates
- Enhanced memory modules with temporal decay consideration
- Comprehensive decay analysis and visualization tools
Both models can be evaluated on:
- Community Detection: Identifying clusters of related nodes in temporal graphs
- Link Prediction: Predicting future connections between nodes
- Temporal Pattern Analysis: Understanding how relationships evolve over time
The project uses the Reddit Hyperlinks dataset, which represents connections between subreddit communities. Each edge represents a hyperlink from one subreddit to another, with timestamps indicating when the hyperlink was created.