Static vs Dynamic Graphs: When Structure Changes Over Time

6 minute read

Published:

TL;DR: A static graph has fixed topology throughout learning. A dynamic graph changes over time: edges form and dissolve, nodes arrive and depart, features drift. Dynamic graphs come in two forms — discrete-time (snapshots) and continuous-time (event streams). Each requires different modelling assumptions.
Dynamic graph evolution
Continuous-time dynamic graph: event stream processed by TGN (Rossi et al., 2020)
Key Insight: A static GNN is like a map printed once — it is accurate at print time but goes stale the moment a new road opens. A dynamic graph model is like a live navigation app — it ingests new events continuously and always reflects the current state. The choice between snapshot (DTDG) and event-stream (CTDG) models is really a question of how finely you need to track time: daily snapshots suffice for monthly patterns, but millisecond transactions demand continuous-time treatment.

Why Graphs Change Over Time

Real-world networks are never truly static:

  • Social networks: friendships form and fade, users join and leave
  • Financial networks: transactions occur at specific timestamps
  • Traffic networks: road states change with congestion, incidents
  • Citation networks: papers get cited over years; authors leave academia
  • Protein interactions: binding/unbinding events, cell-state-dependent interactions

A static GNN trained once on a snapshot cannot predict future edges or adapt to structural shifts. Dynamic graph learning is the framework for handling this.

Taxonomy of Dynamic Graphs

Discrete-Time Dynamic Graphs (DTDG)

The graph is observed as a sequence of snapshots:

\[ \mathcal{G} = \{G_1, G_2, \dots, G_T\}, \qquad G_t = (V_t, E_t, X_t) \]

Each snapshot \(G_t\) is a full graph at time \(t\), with its own node set \(V_t\), edge set \(E_t\) and feature matrix \(X_t\). Between snapshots, changes are not tracked — only the state at each observation.

Modelling approach: run a GNN on each snapshot, then apply a temporal model (RNN/Transformer) across snapshots to capture evolution.

Examples:

  • Monthly snapshots of a social network
  • Daily transaction graphs in finance
  • Hourly traffic sensor graphs

Limitation: if events happen between snapshots, they are invisible. Finer snapshots increase resolution but increase computation.

Continuous-Time Dynamic Graphs (CTDG)

The graph is a stream of timestamped events:

\[ \mathcal{E} = \big\{ (u_i, v_i, t_i, f_i) \big\}_{i=1}^{N}, \qquad t_1 \le t_2 \le \dots \le t_N \]

Each event is an interaction between \(u_i\) and \(v_i\) occurring at time \(t_i\) with optional features \(f_i\). Nodes may also have state updates at specific times.

Modelling approach: maintain a memory state for each node, updated upon each interaction. Compute node embeddings on demand for any time \(t\) — using only events with timestamp \(\le t\), never later ones.

Examples:

  • Reddit posts (user posts to subreddit at timestamp)
  • Wikipedia edits (user edits page at timestamp)
  • E-commerce interactions (user clicks product at time)

Advantage over snapshots: exact timing information preserved; computation triggered by events (sparse updates).

Key Challenges

1. Evolving Structure

New edges and nodes arrive continuously. The model must incorporate new information without full retraining:

  • Transductive: all nodes known at training time
  • Inductive: new nodes appear at test time (requires generalising to unseen entities)

2. Temporal Dependencies

Events at time \(t\) may depend on events at \(t - k\) (historical context). Capturing long-range temporal dependencies while maintaining efficient updates is the core challenge.

4. Causality

Every prediction about time \(t\) must be computed from events strictly in the past. Shuffling an event stream before splitting into train and test — as one would for i.i.d. data — leaks future edges into the past and inflates results. Dynamic-graph splits are always chronological.

3. Forgetting and Recency

Not all past events are equally relevant. A social interaction from 3 years ago matters less than one from last week. Models must balance memory capacity with relevance weighting.

The memory bottleneck: Naive CTDG models replay all past events to compute current node states — \(O(\lvert \text{history} \rvert)\) per query. TGN and similar architectures solve this with fixed-size memory modules that summarise history efficiently, analogous to how LSTMs summarise sequence history in a fixed hidden state.

Visualising DTDG vs CTDG

DTDG: Discrete Snapshots G₁ G₂ G₃ gap: events lost t=1 t=2 t=3 CTDG: Event Stream t=1.2 t=1.7 t=3.1 t=3.9 t=5.5 t=6.2 edge add edge remove Exact timestamps — no information lost
DTDG (left) collapses events between snapshots into a single state — fine for monthly data, but events between snapshots vanish. CTDG (right) records every event with its exact timestamp, preserving full temporal resolution at the cost of more complex modelling.

DTDG vs CTDG: Practical Trade-offs

PropertyDTDG (Snapshots)CTDG (Event Stream)
Temporal resolutionCoarse (snapshot intervals)Fine (exact timestamps)
Modelling complexityGNN + sequence modelEvent-driven memory
ComputationPer snapshot (batched)Per event (online)
Handles new nodesRetrain or fine-tuneNaturally inductive
Memory of historyImplicit in sequence modelExplicit memory module
Use casesRegular-interval dataIrregular event data

Standard Benchmarks

CTDG benchmarks:

  • Wikipedia: 9227 nodes, 157474 interaction events
  • Reddit: 10984 nodes, 672447 interaction events
  • MOOC: student-course interactions with timestamps
  • LastFM: user-song interactions (music streaming)

DTDG benchmarks:

  • Bitcoin-OTC / Bitcoin-Alpha: trust ratings over time
  • DBLP co-authorship: yearly snapshots
  • Yelp reviews: monthly snapshots

Summary

ConceptDefinition
Static graphFixed \((V, E, X)\) — standard GNN setting
Snapshot graphSeries \(G_1, \dots, G_T\) of static graphs
Event streamOrdered sequence of timestamped interactions
InductiveGeneralises to nodes not seen during training
Memory moduleFixed-size state capturing interaction history

Dynamic graph learning adds the temporal dimension to all GNN tasks: link prediction becomes “will \(u\) and \(v\) interact after time \(t\)?”, node classification becomes “what is \(v\)’s state at time \(t\)?”, and graph-level tasks must account for structural evolution. Whatever the task, the model may only look at events with timestamp \(\le t\). TGN is the most widely used CTDG framework and the usual first baseline.

References