Table of Contents
Fetching ...

Trajectory Encoding Temporal Graph Networks

Jiafeng Xiong, Rizos Sakellariou

TL;DR

Trajectory Encoding TGN (TETGN) tackles the dual transductive-inductive challenge in dynamic graphs by introducing automatically extendable node IDs as temporal positional features and a trajectory encoding module that runs in parallel with a standard MP-TGN encoder. A two-stream architecture processes trajectory and normal message-passing information, storing outputs in memory and fusing them with multi-head attention to produce final node embeddings. Empirical results on three real-world datasets and two masked variants show that TETGN consistently surpasses both anonymous and non-anonymous baselines for temporal link prediction and node classification, while maintaining scalable complexity with a constant-factor overhead $O(2L(\bar{n}+d)d|E|)$. These findings demonstrate a practical pathway to unify inductive generalisation and transductive accuracy in dynamic graphs, with robust performance under feature masking and unseen nodes.

Abstract

Temporal Graph Networks (TGNs) have demonstrated significant success in dynamic graph tasks such as link prediction and node classification. Both tasks comprise transductive settings, where the model predicts links among known nodes, and in 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 this challenge, we propose Trajectory Encoding TGN (TETGN). Our approach 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. 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.

Trajectory Encoding Temporal Graph Networks

TL;DR

Trajectory Encoding TGN (TETGN) tackles the dual transductive-inductive challenge in dynamic graphs by introducing automatically extendable node IDs as temporal positional features and a trajectory encoding module that runs in parallel with a standard MP-TGN encoder. A two-stream architecture processes trajectory and normal message-passing information, storing outputs in memory and fusing them with multi-head attention to produce final node embeddings. Empirical results on three real-world datasets and two masked variants show that TETGN consistently surpasses both anonymous and non-anonymous baselines for temporal link prediction and node classification, while maintaining scalable complexity with a constant-factor overhead . These findings demonstrate a practical pathway to unify inductive generalisation and transductive accuracy in dynamic graphs, with robust performance under feature masking and unseen nodes.

Abstract

Temporal Graph Networks (TGNs) have demonstrated significant success in dynamic graph tasks such as link prediction and node classification. Both tasks comprise transductive settings, where the model predicts links among known nodes, and in 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 this challenge, we propose Trajectory Encoding TGN (TETGN). Our approach 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. 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.

Paper Structure

This paper contains 31 sections, 15 equations, 5 figures, 4 tables.

Figures (5)

  • Figure 1: An illustrative example of symmetric and cyclic structures in temporal graphs. The left graph shows a temporal graph where nodes $2$ and $4$ exhibit structural symmetry and are part of a cycle. The right panels display their corresponding temporal computation trees (TCTs), which are isomorphic.
  • Figure 2: Overview of TETGN architecture. The framework consists of two main components: (a) An encoding phase (top) where temporal interactions (i.e., edges $(1\rightarrow2, 2\rightarrow3)$) are processed through parallel streams - a trajectory message encoding (TE msg) that processes node trajectories and a TGN message encoder that handles standard message passing - with outputs processed through parallel aggregators (TE AGG and TGN AGG) and stored in memory (TE Update and TGN Update); (b) A decoding phase (bottom) where historical node states and trajectory encodings from memory are fused through multi-head attention embedding (TGN emb) to produce the final node embeddings for downstream tasks. Here, $s_i(t_k)$ represents node states in memory, $v_i(t_k)$ and $v'_i(t_k)$ denote raw and aggregated trajectory encodings respectively, $m_i(t_k)$ and $m'_i(t_k)$ represent raw and aggregated messages, and $z_i(t_k)$ denotes the final node embeddings used for downstream tasks.
  • Figure 3: Hyper-parameter analysis on $\alpha$ and $\beta$.
  • Figure 4: Hyper-parameter analysis with effective $\alpha = 2$.
  • Figure 5: Hyper-parameter analysis with ineffective $\alpha = 1$