|
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(incidencegraph) |
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 |
| - nps = get_networkproperties(rn) |
386 |
| - if isempty(nps.terminallinkageclasses) |
387 |
| - slcs = stronglinkageclasses(rn) |
388 |
| - tslcs = filter(lc->isterminal(lc, rn), slcs) |
389 |
| - nps.terminallinkageclasses = tslcs |
390 |
| - end |
391 |
| - nps.terminallinkageclasses |
392 |
| -end |
393 |
| - |
394 |
| -function isterminal(lc::Vector, rn::ReactionSystem) |
395 |
| - imat = incidencemat(rn) |
396 |
| - |
397 |
| - for r in 1:size(imat, 2) |
398 |
| - s = findfirst(==(-1), @view imat[:, r]) |
399 |
| - if s in Set(lc) |
400 |
| - p = findfirst(==(1), @view imat[:, r]) |
401 |
| - p in Set(lc) ? continue : return false |
402 |
| - end |
403 |
| - end |
404 |
| - true |
405 |
| -end |
406 |
| - |
407 | 362 | @doc raw"""
|
408 | 363 | deficiency(rn::ReactionSystem)
|
409 | 364 |
|
|
0 commit comments