On 04.10.2017 14:26, Snehal Shekatkar wrote:
> Thanks for the quick reply. It is indeed true that variance should be NaN
> but assortativity would be zero if I understand it correctly.
No, that is not correct. The variance is not NaN, it is zero. Just look at
the formula for scalar assortativity: If the variance is zero, the value of
the coefficient is undefined, as I explained.
> 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.
It is not a bug. The reason why you get different answers is due to
numerical instability. Instead of a variance of zero, what ends up computed
instead is a very small number due to limited numerical precision.
I've modified the version in git to always return NaN in such cases, instead
of this unstable behavior.
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool