Reputation: 1405
I'm using python package graph-tool, and facing an error trying to internalize boolean PropertyMap, the way described at http://graph-tool.skewed.de/static/doc/quickstart.html#graph-views. Here is an example code:
from graph_tool.all import *
g = price_network(500)
filtered = g.new_vertex_property("bool")
for v in g.vertices():
filtered[v] = True
g.properties["filtered"] = filtered
The last line produces a
TypeError: value for 't' must be one of: v, e, g
Anyone knows how to put it right?
Upvotes: 2
Views: 1570
Reputation: 5261
As it is described in the documentation, you should use the vertex_properties
attribute:
g.vertex_properties["filtered"] = filtered
or equivalently:
g.vp["filtered"] = filtered
If you want to use the properties
attribute directly, you have to pass the key type as well:
g.properties[('v', "filtered")] = filtered
This is because different types of property maps (e.g. vertex or edge) can have the same name. This is all covered here.
Upvotes: 4