[graph-tool] strength and clustering coefficient on weighted digraph
Tiago de Paula Peixoto
tiago at skewed.de
Tue Mar 5 20:51:19 CET 2013
On 03/05/2013 10:26 AM, Renato Fabbri wrote:
> I think I got it (even beforehand). I could not get the strength in a
> direct manner as
> I get the degree. I fell that is because I am not understanding something.
Weighted degrees are not built in. But you can get it with a simple loop:
k = sum(w[e] for in v.out_edges())
In this case, the tip Abdo gave regarding storing in a property map may
com in handy, so you use the values again in the future:
ks = g.new_vertex_property("double")
for v in g.vertices():
ks[v] = sum(w[e] for in v.out_edges())
>> Regarding the clustering coefficient, could you specify what it is that
>> you want to calculate?
> frac of numb of closed triads.
Without considering the weights? How is this different from the
traditional unweighted clustering coefficient?
> Cheers. Your detailed and helpful response was very appreciated.
> There is more info on what we are doing here:
> and here:
Thanks for the references, and good luck with your project!
Tiago de Paula Peixoto <tiago at skewed.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 555 bytes
Desc: OpenPGP digital signature
More information about the graph-tool