Graph Neural ODEs: Continuous-Time Graph Dynamics

7 minute read

Published:

TL;DR: A GNN with K discrete layers applies K rounds of message passing. A Graph Neural ODE replaces this with a differential equation dH/dt = f(H, A, t). The solution H(T) after integration from t=0 to T is the output. This allows irregular timesteps, adaptive depth, and principled modelling of continuous graph dynamics.
Graph neural ODE dynamics
Continuous-depth GNN dynamics โ€” EGNN equivariant evolution (Satorras et al., 2021)
Key Insight: A discrete GNN with K layers is like a staircase โ€” you take exactly K steps regardless of the terrain. A Graph Neural ODE is like a smooth ramp โ€” the solver takes small steps where the dynamics are steep and large steps where they are flat. The number of effective "layers" adapts automatically to the data, and you can evaluate the state at any continuous time, not just at integer steps.

Neural ODEs: A Quick Refresher

Standard residual network: H^{(k+1)} = H^{(k)} + f_ฮธ(H^{(k)}). This is the Euler discretisation of the ODE:

dH/dt = f_ฮธ(H(t))

Neural ODE (Chen et al., 2018): parameterise the derivative dH/dt with a neural network, and solve the ODE with any numerical integrator (RK4, dopri5). The solution H(T) is the output. Backpropagation through the integrator uses the adjoint method โ€” O(1) memory regardless of integration steps.

Graph Neural ODEs

Extend the dynamics to incorporate graph structure:

dH(t)/dt = f_ฮธ( H(t), A )

Where A is the graph adjacency (fixed or time-varying) and f_ฮธ is a GNN layer. Each โ€œstepโ€ of the ODE solver corresponds to one round of graph-aware message passing. The number of effective layers is determined by the integration horizon T and step size โ€” not a fixed hyperparameter.

CGODE (Continuous Graph Neural ODE)

dH(t)/dt = ฯƒ( ร‚ H(t) W )

This is the continuous analogue of a GCN layer. The solution H(T) has the same expressive power as a K-layer GCN, where K corresponds to the integration steps โ€” but K can be non-integer and is adaptive.

Latent Graph ODE

For trajectory prediction:

  1. Encoder: observe partial trajectories {x_i(t)} for t โˆˆ [t_0, t_obs]; encode to initial latent state z_0
  2. GNN-ODE dynamics: dz/dt = GNN(z, A) โ€” latent dynamics coupled by graph structure
  3. Decoder: decode z(t) for t > t_obs to predict future trajectories

This models physically-coupled systems (particle dynamics, multi-agent trajectories) where entities interact through the graph structure.

The physics connection: Many physical systems are naturally described by differential equations over interaction graphs โ€” Newton's laws for particle systems, diffusion equations on networks, epidemic spreading on contact graphs. Graph Neural ODEs provide a learnable version of these dynamics, useful when the exact equations are unknown but the graph structure (who interacts with whom) is known.

Worked Example: Graph Neural ODE vs Discrete GCN

Consider a path graph with 3 nodes: A โ€” B โ€” C, each with scalar feature h(0) = [1, 0, 0] (only A is active). Adjacency after normalisation: A_hat has 1/sqrt(deg) weights.

Discrete GCN (2 layers):

  • Layer 1: h_B gets contribution from A and C. h_B^(1) โ‰ˆ 0.5 (half of Aโ€™s signal)
  • Layer 2: h_C gets contribution from B. h_C^(2) โ‰ˆ 0.25

The signal reaches C exactly at layer 2. To reach further you must add more layers โ€” the depth is a hard hyperparameter.

Graph Neural ODE (integrate from t=0 to T):

The ODE dH/dt = A_hat ยท H diffuses the signal continuously. At time t, the solution is:

H(t) = exp(A_hat ยท t) ยท H(0)
  • At t=0.5: h_C(0.5) โ‰ˆ 0.06 (signal just starting to reach C)
  • At t=1.0: h_C(1.0) โ‰ˆ 0.18 (more signal)
  • At t=2.0: h_C(2.0) โ‰ˆ 0.30 (stronger, oversmoothed if too large)

You can choose T to match the taskโ€™s natural scale โ€” no need to count layers. The ODE solver also automatically refines its steps near t=0 where the gradient is largest.

Discrete GCN (2 layers) L=0 L=1 L=2 A B C Graph Neural ODE (continuous) t 0.5 1.0 2.0 A B C
Left: discrete GCN propagates signal in integer layer steps โ€” C only receives signal at layer 2. Right: Graph Neural ODE diffuses signal continuously โ€” you read off the state at any time T, and the solver adapts its step size to the local dynamics.

Continuous-Time Graph Learning (CTDG Perspective)

For continuous-time dynamic graphs where events arrive at irregular times, Graph Neural ODEs offer a natural framework:

  1. Between events: node states evolve according to dh_v/dt = f(h_v)
  2. At event (u, v, t): update h_u and h_v based on the interaction

This is the approach taken by NDCG (Neural Dynamics on Complex Graphs) and similar models. The ODE handles smooth evolution between events; the event mechanism handles discrete updates.

Advantages of the ODE Formulation

Adaptive depth: ODE solvers automatically use more steps where the dynamics are complex. This is analogous to โ€œuse more layers where neededโ€ โ€” impossible in fixed discrete architectures.

Continuous time: make predictions at any continuous time t, not just at integer layer depths.

Physical interpretability: ODE dynamics have clear physical analogues โ€” diffusion, oscillation, predator-prey dynamics.

Memory efficiency: adjoint method computes gradients with O(1) memory regardless of integration steps (vs O(K) for K-layer backprop).

Limitations

Speed: numerical ODE solvers are slower than fixed matrix multiplications. Adaptive step-size solvers can be unpredictable.

Stiffness: some graph dynamics are โ€œstiffโ€ โ€” small perturbations cause rapid changes โ€” requiring very small step sizes and slow integration.

Expressiveness: the continuous dynamics f must be chosen carefully. A simple GCN-like f(H, A) is no more expressive than discrete GCN.

Applications

  • Particle physics: learn interaction dynamics from trajectory data
  • Traffic flow: model road network congestion as a PDE
  • Epidemic modelling: SIR dynamics on contact graphs
  • Multi-agent systems: robots, pedestrians interacting through proximity graphs
  • Time-series prediction on graphs: predicting future states of coupled systems

Summary

PropertyDiscrete GNNGraph Neural ODE
DepthFixed K layersContinuous (integration time T)
TimestepInteger layersReal-valued, adaptive
Backprop memoryO(K)O(1) (adjoint method)
Time handlingDiscrete snapshotsNative continuous-time
Physical interpretationMessage passingCoupled dynamical systems

Graph Neural ODEs are not universally better than discrete GNNs โ€” they are a more natural fit for physical and temporal systems where dynamics are inherently continuous. For standard graph classification or node classification on static graphs, discrete GNNs remain preferred.

References

  • Chen, R. T. Q., Rubanova, Y., Bettencourt, J., & Duvenaud, D. (2018). Neural Ordinary Differential Equations. NeurIPS 2018 (Neural ODEs: replacing discrete residual layers with continuous ODE solvers via the adjoint method).
  • Poli, M., Massaroli, S., Park, J., Yamashita, A., Asama, H., & Park, J. (2019). Graph Neural Ordinary Differential Equations. arXiv 2019 (Graph Neural ODEs: combining ODE dynamics with GNN spatial aggregation for continuous-time graphs).
  • Rubanova, Y., Chen, R. T. Q., & Duvenaud, D. (2019). Latent ODEs for Irregularly-Sampled Time Series. NeurIPS 2019 (Latent ODEs handling irregular observation times โ€” foundational for temporal graph ODEs).