Graph.community_structure() broken due to a typo
Using latest (git) graph_tool from Python raises a NameError when using Graph.community_structure() method. This is due to a typo in the Python wrapper. In the following you can see the error during IPython interactive session. A simple patch is attached.
In [14]: G2.community_structure? Type: instancemethod Base Class: <type 'instancemethod'> String Form: <bound method Graph.community_structure of <graph_tool.Graph object at 0xa6611ec>> Namespace: Interactive File: Dynamically generated function. No source code available. Definition: G2.community_structure(self, property, g=1.0, n=1000, tmin=0.01, tmax=1.0, spins=0, corr='uncorrelated', weight=None, seed=1239178229, verbose=False, history='') Docstring: Calculate the community structure and assign it to property.
In [19]: G2.community_structure("cluster")
<type 'exceptions.NameError'> Traceback (most recent call last)
/home/ele/work/cimec/2009/pbc2009/code/nilab_pbc2009/ in ()
/home/ele/work/cimec/2009/pbc2009/code/nilab_pbc2009/ in (self, property, g, n, tmin, tmax, spins, corr, weight, seed, verbose, history)
/home/ele/pythonlib/lib/python2.5/site-packages/graph_tool/init.py in wrap(*args, **kwargs) 245 def wrap(*args, **kwargs): 246 try: --> 247 return func(*args, **kwargs) 248 except (IOError, RuntimeError), e: 249 raise GraphError(args[0], str(e))
/home/ele/work/cimec/2009/pbc2009/code/nilab_pbc2009/ in (self, property, g, n, tmin, tmax, spins, corr, weight, seed, verbose, history)
/home/ele/pythonlib/lib/python2.5/site-packages/graph_tool/init.py in wrap(*args, **kwargs) 280 self.lazy_filename = None 281 self.lazy_format = None --> 282 return func(*args, **kwargs) 283 return wrap 284
/home/ele/work/cimec/2009/pbc2009/code/nilab_pbc2009/ in (self, property, g, n, tmin, tmax, spins, corr, weight, seed, verbose, history)
/home/ele/pythonlib/lib/python2.5/site-packages/graph_tool/init.py in wrap(*args, **kwargs)
266 raise TypeError("value for '%s' must be one of: %s" %
267 (a[0], ", ".join(allowed_vals[a[0]])))
--> 268 return func(*args, **kwargs)
269 return wrap
270 return decorate
/home/ele/pythonlib/lib/python2.5/site-packages/graph_tool/init.py in community_structure(self, property, g, n, tmin, tmax, spins, corr, weight, seed, verbose, history) 1005 if weight == None: 1006 weight = "" -> 1007 self.__graph.GetCommunityStructure(g, strat_map[correlated], n, tmin, 1008 tmax, spins, seed, verbose, history, 1009 weight, property)