python-igraph icon indicating copy to clipboard operation
python-igraph copied to clipboard

None membership in VertexClustering

Open vtraag opened this issue 3 years ago • 0 comments

Describe the bug Passing in None values when constructing a VertexClustering works fine, but yields an error when calling sizes() function:

TypeError: list indices must be integers or slices, not NoneType

Presumably, it would be easiest to simply disallow None as a possible membership value. In case one wants to indicate no cluster for a certain node one could use VertexCover.

To reproduce

import igraph as ig

G = ig.Graph.Formula('a-b-c')
clustering = ig.VertexClustering(G, [1, 2, None])
clustering.sizes()

Version information Which version of python-igraph are you using and where did you obtain it?

0.9.11 from conda.

vtraag avatar Jun 27 '22 21:06 vtraag