netneurotools.stats.network_polarisation

netneurotools.stats.network_polarisation(vec, W, directed=True)[source]

Calculate polarisation of a vector on a graph.

Network polarisation is a measure of polizzartion taken into account all the three factors below [1]:

  • how extreme the opinions of the people are

  • how much they organize into echo chambers, and

  • how these echo chambers organize in the network

Warning

Test before use.

Parameters:
  • vec ((N,) array_like) – Polarization vector. Must have both positive and negative values. Will be normalized between -1 and 1 internally.

  • W ((N, N) array_like) – Weight matrix.

  • directed (bool, optional) – Whether the graph is directed. This is used to determine whether to turn on the hermitian=True option in numpy.linalg.pinv(). When you are using a symmetric weight matrix (while real-valued implying hermitian), you can set this to False for better performance. Default: True

Returns:

polariz – Polarization of vec on W

Return type:

float

Notes

The measure is based on the genralized Eucledian distance, defined as

\[\delta_{G, o} = \sqrt{(o^+ - o^-)^T Q^* (o^+ - o^-)}\]

where \(o^+\) and \(o^-\) are the positive and negative parts of the polarization vector, and \(Q^*\) is the Moore-Penrose pseudoinverse of the Laplacian matrix \(L\) of the graph. Check effective_resistance() for similarity.

References