brainconn.reference.makerandCIJdegreesfixed

makerandCIJdegreesfixed(inv, outv)[source]

This function generates a directed random network with a specified in-degree and out-degree sequence.

Parameters:
Returns:

CIJ

Return type:

NxN numpy.ndarray

Notes

Necessary conditions include:
length(in) = length(out) = n sum(in) = sum(out) = k in(i), out(i) < n-1 in(i) + out(j) < n+2 in(i) + out(i) < n

No connections are placed on the main diagonal

The algorithm used in this function is not, technically, guaranteed to terminate. If a valid distribution of in and out degrees is provided, this function will find it in bounded time with probability 1-(1/(2*(k^2))). This turns out to be a serious problem when computing infinite degree matrices, but offers good performance otherwise.