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).

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.

See also

Author

Nathan S. Watson-Haigh

Examples

localClusteringCoefficient(network_gen(50,.33)$network)
#> [1] 0.50000000 NaN -0.16666667 0.50000000 0.16666667 0.50000000 #> [7] 0.08333333 0.00000000 0.10000000 -0.50000000 NaN NaN #> [13] NaN 0.07142857 0.50000000 NaN -0.50000000 NaN #> [19] 0.08928571 0.50000000 0.16666667 0.12500000 0.16666667 0.08333333 #> [25] 0.00000000 -0.50000000 0.02380952 0.00000000 0.09523810 0.04166667 #> [31] 0.16666667 0.33333333 0.00000000 NaN 0.33333333 0.00000000 #> [37] 0.00000000 0.00000000 NaN -0.50000000 0.00000000 -0.50000000 #> [43] -0.16666667 0.00000000 0.50000000 0.00000000 NaN NaN #> [49] 0.50000000 0.16666667