Hello world!

Property maps are really useful and I've come to love them! However, sometimes 
it's handy to convert them back to arrays (for example for plotting).

For vertex property maps that are scalar valued, we have the handy shortcut 
`.a` or the method `.get_array()`. However, these do not seem to work for 
vector valued vp's.

Say for example that I'm storing the 2D coordinates of the vertices inside the 
vp `pos`. `g.vp.pos.a` returns `None`, and the way I typically convert this to 
an array is

```
print(g.vp.pos)
# <VertexPropertyMap object with value type 'vector<double>', for Graph 
0x7f02f04d34f0, at 0x7f0297d164f0>


pos = np.array(list(g.vp.pos))
print(pos.shape)  # (100, 2)
```

but I wonder if there is a better way to do this. What do other people use in 
this case?

Rodrigo
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to