Hi Tiago,
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
g.set_directed(False).

Yes. For example in the original directed network I have the triangle:
(1)<--(2)<-->(3)-->(1)
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.

Thank you.

2016-02-08 11:04 GMT+01:00 Tiago de Paula Peixoto <tiago(a)skewed.de>:

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