pylipid.func.get_node_list

pylipid.func.get_node_list(corrcoef, threshold=4)[source]

Calculate community structures from interaction network.

The interaction network is built using the correlation coeffient matrix, in which the edges are the Pearson correlation of the two connecting nodes. The community structures of this network is calculated using the Louvain algorithm 1, which find high modularity network partitions. The modularity is defined as 2:

\[Q=\frac{1}{2 m} \sum_{i, j}\left[A_{i j}-\frac{k_{i} k_{j}}{2 m}\right] \delta\left(c_{i}, c_{j}\right)\]

where \(A_{i j}\) is the weight of the edge between node i and node j; \(k_{i}\) is the sum of weights of the nodes attached to the node i, i.e. the degree of the node; \(c_{i}\) is the community to which node i assigned; \(\delta\left(c_{i}, c_{j}\right)\) is 1 if i=j and 0 otherwise; and \(m=\frac{1}{2} \sum_{i j} A_{i j}\) is the number of edges. In the modularity optimization, the Louvain algorithm orders the nodes in the network, and then, one by one, removes and inserts each node in a different community c_i until no significant increase in modularity. After modularity optimization, all the nodes that belong to the same community are merged into a single node, of which the edge weights are the sum of the weights of the comprising nodes. This optimization-aggregation loop is iterated until all nodes are collapsed into one.

By default, this method returns communities containing at least 4 nodes. This setting can be changed by using the parameter threshold.

Parameters
  • corrcoef (ndarray(n, n)) – The Pearson correlation matrix.

  • threshold (int, default=4) – Size of communities. Only communities with more nodes than the threshold will be returned.

Returns

  • node_list (list of lists) – A list of community nodes.

  • modularity (float or None) – The modularity of network partition. It measure the quality of network partition. The value is between 1 and -1. The bigger the modularity, the better the partition.

References

1

Blondel, V. D.; Guillaume, J.-L.; Lambiotte, R.; Lefebvre, E., Fast unfolding of communities in large networks. Journal of Statistical Mechanics: Theory and Experiment 2008, 2008 (10), P10008

2

Newman, M. E. J., Analysis of weighted networks. Physical Review E 2004, 70 (5), 056131.