Ni! Hello Bleak,

I trust two possible solutions to your question stand in plain sight in the sections of the documentation pertaining to property maps.

https://graph-tool.skewed.de/static/doc/graph_tool.html#graph_tool.Graph.new_vertex_property
https://graph-tool.skewed.de/static/doc/graph_tool.html#graph_tool.PropertyMap.set_2d_array

I'm sure you'll remember to consult it more carefully in the future (=

Cheers,
ale
.~´


On Sat, Jun 13, 2020 at 6:44 PM BleakHeart <cosmin.marin19@gmail.com> wrote:
Hi tiago,
I was thinking if there is an efficient way to assing values to a vector
property map.
The only working method that I can use is the following:

vprop = g.new_vertex_property("vector<double>")
for i in range(G.num_vertices()):
       vprop[G.vertex(i)] = [1,2,3]

When I try to use something like this:

index = np.where(some condition on vertex properties)[0]
vprop.a[index] = [1,2,3]

It gives me the error: "TypeError: 'NoneType' object does not support item
assignment".
The error comes only with vector< > type properties.
I am using this to assing colours to some vertices if a given condition is
satified.
I hope that you can help, because the first method is really slow on graphs
with hundred of thousands vertices.



--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool