xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
180 stars 28 forks source link

Warn on unknown type of degree assortativity #533

Closed doabell closed 5 months ago

doabell commented 5 months ago

When calling xgi.degree_assortativity() with exact=True and an unknown kind, the code raises an UnboundLocalError that is hard to debug. This PR fixes that behavior.

Unknown kind-s are handled in _choose_degrees, but after #526, when exact=True, _choose_degrees is no longer called.

I also changed the message from

Invalid choice function!

to

Invalid type of degree assortativity!

to better describe the error.

(I found this because I made a typo in kind=.)