Dynamic Graph Representation Learning via Graph Transformer Networks

Weilin Cong, Yanhong Wu, Yuandong Tian, Mengting Gu, Yinglong Xia, Mehrdad Mahdavi, Chun-cheng Jason Chen

TL;DR

Existing dynamic graph neural networks often struggle with noise, missing connections, and scaling bottlenecks over time. Dynamic Graph Transformer (DGT) addresses this by pairing full self-attention with spatial-temporal encodings on a unified temporal graph, scaling via a target-context sampling scheme and boosting generalization through theoretically grounded self-supervised pre-training.

What Problem Does This Paper Address?

Real-world networks—such as social networks, transaction records, and recommender systems—evolve over time. Most existing dynamic graph methods learn snapshot representations via standard Graph Neural Networks (GNNs) and aggregate them using recurrent mechanisms (e.g., RNNs) or local self-attention.

However, these approaches face two major obstacles:

  1. Sensitivity to structural noise: Message-passing over strictly local, noisy, or incomplete edges propagates errors across both time and space. Conversely, treating the graph as fully connected without structural bias makes learning intractable.
  2. Computational overhead: Processing graphs across multiple time snapshots quickly compounds memory and computational demands ($O(|V|^2 T)$).

Methods

DGT balances graph inductive biases with the flexibility of Transformers using four core components:

  • Temporal-Union Graph: Instead of independently processing each snapshot $G_1, \dots, G_T$, DGT merges all active edges into a unified graph $G_{\text{union}}$. This decouples model complexity from the sequence length $T$.
  • Spatial-Temporal Encodings as Attention Biases:
  • Temporal Connection (TC) Encoding: A learnable lookup table tracking whether an edge existed at snapshot $t$, averaged over time and projected to a scalar bias.
  • Spatial Distance (SD) Encoding: Captures relative graph positions using clipped shortest-path distance ($\min(\text{SPD}(i, j), D_{\max})$).
  • Two-Tower Target-Context Sampling: To avoid $O(|V|^2)$ full graph attention, DGT samples a target node set $V_{\text{tgt}}$ and gathers their context $V_{\text{ctx}}$ using joint Personalized PageRank (PPR). A two-tower architecture restricts attention strictly between target and context nodes, preserving local and global structure without cross-attending irrelevant nodes.
  • Information-Theoretic Pre-training: DGT optimizes two complementary self-supervised objectives before task fine-tuning:
  • Temporal Reconstruction Loss ($\mathcal{L}_{\text{recon}}$): Reconstructs snapshot $G_t$ given graphs at all other times $G \setminus G_t$, maximizing mutual information $I(Z_X; X)$.
  • Multi-View Contrastive Loss ($\mathcal{L}_{\text{view}}$): Enforces consistency (with stop-gradient) between target node representations produced by two distinct PPR-sampled context views, minimizing task-irrelevant entropy $I(Z_X; X|Y)$. The authors show via information theory that joint optimization provably tightens the upper bound on the Bayes error rate.
       [Dynamic Graph Snapshots]
                  │
                  ▼
       [Temporal-Union Graph]
                  │
       ┌──────────┴──────────┐
       ▼                     ▼
[Target-Context PPR]   [Spatial & Temporal Encodings]
       │                     │
       └──────────┬──────────┘
                  ▼
     [Two-Tower Transformer] (Cross-attention with bias)
                  │
       ┌──────────┴──────────┐
       ▼                     ▼
[Temporal Reconstruction] [Multi-view Contrastive]

Datasets

The authors evaluated DGT across five dynamic interaction benchmarks for link prediction and two for node classification:

  • Link Prediction: Enron (email communications), RDS (workplace emails), UCI (online messaging), Yelp (user-business reviews), and MovieLens ML-10M (tagging interactions).
  • Node Classification: Wikipedia (user edit actions) and Reddit (user post activities).

Key Insights and Ideas

  • Full attention acts as a structural filter: While traditional GNNs blindly trust observed edges, full attention allows DGT to attend to implicit (unconnected) node pairs while discounting spurious edges via learned attention weights.
  • Graph union does not destroy temporal order: Merging snapshots into a single static union does not lose dynamics as long as temporal edge presence is explicitly injected as self-attention biases.
  • Pre-training lowers irreducible error: Grounded in Fano- and entropy-style bounds, self-supervised reconstruction preserves task-relevant information while multi-view context invariance strips away sampling noise.

Key Results

  • Dynamic Link Prediction: DGT outperforms baselines (Node2Vec, GraphSAGE, DynAERNN, DynGEM, DySAT, EvolveGCN) by 1% to 3% Macro-AUC across all datasets (e.g., reaching 96.16% Macro-AUC on ML-10M and 88.49% on UCI).
  • Predicting Unseen/New Links: When restricted strictly to new edges appearing for the first time, DGT maintains a robust 1%–3% lead over the best baseline (e.g., 93.56% on ML-10M vs. EvolveGCN's 91.45%).
  • Noise Robustness: When 10%–50% of edges were randomly perturbed, DGT’s full attention degraded far more gracefully than 1-hop localized attention baselines.
  • Inference Scalability: Chunking self-attention into memory-bounded blocks allowed DGT to run faster with competitive memory usage (e.g., fine-tuning on ML-10M took 62.2s total, compared to 4,276s for DySAT).

Limitations and Future Work

  • Dense Graphs: DGT slightly underperformed DySAT on dense graphs (e.g., the Reddit node classification benchmark), as dense connections can introduce overwhelming spatial-temporal bias terms.
  • Discrete vs. Continuous Time: DGT operates on discrete snapshot graphs and is not natively designed for continuous-time event streams (CTDGs) with fine-grained timestamps. Extending DGT to continuous-time dynamic settings and investigating its theoretical expressive power remain open directions.

Summary updated

BibTeX
@inproceedings{cong2022dynamic,
  author = {Weilin Cong and Yanhong Wu and Yuandong Tian and Mengting Gu and Yinglong Xia and Mehrdad Mahdavi and Chun-cheng Jason Chen},
  title = {{Dynamic Graph Representation Learning via Graph Transformer Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=8rR8bIZnzMA},
}

Loading related content...

Figure