graph_tool.ungroup_vector_property(vprop, pos, props=None)[source]#

Ungroup vector property map vprop into a list of individual property maps.


Vector property map to be ungrouped.

poslist of ints

A list of indices corresponding to where each element of vprop should be inserted into the ungrouped list.

propslist of PropertyMap (optional, default: None)

If supplied, should contain a list of property maps to which vprop should be ungroupped.

propslist of PropertyMap

A list of property maps with the ungrouped values of vprop.


>>> from numpy.random import seed, randint
>>> from numpy import array
>>> seed(42)
>>> gt.seed_rng(42)
>>> g = gt.random_graph(100, lambda: (3, 3))
>>> prop = g.new_vertex_property("vector<int>")
>>> for v in g.vertices():
...    prop[v] = randint(0, 100, 3)
>>> uprops = gt.ungroup_vector_property(prop, [0, 1, 2])
>>> print(prop[g.vertex(0)].a)
[51 92 14]
>>> print(array([p[g.vertex(0)] for p in uprops]))
[51 92 14]