Improve error when passing incorrectly formatted degree sequence to directed graph generator
When generating a directed network using the block model, if you fail to return an in and out-degree for your degrees function—i.e. you return a number instead of a 2-ple, the code correctly produces an error:
"object of type 'float' has no len()"
My suggestion is to check the dimension of the degrees before hitting this error, so that the error message can be more informative than the default Python. That way, beginners [like me] can understand what to fix. The relevant error, with line information included, is:
File "/usr/local/lib/python2.7/site-packages/graph_tool/generation/init.py", line 386, in random_graph _get_rng(), verbose, True) TypeError: object of type 'float' has no len()