nws_tools.generate_randnws

nws_tools.generate_randnws(nw, M, method='auto', rwr=5, rwr_max=10)[source]

Generate random networks given a(n) (un)signed (un)weighted (un)directed input network

Parameters:

nw : NumPy 2darray

Connection matrix of input network

M : int

Number of random networks to generate (> 1)

method : str

String specifying which method to use to randomize the input network. Currently supported options are ‘auto’ (default), ‘null_model_und_sign’, ‘randmio_und’, ‘randmio_und_connected’, ‘null_model_dir_sign’, ‘randmio_dir’, ‘randmio_dir_connected’, ‘randmio_und_signed’, ‘randmio_dir_signed’, If method = ‘auto’ then a randomization strategy is chosen based the the properties of the input network (directedness, edge-density, sign of edge weights). In case of very dense networks (density > 75%) the null_model routines are used to at least shuffle the input network’s edge weights.

rwr : int

Number of approximate rewirings per edge (default: 5).

rwr_max : int

Maximal number of rewirings per edge to enforce randomization (default: 10). Note that rwr_max has to be greater or equals rwr.

Returns:

rnws : NumPy 3darray

Random networks based on input graph nw. Format is rnws.shape = (N,N,M) such that rnws[:,:,m] = m-th N x N random network

See also

randmio_und_connected
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
randmio_dir_connected
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
randmio_und
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
randmio_dir
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
randmio_und_signed
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
randmio_dir_signed
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
null_model_und_sign
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here
null_model_dir_sign
in the Brain Connectivity Toolbox (BCT) for MATLAB, currently available here

Notes

This routine calls functions from the Brain Connectivity Toolbox (BCT) for MATLAB via Octave. Thus, it requires Octave to be installed with the BCT in its search path. Further, oct2py is needed to launch an Octave instance from within Python.