*! version 1.0.0 15Feb2017

Title

nw_wcc -- Calculates Weighted Clustering Coefficients (WCC) in Complex Direct Networks following Fagiolo, Phys. Rev. E (2007).

Syntax

nw_wcc
[netname]
[,
binary
normalize()
cycle
middleman
in
out
all
]

binary Computes Binary (non weighted) network's clustering coefficient. Otherwise, weighted clustering coefficients are computed by default.

normalize() Normalizes edges weights in the range [0,1] to make clustering coefficients scale-invariant. Only max (default) or sum arguments are accepted.

cycle Cycle pattern ((A A A)_).

middleman Middleman pattern ((A A' A)_).

in Inward pattern ((A' A A)_).

out Outward pattern ((A A A')_).

all All(D) pattern, default (((A + A')^3_)/2) .

Description

nw_wcc calculates the clustering coefficient of each node i among a network, following the pattern indicated in option and
saves the result as a Stata variable specific to the pattern and the binary or weighted dimension. At least one pattern should be indicated, if not, the pattern all is the default.

By default, weights are not normalized as in Fagiolo, Phys. Rev. E (2007), because they are assumed to be in the range [0,1].
Without the normalized option, the clustering coefficients are not scale invariant.
The normalize option rescale all weights into a [0;1] range, and makes the clustering coefficient scale invariant.
The default normalization procedure (also accessible by typing normalized(max)) divides all weights (w) by max(w) (See discussion in Saramaki et al. (2007)).
Option normalize(sum) normalizes (w) by Sum(w), where Sum(w) is the sum of all the network weights.

nw_wcc Also returns Overall and Average clustering coefficients, stored in local variables

saved results

nw_wcc saves the following results in r()

Scalars

r(overall_wcc) overall clustering coefficient

r(avg_wcc) Average clustering coefficient

Examples

Middleman graph
. mata M=(0,10,5\0,0,0\0,10,0)
. nwset , mat(M)

. nw_wcc, binary in
. nw_wcc, binary out
. nw_wcc, binary mid
. nw_wcc, binary all

. nw_wcc, n in
. nw_wcc, n out
. nw_wcc, n mid
. nw_wcc, n all

Cycle graph
. mata C=(0,0,0.2\0.2,0,0\0,0.2,0)
. nwset , mat(C)

. nw_wcc, cyc
. nw_wcc, all

. nw_wcc, n(sum) cyc
. nw_wcc, n(sum) all

See also

nwcluster (SSC) computes another clustering coefficient for weighted networks, following Onnela et al(2005, Phys. Rev. E). The main differences is that for directed networks, nwcluster (Onnela's index) either only focus on inward or outward edges; while nw_wcc (Fagiolo's index) identify different clustering patterns based on both inward and outward edges.

nw_wcc requires the nwcommands package developed by Thomas Grund.

For do-files and ancillary files, see:

. net describe nwcommands-ado, from(http://www.nwcommands.org)

For help files, see :

. net describe nwcommands-hlp, from(http://www.nwcommands.org)
}}

Author

Charlie Joyez, Paris-Dauphine University
charlie.joyez@dauphine.fr

References

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

Saramäki, J., Kivelä, M., Onnela, J. P., Kaski, K., & Kertesz, J. (2007). Generalizations of the clustering coefficient to weighted complex networks. Physical Review E, 75(2), 027105.

Onnela, J. P., Saramäki, J., Kertész, J., & Kaski, K. (2005). Intensity and coherence of motifs in weighted complex networks. Physical Review E, 71(6), 065103.

Note

Developed with the kind approval and advice from G. Fagiolo, I remain of course the only responsible of any mistakes in the code.