11.2.1. betweenness_calc¶
functions for generating current flow betweenness data from network matrices
- current_flow_allostery.functions.betweenness_calc.e_btw_from_Linv_legacy(Linv, Amat, sources, targets, verbose=False, verboseLevel=0, useProgressBar=True)[source]¶
This algorithm makes use of the full moore-penrose pseudo-inverse which is generally quite dense. The algorithm will scale quite poorly for very large systems. The bottleneck step (after computation of the pseudo inverse) scales as O(m*s*t) where:
m is the number of non-zero ntries in the adjacency matrix (network edges) s is the number of source nodes t is the number of target nodes
This could yield O(n^4) for networks of n nodes in the worst case!
This is only correct for the case where sources and targets are disjoint sets. If not, the scaling factor must be adjusted to be equal the number of unique combinations of sources and targets.
- current_flow_allostery.functions.betweenness_calc.getBtwMat(mat, sources, targets, verbose=False, verboseLevel=0, useProgressBar=False, useLegacyAlgorithm=False)[source]¶
Given a (possibly weighted) network in matrix format (mat) and a set of source and target nodes (sources and targets) return the corresponding network with flow betweenness edge weights. The pseudo inverse step is the most likely bottleneck, however the betweenness calculation iteself scales as O(m*s*t) where m=number of network edges, s=number of source nodes, and t=number of target nodes. At worst case, this could yield O(n^4) for an n-node matrix! Also, the sources and targets must be disjoint sets or the results will be incorrect.