vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
596 stars 78 forks source link

Example in documentation for fixed nodes throws Exception #81

Closed vtraag closed 2 years ago

vtraag commented 3 years ago

A user of the library reported that:

I followed the instructions and examples in the manual https://leidenalg.readthedocs.io/en/latest/advanced.html#fixed-nodes but I noticed that with my toy data, in the last code step there, diff = optimiser.optimise_partition(partition, is_membership_fixed=is_membership_fixed) I get this error:

terminate called after throwing an instance of 'Exception'
 what():  Node size vector not the same size as the number of nodes.
Aborted (core dumped)

There are two things that need to be fixed for this.

  1. [x] Replace partition with new_partition in the documentation.
  2. [x] Not throw an Exception but correctly set a Python error (PyErr_SetStrring).