Thank you, this solved my problems! Best wishes. 2016-02-08 11:38 GMT+01:00 Tiago de Paula Peixoto <tiago@skewed.de>:
On 08.02.2016 11:31, Danilo Giuffrida wrote:
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.
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().
Best, Tiago
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool