[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Transitivity
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Transitivity |
Date: |
Thu, 27 Dec 2012 21:49:41 +0100 |
Hi,
> I therefore used transitivity function in igraph, and for my graph I've got
> the value: 0.5493 (global), 0.42 (average).
> Reading the previous mail called "Small worlds in igraph", I think the
> "global" is best for what I want to show.
> I also compared my results using 2 others softwares Gephi and networkx in
> python.
> If I use this 2 way I have a average clustering coefficient of 0.2625 for
> networkx and 0.262 for Gephi.
The most common source of difference between different implementations of the
average local clustering coefficient (which is I guess what you are calculating
with NetworkX) is that it is not well-defined for nodes with degree zero or
degree one. Since these nodes have only one neighbor, they cannot participate
in any triangles. There are at least two possible ways to deal with it; one is
to exclude these vertices completely from the average, the other is to assume
that they have a local transitivity of zero (which is, strictly speaking, not
true, since their local transitivity is zero over zero, which is undefined).
In the R interface of igraph, you can switch between the two possibilities with
the "isolates" keyword argument. transitivity(g, type="average",
isolates="zero") will assume that these vertices have zero transitivity, while
transitivity(g, type="average", isolates="NaN") will exclude these vertices
from the calculation.
The count_zeros switch in NetworkX seems to be similar, but the documentation
worries me a bit. It says that "If False include only the nodes with nonzero
clustering in the average". This means that count_zeros=True will make the
function equivalent to isolates="zero" in the R interface of igraph, but
count_zeros=False will exclude nodes with zero triangles around it even if the
degree of the node is larger than one! I'm not sure whether this is just an
error in the documentation or an error in the implementation itself (or they
really meant it this way).
Anyway, I would compare the result of igraph using isolates="zero" with the
result of NetworkX using count_zeros=True (which is the default). Please shout
if the results still differ.
Best,
Tamas