I have extensively used graph-tool, and I find it very nice and efficient
so, first of all, congratulations for your work.
I write to you because of a suspected bug in the local clustering
coefficient, which results normalized in [0, 2] instead than in [0,1] for
one of my datasets. This issue is probably due to the fact that the network
was obtained by "simmetrization" of a previously directed one, by using
attachment.html (554 Bytes)
Could you please give us an example that shows the problem?
Yes. For example in the original directed network I have the triangle:
then I obtain the undirected network by means of g.set_directed(False) and
evaluate the local clustering of node 1, finding C(1)=2 (instead of
C(1)=1). This happens for all the nodes in this network, i.e. their local
clustering is always between 0 and 2. Of course I could simply divide by
two, but I would like to understand what is going wrong. I know that for
directed/undirected network the normalization is different, hence I guess
that something is not going on with the set_directed method.
2016-02-08 11:04 GMT+01:00 Tiago de Paula Peixoto <tiago(a)skewed.de>:
attachment.html (1.99 KB)
This is because if you make the network undirected, it becomes a
multigraph, i.e. there are _two_ edges between 2 and 3. The clustering
coefficient is normalized only for _simple_ graphs, with at most one
edge between nodes.
If you want to transform the network into a multigraph, you can filter
the parallel edges out:
u = GraphView(g, efilt=logical_not(label_parallel_edges(g, mark_only=True).fa))
or remove them with remove_parallel_edges().
Thank you, this solved my problems!
2016-02-08 11:38 GMT+01:00 Tiago de Paula Peixoto <tiago(a)skewed.de>:
attachment.html (2.14 KB)