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) – if True the function returns a weighted 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:
exactly the same degree sequence
approximately the same edge length distribution
exactly the same edge weight distribution
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.