|
359 | 359 |
|
360 | 360 | linkageclasses(incidencegraph) = Graphs.connected_components(incidencegraph)
|
361 | 361 |
|
| 362 | +""" |
| 363 | + stronglinkageclasses(rn::ReactionSystem) |
| 364 | +
|
| 365 | + Return the strongly connected components of a reaction network's incidence graph (i.e. sub-groups of reaction complexes such that every complex is reachable from every other one in the sub-group). |
| 366 | +""" |
| 367 | + |
| 368 | +function stronglinkageclasses(rn::ReactionSystem) |
| 369 | + nps = get_networkproperties(rn) |
| 370 | + if isempty(nps.stronglinkageclasses) |
| 371 | + nps.stronglinkageclasses = stronglinkageclasses(incidencematgraph(rn)) |
| 372 | + end |
| 373 | + nps.stronglinkageclasses |
| 374 | +end |
| 375 | + |
| 376 | +stronglinkageclasses(incidencegraph) = Graphs.strongly_connected_components(g) |
| 377 | + |
| 378 | +""" |
| 379 | + terminallinkageclasses(rn::ReactionSystem) |
| 380 | +
|
| 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). |
| 382 | +""" |
| 383 | + |
| 384 | +function terminallinkageclasses(rn::ReactionSystem) |
| 385 | + slcs = stronglinkageclasses(rn) |
| 386 | + |
| 387 | + tslcs = filter!(slcs, lc->isterminal(lc)) |
| 388 | + tslcs |
| 389 | +end |
| 390 | + |
| 391 | +function isterminal(lc::Vector, rn::ReactionSystem) |
| 392 | + imat = incidencemat(rn) |
| 393 | + |
| 394 | + for col in columns(imat) |
| 395 | + s = findfirst(==(-1), @view D[:, r]) |
| 396 | + if s in Set(lc) |
| 397 | + p = findfirst(==(1), @view D[:, r]) |
| 398 | + p in Set(lc) ? continue : return false |
| 399 | + end |
| 400 | + end |
| 401 | + true |
| 402 | +end |
| 403 | + |
362 | 404 | @doc raw"""
|
363 | 405 | deficiency(rn::ReactionSystem)
|
364 | 406 |
|
|
925 | 967 | See documentation for [`cycles`](@ref).
|
926 | 968 | """
|
927 | 969 |
|
928 |
| -function fluxvectors(rs::ReactionSystem) |
| 970 | +function fluxmodebasis(rs::ReactionSystem) |
929 | 971 | cycles(rs)
|
930 | 972 | end
|
| 973 | + |
0 commit comments