ModularityState get_Be() function fails
Hi Tiago,
The get_Be() function of ModularityState instance fails as shown below
g = gt.collection.data["karate"]
state = gt.ModularityState(g)
state.get_Be()
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-5-7161849e7414> in <module>
----> 1 state.get_Be()
/usr/local/Cellar/graph-tool/2.35_3/lib/python3.9/site-packages/graph_tool/inference/modularity.py in get_Be(self)
179 w = w[w>0]
180 w /= w.sum()
--> 181 return numpy.exp(-(w*log(w)).sum())
182
183 def entropy(self, gamma=1., **kwargs):
NameError: name 'numpy' is not defined
As indicated by the error message, numpy is imported as np at the beginning of the file 'modularity.py' but in line 181 (and 343 as well) numpy is used.