problems with assortativity coefficient


I'm trying to compute Newman's assortativity coefficient with graph-tool,
but I'm getting unexpected high values of r.

Here's a test:

,inv_poisson(r,5))\",progress" \

--save graph.xml

graph-tool --load graph.xml --assortativity-coefficient="total-degree"

this is what I get:

assortativity coefficient (total-degree)

0.2105496706333980228 0.0036187517305024605174

The assortativity value above should be very close to zero as the network is
uncorrelated, but it's reasonably large.

Also, when I try:

graph-tool --load graph.xml

graph-tool crashes:

Traceback (most recent call last):

  File "/usr/bin/graph-tool", line 494, in <module>


  File "/usr/bin/graph-tool", line 470, in _main


  File "/usr/bin/graph-tool", line 356, in run

    output_file = opt[0].output_file

AttributeError: OptionMask instance has no attribute 'output_file'

I'm running graph-tool 1.2.0devel (commit 8b98b8c6, Sun Jul 20 11:46:39 2008

Am I missing something obvious?

many thanks,


attachment.html (4.18 KB)


The problem you reported with the second option is now fixed in git. I
however cannot see high values of assortativity:

graph-tool --correlated-configurational-model="N=20000,inv_pjk_ceil=\"lambda p,r: (inv_poisson(p,5), inv_poisson(r,5))\"" --assortativity-coefficient="total-degree" --scalar-assortativity-coefficient="total-degree"

# assortativity coefficient (total-degree)
0.089740322372172054433 0.00391706558657752002

# scalar assortativity coefficient (total-degree)
0.0024758906274759966311 0.0031450246340287649899

Please test with the version now in git, and see if you still see the
same problem.



After installing the new ver I get the same results as you do. However, I
get an error when I type the following (taken from the documentation):

,inv_poisson(r,5))\",progress" \--save graph.xml.bz2

adding vertices: 1 of 20000 (0%)graph-tool: error during evaluation of
nv_poisson(r,5))",progress: <lambda>() takes no arguments (2 given)

My understanding is that the documentation is somehow partially out-of-date
due to the ongoing upgrade of graph-tool, but I just wanted to check that
this is the reason for the error I'm getting.


Yes, there is a discrepancy with the documentation. You should do:
"lambda p,r: (inv_poisson(p,5), inv_poisson(r,5))".

All this will be largely deprecate with the new version of graph-tool as
(purely) a python library. It should be coming out "real soon now"™, and
will include up-to-date documentation.