pik-copan / pyunicorn

Unified Complex Network and Recurrence Analysis Toolbox
http://pik-potsdam.de/~donges/pyunicorn/
Other
195 stars 86 forks source link

The "Tutorial_ClimateNetworks.ipynb" notebook fails at calculating betweenness #178

Closed bronzitte closed 1 year ago

bronzitte commented 1 year ago

Based on the error message, I think the error is from the nobigint parameter for graph.betweenness function, which is based on the igraph package. My igraph version is 0.10.4 and igraph.Graph.betweenness does not have the nobigint input param. Could you let me know if my understanding is correct? Thanks!


TypeError Traceback (most recent call last) Cell In[15], line 8 6 closeness = net.closeness() 7 # Get betweenness ----> 8 betweenness = net.betweenness() 9 # Get local clustering coefficient 10 clustering = net.local_clustering()

File ~/projects/complex_systems/pyunicorn/src/pyunicorn/core/network.py:101, in cached_const..wrapper..wrapped(self, *args, kwargs) 99 @wraps(func) 100 def wrapped(self, *args, *kwargs): --> 101 return cache_helper(self, cat, key, msg, func, args, kwargs)

File ~/projects/complex_systems/pyunicorn/src/pyunicorn/core/network.py:90, in cache_helper(self, cat, key, msg, func, *args, *kwargs) 88 if msg is not None and self.silence_level <= 1: 89 print('Calculating ' + msg + '...') ---> 90 self.cache[cat][key] = func(self, args, **kwargs) 91 return self.cache[cat][key]

File ~/projects/complex_systems/pyunicorn/src/pyunicorn/core/network.py:3155, in Network.betweenness(self, no_big_int) 3133 """ 3134 For each node, return its betweenness. 3135 (...) 3146 :rtype: 1d numpy array [node] of floats >= 0 3147 """ 3148 # Return the absolute value of normed tbc, since a bug sometimes 3149 # results in negative signs 3150 # The measure is normed by the maximum betweenness centrality achieved 3151 # only by the star (Freeman 1978): (n*2-3n+2)/2 3152 # This restricts TBC to 0 <= TBC <= 1 3153 # maxTBC = ( self.N*2 - 3 self.N + 2 ) / 2 -> 3155 return np.abs(np.array(self.graph.betweenness(nobigint=no_big_int)))

TypeError: 'nobigint' is an invalid keyword argument for this function

szhorvat commented 1 year ago

The nobigint parameter has been removed from igraph 0.9, as it is no longer necessary. This argument used to control a tradeoff between speed and accuracy. Since version 0.9, igraph's betweenness calculation is both slightly faster and much more accurate than with any nobigint setting before.

zugnachpankow commented 1 year ago

Hey @bronzitte and @szhorvat,

thanks for pointing this out! I actually created that notebook using an older version of igraph, hence I got no error and oversaw this. Sorry for that little blunder.

We currently have a transition in the team of pyunicorn, so it might take a couple of days until this is fixed, even though this should be a minor fix. If possible, please use an compatible version of igraph until then. I will keep this issue open for now.

Thanks again! Best, Max

bronzitte commented 1 year ago

Thank you Max!

fkuehlein commented 1 year ago

This issue can be closed, as it is resolved with the merge of the above PR #182.