Beispiel #1
0
def small_world_wd(W):
    '''
    An implementation of small worldness. Returned is the coefficient cc/lambda,
    the ratio of the clustering coefficient to the characteristic path length.
    This ratio is >>1 for small world networks.

    inputs: W		weighted undirected connectivity matrix

    output: s		small world coefficient
    '''
    cc = clustering_coef_wd(W)
    _, dists = breadthdist(W)
    _lambda, _, _, _, _ = charpath(dists)
    return np.mean(cc) / _lambda
def small_world_wd(W):
    '''
    An implementation of small worldness. Returned is the coefficient cc/lambda,
    the ratio of the clustering coefficient to the characteristic path length.
    This ratio is >>1 for small world networks.

    inputs: W		weighted undirected connectivity matrix

    output: s		small world coefficient
    '''
    cc = clustering_coef_wd(W)
    _, dists = breadthdist(W)
    _lambda, _, _, _, _ = charpath(dists)
    return np.mean(cc) / _lambda
Beispiel #3
0
def test_cluscoef_wd():
	x = load_directed_low_modularity_sample(thres=.45)
	cc = bct.clustering_coef_wd(x)
	print np.sum(cc)
	assert np.allclose(np.sum(cc), 289.30817909)
# For each kind, all individual coefficients are stacked in a unique 2D matrix.
print('{0} correlation biomarkers for each subject.'.format(
    connectivity_biomarkers['tangent'].shape[1]))


#### Complex graph metrics
eig_cens=[]
clusterings=[]
Node_strengths=[]

for i in range(len(ts_allsites)):
    Node_strength=bct.strengths_und(connectivity_biomarkers['tangent'][i])
    Node_strengths.append(Node_strength)
    eig_cen = bct.centrality.eigenvector_centrality_und(connectivity_biomarkers['tangent'][i])
    eig_cens.append(eig_cen)
    clustering=bct.clustering_coef_wd(connectivity_biomarkers['tangent'][i])
    clusterings.append(clustering)
    
Node_strengths = np.stack(Node_strengths)
eig_cens=np.stack(eig_cens)
clusterings=np.stack(clusterings)


from nilearn.connectome import sym_matrix_to_vec
mat_connectivity= []


matrix=connectivity_biomarkers['tangent']

    
for mat in matrix:
Beispiel #5
0
def test_cluscoef_wd():
    x = load_directed_low_modularity_sample(thres=.45)
    cc = bct.clustering_coef_wd(x)
    print np.sum(cc)
    assert np.allclose(np.sum(cc), 289.30817909)