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

## Description

Compute Local and Global (average) Clustering Coefficients for Directed/Undirected and Unweighted/Weighted Networks.
Formulas are based on Barrat et al. (2004) coefficient when the network is undirected, while it is based on Clemente and Grassi (2018) proposal when the network is directed.
In the directed case, different components of directed clustering coefficient are also provided.

## Usage

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

## Arguments

 `mat` A Weighted Adjacency Matrix `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'.

## Details

The function `ClustBCG` computes Barrat et al. coefficient when a weighted and undirected network is considered.
For directed network Clemente and Grassi formula is computed.
In case of unweighted and undirected graphs, it provides classical local clustering coefficient (Watts and Strogatz).

In all cases, local clustering 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 considered.

## 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

Barrat, A. and Barthelemy, M. and Pastor-Satorras, R. and Vespignani, A. (2004) The architecture of complex weighted networks, Proc. Natl. Acad. Sci., USA 101, 3747.

Clemente, G.P. and Grassi, R. (2018) Directed clustering in weighted networks: a new perspective, Chaos, Solitons and Fractals, 107,26–38.

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 23 24``` ```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 Barrat et al. (2004) coefficient BarratClust<-ClustBCG(A, "undirected") #The same results can be obtained with igraph::transitivity check<-sum(BarratClust\$LocalCC-transitivity(gsim, "weighted")) #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 Clemente, Grassi (2018) coefficient CGClust<-ClustBCG(A, "directed") ```

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