コード例 #1
0
def small_world_bd(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_bd(W)
    _, dists = breadthdist(W)
    _lambda, _, _, _, _ = charpath(dists)
    return np.mean(cc) / _lambda
コード例 #2
0
def small_world_bd(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_bd(W)
    _, dists = breadthdist(W)
    _lambda, _, _, _, _ = charpath(dists)
    return np.mean(cc) / _lambda
コード例 #3
0
ファイル: clustering_tests.py プロジェクト: nkmunjal/bctpy
def test_cluscoef_bd():
	x = load_binary_directed_low_modularity_sample(thres=.41)
	cc = bct.clustering_coef_bd(x)
	assert np.allclose(np.sum(cc), 113.31145155)
コード例 #4
0
ファイル: clustering_tests.py プロジェクト: YSA6/bctpy
def test_cluscoef_bd():
    x = load_binary_directed_low_modularity_sample(thres=.41)
    cc = bct.clustering_coef_bd(x)
    assert np.allclose(np.sum(cc), 113.31145155)