API
The following functions are designed for public use
NetworkDynamics.AntiSymmetric
NetworkDynamics.Directed
NetworkDynamics.EIndex
NetworkDynamics.EPIndex
NetworkDynamics.Fiducial
NetworkDynamics.NWParameter
NetworkDynamics.NWParameter
NetworkDynamics.NWParameter
NetworkDynamics.NWParameter
NetworkDynamics.NWState
NetworkDynamics.NWState
NetworkDynamics.NWState
NetworkDynamics.NWState
NetworkDynamics.NWState
NetworkDynamics.Network
NetworkDynamics.ODEVertex
NetworkDynamics.Symmetric
NetworkDynamics.VIndex
NetworkDynamics.VPIndex
NetworkDynamics.dim
NetworkDynamics.eidxs
NetworkDynamics.epidxs
NetworkDynamics.pdim
NetworkDynamics.vidxs
NetworkDynamics.vpidxs
Network Construction
NetworkDynamics.Network
— TypeNetwork(nw::Network; kwargs...)
Rebuild the Network with same graph and vertex/edge functions but possibly different kwargs.
NetworkDynamics.dim
— Functiondim(nw::Network)
Returns the number of dynamic states in the network, corresponts to the length of the flat state vector.
NetworkDynamics.pdim
— Functionpdim(nw::Network)
Returns the number of parameters in the network, corresponts to the length of the flat parameter vector.
Vertex Functions
Missing docstring for StaticVertex
. Check Documenter's build log for details.
NetworkDynamics.ODEVertex
— Typestruct ODEVertex{F, OF, MM} <: NetworkDynamics.VertexFunction
Fields
name
f
dim
sym
def
depth
pdim
psym
pdef
obsf
obssym
mass_matrix
Edge Functions
Missing docstring for StaticEdge
. Check Documenter's build log for details.
Missing docstring for ODEEdge
. Check Documenter's build log for details.
Coupling types
NetworkDynamics.Symmetric
— Typestruct Symmetric <: Coupling end
Symmetric coupling type. The edge function f is evaluated once:
- the dst vertex receives the first
d
values of the edge state, - the src vertex receives the same.
Here, d
is the edge depth of the Network.
NetworkDynamics.AntiSymmetric
— Typestruct AntiSymmetric <: Coupling end
AntiSymmetric coupling type. The edge function f is evaluated once:
- the dst vertex receives the first
d
values of the edge state, - the src vertex receives (-1) of that.
Here, d
is the edge depth of the Network.
NetworkDynamics.Directed
— Typestruct Directed <: Coupling end
Directed coupling type. The edge function f is evaluated once:
- the dst vertex receives the first
d
values of the edge state, - the src vertex receives nothing.
Here, d
is the edge depth of the Network.
NetworkDynamics.Fiducial
— Typestruct Fiducial <: Coupling end
Fiducial coupling type. The edge function f is evaluated once:
- the dst vertex receives the
1:d
values of the edge state, - the src vertex receives the
d+1:2d
values of the edge state.
Here, d
is the edge depth of the Network.
Symbolic Indexing
Network State Object
NetworkDynamics.NWState
— TypeNWState(nw_or_nw_wrapper, uflat, [pflat], [t])
Indexable wrapper for flat state & parameter array. Needs Network or wrapper of Network, e.g. ODEProblem
.
s = NWState(nw)
s.v[idx, :sym] # get state :sym of vertex idx
s.e[idx, :sym] # get state :sym of edge idx
s.p.v[idx, :sym] # get parameter :sym of vertex idx
s.p.e[idx, :sym] # get parameter :sym of edge idx
s[s::Union{VIndex, EIndex, EPIndex, VPIndex}] # get parameter for specific index
Get flat array representation using uflat(s)
and pflat(s)
.
NetworkDynamics.NWState
— MethodNWState(nw_or_nw_wrapper;
utype=Vector{Float64}, ufill=filltype(utype),
ptype=Vector{Float64}, pfill=filltype(ptype), default=true)
Creates "empty" NWState
object for the Network/Wrapper nw
with flat types utype
& ptype
. The arrays will be prefilled with ufill
and pfill
respectively (defaults to NaN).
If default=true
the default state & parameter values attached to the network components will be loaded.
NetworkDynamics.NWState
— MethodNWState(p::NWState; utype=typeof(uflat(s)), ptype=typeof(pflat(s)))
Create NWState
based on other state object, just convert types.
NetworkDynamics.NWState
— MethodNWState(p::NWParameter; utype=Vector{Float64}, ufill=filltype(utype), default=true)
Create NWState
based on existing NWParameter
object.
NetworkDynamics.NWState
— MethodNWState(int::SciMLBase.DEIntegrator)
Create NWState
object from integrator
.
Network Parameter Object
NetworkDynamics.NWParameter
— TypeNWParameter(nw_or_nw_wraper, pflat)
Indexable wrapper for flat parameter array pflat
. Needs Network or wrapper of Network, e.g. ODEProblem
.
p = NWParameter(nw)
p.v[idx, :sym] # get parameter :sym of vertex idx
p.e[idx, :sym] # get parameter :sym of edge idx
p[s::Union{VPIndex, EPIndex}] # get parameter for specific index
Get flat array representation using pflat(p)
.
NetworkDynamics.NWParameter
— MethodNWParameter(nw_or_nw_wraper;
ptype=Vector{Float64}, pfill=filltype(ptype), default=true)
Creates "empty" NWParameter
object for the Network/Wrapper nw
with flat type ptype
. The array will be prefilled with pfill
(defaults to NaN).
If default=true
the default parameter values attached to the network components will be loaded.
NetworkDynamics.NWParameter
— MethodNWParameter(p::NWParameter; ptype=typeof(p.pflat))
Create NWParameter
based on other parameter object, just convert type.
NetworkDynamics.NWParameter
— MethodNWParameter(int::SciMLBase.DEIntegrator)
Create NWParameter
object from integrator
.
Index generators
NetworkDynamics.vidxs
— Functionvidxs([inpr], components=:, variables=:) :: Vector{VIndex}
Generate vector of symbolic indexes for vertices.
inpr
: Only needed for name matching or:
access. Can be Network, sol, prob, ...components
: Number/Vector,:
,Symbol
(name matches),String
/Regex
(name contains)variables
: Symbol/Number/Vector,:
,String
/Regex
(all sym containing)
Examples:
vidxs(nw) # all vertex state indices
vidxs(1:2, :u) # [VIndex(1, :u), VIndex(2, :u)]
vidxs(nw, :, [:u, :v]) # [VIndex(i, :u), VIndex(i, :v) for i in 1:nv(nw)]
vidxs(nw, "ODEVertex", :) # all symbols of all vertices with name containing "ODEVertex"
NetworkDynamics.eidxs
— Functionvidxs([inpr], components=:, variables=:) :: Vector{EIndex}
Generate vector of symbolic indexes for edges.
inpr
: Only needed for name matching or:
access. Can be Network, sol, prob, ...components
: Number/Vector,:
,Symbol
(name matches),String
/Regex
(name contains)variables
: Symbol/Number/Vector,:
,String
/Regex
(all sym containing)
Examples:
eidxs(nw) # all edge state indices
eidxs(1:2, :u) # [EIndex(1, :u), EIndex(2, :u)]
eidxs(nw, :, [:u, :v]) # [EIndex(i, :u), EIndex(i, :v) for i in 1:ne(nw)]
eidxs(nw, "FlowEdge", :) # all symbols of all edges with name containing "FlowEdge"
NetworkDynamics.vpidxs
— Functionvpidxs([inpr], components=:, variables=:) :: Vector{VPIndex}
Generate vector of symbolic indexes for parameters. See vidxs
for more information.
NetworkDynamics.epidxs
— Functionepidxs([inpr], components=:, variables=:) :: Vector{EPIndex}
Generate vector of symbolic indexes for parameters. See eidxs
for more information.
Symbolic Indices
NetworkDynamics.VIndex
— TypeVIndex{C,S} <: SymbolicStateIndex{C,S}
idx = VIndex(comp, sub)
A symbolic index for a vertex state variable.
comp
: the component index, either int or a collection of intssub
: the subindex, either int, symbol or a collection of those.
VIndex(1, :P) # vertex 1, variable :P
VIndex(1:5, 1) # first state of vertices 1 to 5
VIndex(7, (:x,:y)) # states :x and :y of vertex 7
Can be used to index into objects supporting the SymbolicIndexingInterface
, e.g. NWState
, NWParameter
or ODESolution
.
NetworkDynamics.EIndex
— TypeEIndex{C,S} <: SymbolicStateIndex{C,S}
idx = EIndex(comp, sub)
A symbolic index for an edge state variable.
comp
: the component index, either int or a collection of intssub
: the subindex, either int, symbol or a collection of those.
EIndex(1, :P) # edge 1, variable :P
EIndex(1:5, 1) # first state of edges 1 to 5
EIndex(7, (:x,:y)) # states :x and :y of edge 7
Can be used to index into objects supporting the SymbolicIndexingInterface
, e.g. NWState
, NWParameter
or ODESolution
.
NetworkDynamics.VPIndex
— TypeVPIndex{C,S} <: SymbolicStateIndex{C,S}
idx = VPIndex(comp, sub)
A symbolic index into the parameter a vertex:
comp
: the component index, either int or a collection of intssub
: the subindex, either int, symbol or a collection of those.
Can be used to index into objects supporting the SymbolicIndexingInterface
, e.g. NWParameter
or ODEProblem
.
NetworkDynamics.EPIndex
— TypeVEIndex{C,S} <: SymbolicStateIndex{C,S}
idx = VEIndex(comp, sub)
A symbolic index into the parameter a vertex:
comp
: the component index, either int or a collection of intssub
: the subindex, either int, symbol or a collection of those.
Can be used to index into objects supporting the SymbolicIndexingInterface
, e.g. NWParameter
or ODEProblem
.