Thanks for the quick reply. It is indeed true that variance should be NaN but assortativity would be zero if I understand it correctly. Now, when instead of 'float', I use 'int' as the type for the property map, I do get 0 value for the assortativity. Thus I guess that the values are wrong and it is a bug. Am I right? From your reply, it isn't clear to me if this is a bug. Snehal On Wed, Oct 4, 2017 at 6:37 PM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
On 04.10.2017 13:27, Snehal Shekatkar wrote:
I am using gt.scalar_assortativity and I observed that it returns
non-zero
values and big variance values even when the values on the nodes are exactly same.
g = gt.collection.data['karate'] s = g.new_vertex_property('float') for v in g.vertices(): s[v] = 0.9999 gt.scalar_assortativity(g, deg = s)
This returns : (1.0, 8.889098493616578)
I expect to see (0, 0) here. What am I missing?
The scalar assortativity coefficient is undefined if the variance is zero, since it appears in the denominator.
The expectation that it will be zero in this case is incorrect, since the limit where the variance goes to zero is also undefined in general.
The proper answer in this case would be to return "NaN". I'll modify the code in this way.
Best, Tiago
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India