@@ -76,25 +76,89 @@ Base.Sort.defalg(::ReactionComplex) = Base.DEFAULT_UNSTABLE
76
76
77
77
# ! format: off
78
78
# Internal cache for various ReactionSystem calculated properties
79
+ # All related functionality is in the "network_analysis.jl" file. However, this must be declared
80
+ # here as the structure is part of the `ReactionSystem` structure.
79
81
Base. @kwdef mutable struct NetworkProperties{I <: Integer , V <: BasicSymbolic{Real} }
82
+ """ Flag which is switched to `true` once any field is updated."""
80
83
isempty:: Bool = true
81
84
netstoichmat:: Union{Matrix{Int}, SparseMatrixCSC{Int, Int}} = Matrix {Int} (undef, 0 , 0 )
82
85
conservationmat:: Matrix{I} = Matrix {I} (undef, 0 , 0 )
83
86
col_order:: Vector{Int} = Int[]
87
+ """
88
+ The reaction networks *rank* (i.e. the span of the columns of its net stoichiometry matrix,
89
+ or its number of independent species).
90
+ """
84
91
rank:: Int = 0
85
92
nullity:: Int = 0
93
+ """
94
+ The set of *independent species* of the reaction system (i.e. species that will not be
95
+ eliminated when we eliminate the conserved quantities.
96
+ """
86
97
indepspecs:: Set{V} = Set {V} ()
98
+ """
99
+ The set of *dependent species* of the reaction system. These species are eliminated when
100
+ we eliminated the conserved quantities. In the resulting `ODESystem` these become
101
+ observables, not unknowns.
102
+ """
87
103
depspecs:: Set{V} = Set {V} ()
104
+ """
105
+ The equations for the (dependent) species eliminated by any conservation laws. I.e. for
106
+ the two simple two state system (`X1 <--> X2`) `X2` becomes a dependant species with the
107
+ conserved equation `X2 ~ Γ[1] - X1`.
108
+ """
88
109
conservedeqs:: Vector{Equation} = Equation[]
110
+ """
111
+ The equations for the conserved quantity parameters. I.e. for the two simple two state
112
+ system (`X1 <--> X2`) there is one conserved quantity with the equation `Γ[1] ~ X1 + X2`.
113
+ """
89
114
constantdefs:: Vector{Equation} = Equation[]
90
115
speciesmap:: Dict{V, Int} = Dict {V, Int} ()
116
+ """
117
+ A dictionary from each reaction complex to the reactions they participate it. The value
118
+ mapped from each reaction complex is a pair from the reaction's index to a value which is
119
+ `-1` if the complex is a substrate and `+1` if the complex is a product.
120
+ """
91
121
complextorxsmap:: OrderedDict{ReactionComplex{Int}, Vector{Pair{Int, Int}}} = OrderedDict {ReactionComplex{Int},Vector{Pair{Int,Int}}} ()
122
+ """ A vector with all the reaction system's reaction complexes """
92
123
complexes:: Vector{ReactionComplex{Int}} = Vector {ReactionComplex{Int}} (undef, 0 )
124
+ """
125
+ An MxN matrix where M is the number of reaction complexes and N the number of reactions.
126
+ Element i,j is:
127
+ -1 if the i'th complex is a substrate of the j'th reaction.
128
+ +1 if the i'th complex is a product of the j'th reaction.
129
+ 0 if the i'th complex is not part of the j'th reaction.
130
+ """
93
131
incidencemat:: Union{Matrix{Int}, SparseMatrixCSC{Int, Int}} = Matrix {Int} (undef, 0 , 0 )
132
+ """
133
+ An MxN matrix where M is the number of species and N the number of reaction complexes.
134
+ Element i,j is the coefficient of the i'th species in the j'th complex (0 entries denote
135
+ species that are not part of the corresponding complex). Whether the matrix is sparse
136
+ is designated when it is created.
137
+ """
94
138
complexstoichmat:: Union{Matrix{Int}, SparseMatrixCSC{Int, Int}} = Matrix {Int} (undef, 0 , 0 )
139
+ """
140
+ An MxN matrix where M is the number of reaction complexes and N the number of reactions.
141
+ Element i,j is -1 if i'th complex is a substrate of the j'th reaction (and 0 otherwise).
142
+ """
95
143
complexoutgoingmat:: Union{Matrix{Int}, SparseMatrixCSC{Int, Int}} = Matrix {Int} (undef, 0 , 0 )
144
+ """
145
+ A (directed) graph, with nodes corresponding to reaction complexes and edges to reactions.
146
+ There is an edge from complex i to complex j if there is a reaction converting complex
147
+ i to complex j.
148
+ """
96
149
incidencegraph:: Graphs.SimpleDiGraph{Int} = Graphs. DiGraph ()
150
+ """
151
+ A vector of the connected components of the incidence graph. Each element of the
152
+ `linkageclasses` corresponds to a connected component, and is a vector listing all the
153
+ reaction complexes in that connected component.
154
+ """
97
155
linkageclasses:: Vector{Vector{Int}} = Vector {Vector{Int}} (undef, 0 )
156
+ """
157
+ The networks deficiency. It is computed as *n - l - r*, where *n* is the number of reaction
158
+ complexes, *l* is the number of linkage classes (i.e. the number of connected components
159
+ in the incidence graph), and *r* is the reaction networks *rank* (i.e. the span of the columns
160
+ of its net stoichiometry matrix, or its number of independent species).
161
+ """
98
162
deficiency:: Int = 0
99
163
end
100
164
# ! format: on
0 commit comments