Am 29.03.21 um 15:53 schrieb Rodrigo Leal Cervantes:
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?
Yes, take a look at: https://graph-tool.skewed.de/static/doc/graph_tool.html#graph_tool.PropertyM... This means you can do: a = g.vp.pos.get_2d_array([0, 1]) The reason why this is needed is because vector properties are *not* internally stored as contiguous 2D arrays. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>