find_loops: Loop detection in a matrix

Description Usage Arguments Details Value See Also Examples

View source: R/loop_detection_functions.R


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.


find_loops(jacobian, max_num_loops = 1e+05)



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).


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


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 detection as well as Tarjan's algorithm for detecting strongly connected components are used as implemented in the igraph package (functions: all_simple_paths, components) . 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. 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").


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_noscc, find_loops_vset


#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(jac_matrix,5)

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