Skip to contents

Real networks have far more triangles than degree alone predicts. A node of degree below two has no pair of neighbours to close, so it has no defined coefficient; those nodes are excluded from the average rather than counted as zero, which stops the average drifting down with every leaf added.

Usage

Clstcoef(G)

Arguments

G

Symmetric adjacency matrix; non-zero means an edge.

Value

List with estimate, local, degree, n_defined, n.

Details

Formula: C_v = 2 e(N_v) / (k_v (k_v - 1)); the graph average is the mean over nodes with k_v >= 2.

References

Watts, D. J. & Strogatz, S. H. (1998). Nature 393:440-442.

Examples

Clstcoef(matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3))
#> $estimate
#> [1] 1
#> 
#> $local
#> [1] 1 1 1
#> 
#> $degree
#> [1] 2 2 2
#> 
#> $n_defined
#> [1] 3
#> 
#> $n
#> [1] 3
#> 
#> $method
#> [1] "Watts-Strogatz clustering coefficient"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"