You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'll eventually need to support delay diffeqs in GraphDynamics. This should be technically easy, but might involve some hard API choices, specifically, what the best way will be to expose the history function in subsystem_differential.
I'd like to take a run at this if you haven't started. I see it's assigned to you, so happy to back off.
On the API question, there are already two traits in the codebase that solve the same problem, and copying them seems better than changing the signature. subsystem_differential_requires_inputs defaults to true and lets a type opt out, connection_needs_ctx defaults to false and lets a rule opt in. Same shape here:
subsystem_differential_needs_history(::Type{T}) where {T} =false
and when it's true, _graph_ode_mapping_f hands h down through apply_subsystem_differential! to a 4-arg subsystem_differential(sys, input, t, h). Nothing existing changes, and the branch resolves at compile time like the other two.
The part I think matters more is that in a spiking network the delay usually lives on the edge rather than in the subsystem, since conduction delay is a property of the connection. calculate_inputs already builds
and hands it to any rule with connection_needs_ctx(Mlj) == true. Adding h to that NamedTuple gets delayed synapses nearly for free at the user-facing level. The plumbing isn't free though: h has to thread from graph_ode! through all three _graph_ode! scheduler methods down to calculate_inputs, so it's about seven signatures, all mechanical and all in graph_solve.jl.
Two things that aren't API but need deciding:
Lags. It's much better to declare constant_lags up front than to lean on residual-control discontinuity detection. GraphSystem already collects tstops off the flat graph via event_times, so the same pass could collect lags from connections that declare one.
State-dependent lags need dependent_lags, and they interact with the discrete events, since a spike time is already a discontinuity.
Would you rather see the subsystem hook, the ctx route, or both? Happy to start with whichever you prefer.
Activity
singhharsh1708 commentedon Aug 16, 2026
I'd like to take a run at this if you haven't started. I see it's assigned to you, so happy to back off.
On the API question, there are already two traits in the codebase that solve the same problem, and copying them seems better than changing the signature.
subsystem_differential_requires_inputsdefaults totrueand lets a type opt out,connection_needs_ctxdefaults tofalseand lets a rule opt in. Same shape here:and when it's true,
_graph_ode_mapping_fhandshdown throughapply_subsystem_differential!to a 4-argsubsystem_differential(sys, input, t, h). Nothing existing changes, and the branch resolves at compile time like the other two.The part I think matters more is that in a spiking network the delay usually lives on the edge rather than in the subsystem, since conduction delay is a property of the connection.
calculate_inputsalready buildsctx = (; states_partitioned, params_partitioned, connection_matrices)and hands it to any rule with
connection_needs_ctx(Mlj) == true. Addinghto that NamedTuple gets delayed synapses nearly for free at the user-facing level. The plumbing isn't free though:hhas to thread fromgraph_ode!through all three_graph_ode!scheduler methods down tocalculate_inputs, so it's about seven signatures, all mechanical and all ingraph_solve.jl.Two things that aren't API but need deciding:
Lags. It's much better to declare
constant_lagsup front than to lean on residual-control discontinuity detection.GraphSystemalready collectststopsoff the flat graph viaevent_times, so the same pass could collect lags from connections that declare one.State-dependent lags need
dependent_lags, and they interact with the discrete events, since a spike time is already a discontinuity.Would you rather see the subsystem hook, the ctx route, or both? Happy to start with whichever you prefer.