# ClustF: Clustering Coefficients for Directed/Undirected and Weighted... In GianPaoloClemente/DirectedClustering: Directed Weighted Clustering Coefficient

## Description

This function computes both Local and Global (average) Clustering Coefficients for either Directed/Undirected and Unweighted/Weighted Networks.
Formulas are based on Onnela et al. (2005) coefficient when the network is undirected, while it is based on Fagiolo (2007) coefficient when the network is directed.
In the directed case, different components of directed clustering coefficient are also considered.

## Usage

 `1` ```ClustF(mat, type = "undirected", isolates = "zero", norm=1) ```

## Arguments

 `mat` A Weighted Adjacency Matrix. If weights are greater than one, a normalization is provided by dividing each weight by the maximum weight observed. `type` The type of the clustering coefficient to calculate. Possible values are: "undirected" (default) or "undirected". `isolates` Character scalar, defines how to treat vertices with degree zero and one. If it is 'NaN' then their local transitivity is reported as NaN and they are not included in the averaging. If it is 'zero', then we report 0 transitivity for them, and they are included in the averaging. Default value is 'zero'. `norm` If it is 1 (default), link's weights are normalized by dividing by the maximum observed weight (as proposed in Fagiolo). Otherwise, weights are not normalized. It is worth pointing out that weights are always normalized when the maximum weight is greater than zero. This normalization assures that clustering coefficient ranges between 0 and 1.

## Details

The function `ClustF` computes Onnela et al. formula when weighted and undirected networks are considered.
For directed networks, Fagiolo formula is computed. In case of unweighted and undirected graphs, it provides classical local clustering coefficient (Watts and Strogatz).

Local coefficients are obtained for each node, the global coefficient is the average of local coefficients.
These clustering coefficients do not work for graphs with multiple and/or loop edges. Hence, loops are removed.
In the directed case, different components of directed clustering coefficient are also provided.

## Value

For 'undirected case':

 `LocalCC` Local clustering coefficients `GlobalCC` Global clustering coefficient

For 'directed case':

 `cycleCC` Local Cycle clustering coefficients `middlemanCC` Local Middleman clustering coefficients `inCC` Local In clustering coefficients `outCC` Local Out clustering coefficients `totalCC` Local Total clustering coefficients `GlobalcycleCC` Global Cycle clustering coefficient `GlobalmiddlemanCC` Global Middleman clustering coefficient `GlobalinCC` Global In clustering coefficient `GlobaloutCC` Global Out clustering coefficient `GlobaltotalCC` Global Total clustering coefficient

## Author(s)

Gian Paolo Clemente, gianpaolo.clemente@unicatt.it

## References

Fagiolo, G. (2007) Clustering in complex directed networks. Physical Review E, 76(2).

Onnela, J.P. and Saramaki, J. and Kertsz, J. and Kaski, K. (2005) Intensity and coherence of motifs in weighted complex networks. Physical Review E, 71(6).

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```library(igraph) #Generate a Weighted and Undirected graph with Erdos Renyi Model gsim<-erdos.renyi.game(50, 0.5, type="gnp", directed = FALSE, loops = FALSE) PESI<-runif(length(E(gsim)), 0, 1) E(gsim)\$weight<-PESI #Get Adjacency A<-get.adjacency(gsim, sparse=FALSE, attr="weight") #Compute Onnela et al. (2005) coefficient OnnelaClust<-ClustF(A, "undirected") #Generate a Weighted and Directed Graph with Erdos Renyi Model gsim<-erdos.renyi.game(50, 0.5, type="gnp", directed = TRUE, loops = FALSE) PESI<-runif(length(E(gsim)), 0, 1) E(gsim)\$weight<-PESI #Get Adjacency A<-get.adjacency(gsim, sparse=FALSE, attr="weight") #Compute Fagiolo (2007) coefficient FagioloClust<-ClustF(A, "directed") ```

GianPaoloClemente/DirectedClustering documentation built on May 21, 2019, 9:18 a.m.