Skip to content

Commit 3f2230e

Browse files
committed
up
1 parent 9298ca1 commit 3f2230e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/network_analysis.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,21 +722,23 @@ end
722722
"""
723723
cycles(rs::ReactionSystem)
724724
725-
Returns the matrix of cycles, or right eigenvectors of the stoichiometric matrix.
725+
Returns the matrix of cycles (or flux vectors), or reaction fluxes at steady state. These correspond to right eigenvectors of the stoichiometric matrix. Equivalent to [`fluxmodebasis`](@ref).
726726
"""
727727

728728
function cycles(rs::ReactionSystem)
729-
# nps = get_networkproperties(rs)
729+
nps = get_networkproperties(rs)
730730
nsm = netstoichmat(rs)
731-
cycles(nsm)
731+
!isempty(nps.cyclemat) && return nps.cyclemat
732+
nps.cyclemat = cycles(nsm; col_order = nps.col_order)
733+
nps.cyclemat
732734
end
733735

734736
function cycles(nsm::T; col_order = nothing) where {T <: AbstractMatrix}
735737

736738
# compute the left nullspace over the integers
737739
N = MT.nullspace(nsm; col_order)
738740

739-
# if all coefficients for a conservation law are negative, make positive
741+
# if all coefficients for a cycle are negative, make positive
740742
for Nrow in eachcol(N)
741743
all(r -> r <= 0, Nrow) && (Nrow .*= -1)
742744
end
@@ -750,11 +752,12 @@ function cycles(nsm::T; col_order = nothing) where {T <: AbstractMatrix}
750752
end
751753

752754
"""
753-
fluxmodes(rs::ReactionSystem)
755+
fluxvectors(rs::ReactionSystem)
754756
755757
See documentation for [`cycles`](@ref).
756758
"""
757759

758-
function fluxmodes(rs::ReactionSystem)
760+
function fluxvectors(rs::ReactionSystem)
759761
cycles(rs)
760762
end
763+

0 commit comments

Comments
 (0)