On 01/04/2013 10:35 AM, Kire Gasteovski wrote: > Guten Tag! > > I am making the following > example http://projects.skewed.de/graph-tool/wiki/FrontpageExample . > > What I want to do is to extract the coordinates of the nodes into a list > from the vertex property map (i.e. from the variable pos, I assume they > are stored there). How do I do that? Please help me, because I am stuck > on this problem for 2 days and I can't find the solution.
You can either do:
coords = []
for v in g.vertices():
x, y = pos[v]
coords.append((x, y))
or the following if you want arrays:
x, y = ungroup_vector_property(g, [0, 1])
print(x.a) # array with x coordinates
print(y.a) # array with y coordinates
Cheers,
Tiago
--
Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] http://lists.skewed.de/mailman/listinfo/graph-tool
