Dynamic graph neural network

Also known as: temporal graph neural network

On this page 7

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.

ComponentRoleTypical implementation
Graph encoderAggregates information from neighborsGCN, graph attention or GraphSAGE layers
Temporal moduleCarries information across timeGRU, LSTM, self-attention or memory
Time encodingRepresents time gaps numericallyLearnable sinusoidal functions
Node memoryStores a compressed history per nodeState vector updated after each event
DecoderProduces task outputsMLP scoring node pairs or classes
Core building blocks

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.

AspectDiscrete-time modelsContinuous-time models
InputOrdered sequence of graph snapshotsStream of timestamped edges
Time resolutionFixed by snapshot intervalExact event times
Example modelsEvolveGCN, DySAT, T-GCN, GCRNTGN, TGAT, JODIE, DyRep, DyGFormer
StrengthSimple batching, efficient on GPUsCaptures fine-grained ordering
WeaknessLoses ordering within a snapshotHarder to parallelize
Typical domainTraffic sensors, periodic reportsTransactions, messaging, clicks
Comparison of the two families

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.

ApproachHandles timeHandles structureMain use
Static GNNNoYesFixed graphs, node and graph classification
Spatiotemporal GNNYes, on a fixed graphYesSensor networks with changing signals
Dynamic GNNYes, with changing topologyYesEvolving interaction networks
Sequence model per nodeYesNoIndividual event histories
Temporal knowledge graph embeddingYes, as timestamps on factsRelational triplesReasoning over time-stamped facts
Dynamic models next to related approaches

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.

ProblemCauseRemedy
Temporal leakageFuture edges used in neighbor samplingFilter neighbors by timestamp
Stale memoryInactive nodes keep outdated statesApply time decay or embedding projection
Memory growthFull event history stored for all nodesSample recent neighbors only
Overstated accuracyEasy random negativesUse historical and inductive negatives
Slow inferenceSequential event processingBatch events within short time windows
Typical problems and remedies

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.