Trajectory Encoding Temporal Graph Networks
摘要
Temporal Graph Networks (TGNs) have demonstrated significant success in dynamic graph tasks such as link prediction and node classification. Such tasks comprise transductive settings, where the temporal graph learning model predicts links among known nodes, and inductive settings, where it generalises learned patterns to previously unseen nodes. Existing TGN designs face a dilemma under these dual scenarios. Anonymous TGNs, which rely solely on temporal and structural information, offer strong inductive generalisation but struggle to distinguish known nodes. In contrast, non-anonymous TGNs leverage node features to excel in transductive tasks yet fail to adapt to new nodes. To address these challenges, this paper proposes Trajectory Encoding TGN (TETGN), which introduces automatically expandable node identifiers (IDs) as learnable temporal positional features and performs message passing over these IDs to capture each node’s historical context. By integrating this trajectory-aware module with a standard TGN using multi-head attention, TETGN effectively balances transductive accuracy with inductive generalisation. TETGN uses the trajectory encoding method to support anonymous inductive generalisation, and augments non-anonymous transductive prediction with extendable learnable IDs. Experimental results on three real-world datasets show that TETGN significantly outperforms strong baselines on both link prediction and node classification tasks, demonstrating its ability to unify the advantages of anonymous and non-anonymous models for dynamic graph learning (Code is available at: https://github.com/xjiaf/TETGN.git ).