Skip to contents

Calculate the local clustering coefficient for each node in an adjacency matrix. The clustering coefficient is defined as the proportion of existing connections from the total possible (Watts and Strogatz, 1998).

Usage

localClusteringCoefficient(adj)

Arguments

adj

An adjacency matrix. Calculating the clustering coefficient only makes sense if some connections are zero i.e. no connection.

Value

A vector of local clustering coefficients for each node/gene of the adjacency matrix.

References

D.J. Watts and S.H. Strogatz. (1998) Collective dynamics of 'small-world' networks. Nature. 393(6684). 440-442.

Author

Nathan S. Watson-Haigh

Examples


localClusteringCoefficient(network_gen(50,.33)$network)
#>  [1]  0.05000000  0.33333333  0.00000000  0.04444444         NaN  0.50000000
#>  [7]  0.50000000  0.50000000  0.33333333  0.16666667  0.00000000  0.05000000
#> [13]  0.00000000  0.00000000         NaN  0.50000000 -0.50000000  0.00000000
#> [19]  0.00000000 -0.50000000         NaN  0.00000000         NaN  0.00000000
#> [25]  0.03333333  0.00000000  0.16666667  0.07142857  0.50000000  0.50000000
#> [31]  0.50000000  0.00000000         NaN         NaN  0.16666667  0.03333333
#> [37]  0.50000000  0.00000000  0.16666667         NaN  0.16666667  0.16666667
#> [43]         NaN         NaN  0.50000000  0.00000000 -0.50000000         NaN
#> [49]  0.10000000  0.00000000