gt.assortativity vs gt.scalar_assortativity

Hello all,

I am trying to use graph-tool to study the assortativity of certain graphs.
I find that there are two functions in graph-tool that would do the job:
"gt.assortativity" and "gt.scalar_assortativity". I initially thought that
if the scalar property that I am interested in is the degree itself, I
would get the same value for both. But I don't!

I tried calculating assortativity for simple undirected Erdos-Renyi graphs
and only "scalar assortativity" seems to give correct answer. In fact,
"gt.assortativity" gives me quite high values even for ER graphs. Can
somebody kindly explain the problem?

Thank you

attachment.html (947 Bytes)

The definitions are different from each other, and they should not give the
same value in general. However, there is indeed a bug in the calculation of
assortativity() that explains why you are getting large values for random
graphs. I just fixed this in git, and will make a new release soon.