Search code examples
pythonattributeerrorgraph-tool

Graph-tool g.get_vertex() AttributeError


I'm getting an error on a script straight out of the user guide. What am I doing wrong?

import graph_tool.all as gt
print gt.__version__
g = gt.Graph()
g.add_vertex(5)
g.get_vertices()

returns

2.20 (commit f6ef9990, Fri Jan 27 16:40:08 2017 +0000)
Traceback (most recent call last):
File "Untitled.py", line 7, in
g.get_vertices()
AttributeError: 'Graph' object has no attribute 'get_vertices'


Solution

  • The attribute Graph.get_vertices() is only available in the git version of the library, not the version 2.20 that you are using. It is only mentioned in the development version of the documentation, not the main guide.