find_loops_noscc: Loop detection in a matrix

Description Usage Arguments Details Value See Also Examples

View source: R/loop_detection_functions.R

Description

Given the Jacobian matrix of an ODE system or the adjacency matrix of a graph, this function determines all loops in the system up to the maximal number supplied. No decomposition into strongly connected components is performed.

Usage

1
find_loops_noscc(jacobian, max_num_loops = 1e+05)

Arguments

jacobian

Square Jacobian matrix of an ODE system or the adjacency matrix of a graph; captures interactions such that entry (i,j) is negative (positive) if variable j regulates variable i negatively (positively).

max_num_loops

Positive numeric value indicating the maximal number of loops that are reported. Default: 10^5.

Details

The input matrix delivers the directed interactions in the ODE system; if entry (i,j) is non-zero it means that variable (or node) i is regulated by variable (node) j. Johnson's algorithm for path detections from the igraph package (function: all_simple_paths) is used. No decomposition into strongly connected components is employed which could be beneficial for smaller systems (compared to find_loops). The queried graph is increased stepwise leading to the output of loops in a certain order determined by the order of occurrence in the Jacobian matrix:

If the maximal number of loops, max_num_loops, is reached, no warning is issued. It is very probable that not all feedback loops of the system have been found. Up to which species this function searched before stopping due to reaching the maximal allowed loop number can be inferred from the last exported feedback loop. Running the function multiple times with re-ordered jacobian as input can enable detection of alternative feedback loops while limiting the runtime and output size of single runs. If columns of the Jacobian are named, the identification is given by the attribute node_ids, attr(result,"node_ids").

Value

A data.frame with three columns: loop, length, sign containing up to max_num_loops loops of the systems defined by matrix jacobian. Each entry in the loop column is a list of identifiers that correspond to the indices of the variable in the Jacobian matrix and denote in which order the variables form the loop.

See Also

find_loops, find_loops_vset

Examples

1
2
3
4
#sample Jacobian matrix of a system with 4 variables
jac_matrix <- rbind(c(-1,0,0,-1),c(1,-1,0,1),c(0,1,-1,0),c(0,0,1,-1))
#find the first 5 feedback loops of the system
loop_list <- find_loops_noscc(jac_matrix,5)

LoopDetectR documentation built on July 20, 2020, 5:07 p.m.