Skip to content

Commit 9b868d0

Browse files
committed
commented code
1 parent a4e8b65 commit 9b868d0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/network_analysis.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ stronglinkageclasses(incidencegraph) = Graphs.strongly_connected_components(inci
378378
"""
379379
terminallinkageclasses(rn::ReactionSystem)
380380
381-
Return the terminal strongly connected components of a reaction network's incidence graph (i.e. sub-groups of reaction complexes that are 1) strongly connected and 2) every reaction in the component produces a complex in the component).
381+
Return the terminal strongly connected components of a reaction network's incidence graph (i.e. sub-groups of reaction complexes that are 1) strongly connected and 2) every outgoing reaction from a complex in the component produces a complex also in the component).
382382
"""
383383

384384
function terminallinkageclasses(rn::ReactionSystem)
@@ -391,11 +391,16 @@ function terminallinkageclasses(rn::ReactionSystem)
391391
nps.terminallinkageclasses
392392
end
393393

394+
395+
# Check whether a given linkage class in a reaction network is terminal, i.e. all outgoing reactions from complexes in the linkage class produce a complex also in hte linkage class
394396
function isterminal(lc::Vector, rn::ReactionSystem)
395397
imat = incidencemat(rn)
396398

397399
for r in 1:size(imat, 2)
400+
# Find the index of the reactant complex for a given reaction
398401
s = findfirst(==(-1), @view imat[:, r])
402+
403+
# If the reactant complex is in the linkage class, check whether the product complex is also in the linkage class. If any of them are not, return false.
399404
if s in Set(lc)
400405
p = findfirst(==(1), @view imat[:, r])
401406
p in Set(lc) ? continue : return false

0 commit comments

Comments
 (0)