netneurotools.networks.match_length_degree_distribution

netneurotools.networks.match_length_degree_distribution(W, D, nbins=10, nswap=1000, replacement=False, weighted=True, seed=None)[source]

Generate degree- and edge length-preserving surrogate connectomes.

Parameters:
  • W ((N, N) array-like) – weighted or binary symmetric connectivity matrix.

  • D ((N, N) array-like) – symmetric distance matrix.

  • nbins (int) – number of distance bins (edge length matrix is performed by swapping connections in the same bin). Default = 10.

  • nswap (int) – total number of edge swaps to perform. Recommended = nnodes * 20 Default = 1000.

  • replacement (bool, optional) – if True all the edges are available for swapping. Default= False

  • weighted (bool, optional) – Whether to return weighted rewired connectivity matrix. Default = True

  • seed (float, optional) – Random seed. Default = None

Returns:

  • newB ((N, N) array-like) – binary rewired matrix

  • newW ((N, N) array-like) – weighted rewired matrix. Returns matrix of zeros if weighted=False.

  • nr (int) – number of successful rewires

Notes

Takes a weighted, symmetric connectivity matrix data and Euclidean/fiber length matrix distance and generates a randomized network with:

  1. exactly the same degree sequence

  2. approximately the same edge length distribution

  3. exactly the same edge weight distribution

  4. approximately the same weight-length relationship

Reference

Betzel, R. F., Bassett, D. S. (2018) Specificity and robustness of long-distance connections in weighted, interareal connectomes. PNAS.