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

Group list of properties props into a vector property map of the same type.

propslist of PropertyMap

Properties to be grouped.

value_typestring (optional, default: None)

If supplied, defines the value type of the grouped property.

vpropPropertyMap (optional, default: None)

If supplied, the properties are grouped into this property map.

poslist of ints (optional, default: None)

If supplied, should contain a list of indices where each corresponding element of props should be inserted.


A vector property map with the grouped values of each property map in props.


>>> from numpy.random import seed, randint
>>> from numpy import array
>>> seed(42)
>>> gt.seed_rng(42)
>>> g = gt.random_graph(100, lambda: (3, 3))
>>> props = [g.new_vertex_property("int") for i in range(3)]
>>> for i in range(3):
...    props[i].a = randint(0, 100, g.num_vertices())
>>> gprop = gt.group_vector_property(props)
>>> print(gprop[g.vertex(0)].a)
[51 25  8]
>>> print(array([p[g.vertex(0)] for p in props]))
[51 25  8]