ungroup_vector_property#
- graph_tool.ungroup_vector_property(vprop, pos=None, props=None)[source]#
Ungroup vector property map
vprop
into a list of non-vector property maps.- Parameters:
- vprop
PropertyMap
Vector property map to be ungrouped.
- poslist of ints (optional, default:
None
) A list of indices corresponding to where each element of
vprop
should be inserted into the ungrouped list. If not provided, it will correspond to the entire range of the first element in the map.- propslist of
PropertyMap
(optional, default:None
) If supplied, should contain a list of property maps to which
vprop
should be ungroupped.
- vprop
- Returns:
- propslist of
PropertyMap
A list of property maps with the ungrouped values of
vprop
.
- propslist of
Examples
>>> 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) >>> print(prop[g.vertex(0)].a) [51 92 14] >>> print(array([p[g.vertex(0)] for p in uprops])) [51 92 14]