brainconn.core.assortativity_bin

assortativity_bin(CIJ, flag=0)[source]

The assortativity coefficient is a correlation coefficient between the degrees of all nodes on two opposite ends of a link. A positive assortativity coefficient indicates that nodes tend to link to other nodes with the same or similar degree.

Parameters:
  • CIJ (NxN numpy.ndarray) – binary directed/undirected connection matrix
  • flag (int) – 0 : undirected graph; degree/degree correlation 1 : directed graph; out-degree/in-degree correlation 2 : directed graph; in-degree/out-degree correlation 3 : directed graph; out-degree/out-degree correlation 4 : directed graph; in-degree/in-degreen correlation
Returns:

r – assortativity coefficient

Return type:

float

Notes

The function accepts weighted networks, but all connection weights are ignored. The main diagonal should be empty. For flag 1 the function computes the directed assortativity described in Rubinov and Sporns (2010) NeuroImage.