A dynamic graph neural network, also called a temporal graph neural network, is a neural model that learns representations of graphs whose nodes, edges or features change over time, combining message passing over structure with a mechanism that models temporal evolution. In graph learning, it extends static graph neural networks to settings such as transaction networks, social interactions and traffic systems, where when an edge appears matters as much as whether it exists.
Typical tasks include future link prediction, dynamic node classification and event-time prediction. The field divides into two families: models that process the graph as a sequence of snapshots and models that consume a continuous stream of timestamped events.
How a dynamic graph neural network models change
A dynamic graph neural network keeps two kinds of information: structural context from neighboring nodes and temporal context from the history of each node. Every update combines both, so a node embedding reflects who a node interacts with and how recently and how often.
Three components recur across most architectures. A graph encoder aggregates neighbor information, a temporal module carries state forward or attends over past events, and a time encoding turns raw timestamps or time gaps into vectors the network can use.
| Component | Role | Typical implementation |
|---|---|---|
| Graph encoder | Aggregates information from neighbors | GCN, graph attention or GraphSAGE layers |
| Temporal module | Carries information across time | GRU, LSTM, self-attention or memory |
| Time encoding | Represents time gaps numerically | Learnable sinusoidal functions |
| Node memory | Stores a compressed history per node | State vector updated after each event |
| Decoder | Produces task outputs | MLP scoring node pairs or classes |
The key difficulty is respecting causality: an embedding used to predict an event at time t may only use information from events strictly before t. Violating this rule leaks future information and produces misleadingly high scores.
Discrete-time and continuous-time approaches
The two main families differ in how they represent time. Discrete-time dynamic graphs aggregate events into snapshots, such as one graph per day, while continuous-time dynamic graphs treat each interaction as a timestamped event.
| Aspect | Discrete-time models | Continuous-time models |
|---|---|---|
| Input | Ordered sequence of graph snapshots | Stream of timestamped edges |
| Time resolution | Fixed by snapshot interval | Exact event times |
| Example models | EvolveGCN, DySAT, T-GCN, GCRN | TGN, TGAT, JODIE, DyRep, DyGFormer |
| Strength | Simple batching, efficient on GPUs | Captures fine-grained ordering |
| Weakness | Loses ordering within a snapshot | Harder to parallelize |
| Typical domain | Traffic sensors, periodic reports | Transactions, messaging, clicks |
Within discrete-time models, some apply a static GNN per snapshot followed by a recurrent network, while EvolveGCN instead evolves the GNN weights with a recurrent unit. Continuous-time models such as Temporal Graph Networks (TGN) maintain a memory vector per node that is updated whenever the node takes part in an event.
Relation to other graph learning methods
Dynamic graph neural networks borrow heavily from neighboring methods, and understanding the boundaries helps when choosing a model. The table places them next to the closest related approaches.
| Approach | Handles time | Handles structure | Main use |
|---|---|---|---|
| Static GNN | No | Yes | Fixed graphs, node and graph classification |
| Spatiotemporal GNN | Yes, on a fixed graph | Yes | Sensor networks with changing signals |
| Dynamic GNN | Yes, with changing topology | Yes | Evolving interaction networks |
| Sequence model per node | Yes | No | Individual event histories |
| Temporal knowledge graph embedding | Yes, as timestamps on facts | Relational triples | Reasoning over time-stamped facts |
The distinction between spatiotemporal and dynamic graphs is often blurred. A traffic network has a fixed road topology with changing signals, while a payment network has edges that appear and disappear; the second case is the core territory of dynamic graph neural networks.
Training, evaluation and benchmarks
Models are usually trained self-supervised on future link prediction: given history up to time t, the model scores whether a pair of nodes interacts next. Negative samples are drawn from node pairs that did not interact, and the choice of negatives strongly affects reported results.
- Chronological splits: train, validation and test sets must follow time order, never random edge splits.
- Hard negatives: historical negatives, which interacted earlier but not now, are more realistic than random pairs.
- Inductive evaluation: separate scores for nodes unseen during training reveal generalization.
- Ranking metrics: mean reciprocal rank is preferred over AUC when many candidates compete.
Common benchmarks include the Wikipedia, Reddit, MOOC and LastFM interaction datasets and the larger Temporal Graph Benchmark (TGB). Studies on these benchmarks found that simple baselines, such as memorizing recent neighbors, often rival complex models, which underlines the importance of rigorous evaluation.
Practical challenges and common mistakes
Deploying a dynamic graph neural network raises engineering and methodological problems that static models do not face. The table lists the most frequent ones.
| Problem | Cause | Remedy |
|---|---|---|
| Temporal leakage | Future edges used in neighbor sampling | Filter neighbors by timestamp |
| Stale memory | Inactive nodes keep outdated states | Apply time decay or embedding projection |
| Memory growth | Full event history stored for all nodes | Sample recent neighbors only |
| Overstated accuracy | Easy random negatives | Use historical and inductive negatives |
| Slow inference | Sequential event processing | Batch events within short time windows |
Batching events also creates a subtle trade-off: larger batches speed up training but hide interactions that occur within the same batch, which can degrade accuracy on bursty data.
A further mistake is choosing a dynamic model when the task does not need one. If the graph changes slowly and predictions are refreshed weekly, a static GNN retrained on recent snapshots may be simpler, cheaper and equally accurate. Dynamic graph neural networks pay off when event timing carries predictive signal and decisions must follow events within minutes or hours. A quick test is to compare the model against a recency-based heuristic baseline before investing in production infrastructure.
A plain-language summary
Many networks keep changing. People make new friends. Customers buy from new shops. Roads get busier at rush hour.
A dynamic graph neural network is a learning model built for these changing networks. It looks at who is connected and also at when each connection happened. Recent contacts often count more than old ones.
With this view, it can predict what will happen next, such as which two accounts are likely to interact soon.
An example from practice
A payment provider processes several million card transactions per day and wants to flag fraud rings, groups of accounts that send money in coordinated bursts. A static graph model, retrained weekly, misses rings that form and disappear within a few hours.
The fraud team builds a continuous-time model in the style of TGN. Each transaction is an event between a card and a merchant, and every node keeps a memory vector updated after each payment. The model scores each new transaction by how unusual it looks given the recent history of both parties.
Evaluated on a chronological split of three months of data, the dynamic model detects coordinated fraud earlier than the weekly static model and with fewer false alarms. The team still keeps rule-based checks, because the network cannot explain its scores in terms analysts can audit.