clusteringCoefficient: Clustering Coefficient

View source: R/ClusteringCoefficient.R

clusteringCoefficientR Documentation

Clustering Coefficient

Description

A function to calculate the clustering coefficient for all nodes in a network.

Usage

clusteringCoefficient(A, directed = T)

Arguments

A

an adjacency matrix with network information.

directed

logical whether to calculate the directed or undirected clustering coefficients.

Details

This function calculates the inward and outward clustering coefficient in directed networks [1].

Value

If directed = TRUE, a data.frame. The first column, $clustering.in, is the inward clustering coefficient, $clustering.out, is the outward clustering coefficient. If directed = FALSE, a vector, with the undirected clustering coefficient.

References

[1] Caldarelli G (2007). Scale-Free Networks. Oxford University Press, Oxford.

Examples

# Generate an arbitrary 100 by 100 adjacency matrix with zeros and ones
# Remove loops
A <- matrix(rbinom(100 * 100, 1, 0.2), ncol = 100, nrow = 100)
diag(A) <- 0

# call contact chain function
cc <- clusteringCoefficient(A)
                                                   

leb-fmvz-usp/epinemo documentation built on Nov. 27, 2022, 10:58 p.m.