Error using graph_tool.util.find_vertex with prop="in"
Hi,
I would like to use graph_tool.util.find_vertex to find vertices with a specified in-degree. I am able to find vertices with a specified vertex property, but it does not work when I set the parameter prop to a string value (e.g. "in"). The sample code below shows my problem:
from graph_tool.all import *
#Create graph
g = Graph()
#Add two vertices and an edge between them
g.add_vertex(2)
g.add_edge(0,1)
#Define vertex property and decorate vertices with this property
vprop1 = g.new_vertex_property("string")
vprop1[g.vertex(0)]="vertex 0"
vprop1[g.vertex(1)]="vertex 1"
#Call find_vertex with prop parameter as a PropertyMap
x1 = graph_tool.util.find_vertex(g, vprop1, "vertex 0")
#Call find_vertex with prop parameter set to "in"
x2 = graph_tool.util.find_vertex(g, "in", 1)
Output: The variable x1 comes out fine, but I receive the following error for x2:
AttributeError Traceback (most recent call last)
<ipython-input-22-99bf38daf7cf> in <module>()
----> 1 x2 = graph_tool.util.find_vertex(g, "in", 1)
/usr/lib/python2.7/dist-packages/graph_tool/util/__init__.pyc in find_vertex(g, prop, match)
52 can be either a :class:`~graph_tool.PropertyMap` or string with value "in",
53 "out" or "total", representing a degree type."""
---> 54 val = _converter(prop.value_type())(match)
55 ret = libgraph_tool_util.\
56 find_vertex_range(g._Graph__graph, _degree(g, prop),
AttributeError: 'str' object has no attribute 'value_type'