map_property_values#
- graph_tool.map_property_values(src_prop, tgt_prop, map_func)[source]#
Map the values of
src_prop
totgt_prop
according to the mapping functionmap_func
.- Parameters:
- src_prop
PropertyMap
Source property map.
- tgt_prop
PropertyMap
Target property map.
- map_funcfunction or callable object
Function mapping values of
src_prop
to values oftgt_prop
.
- src_prop
- Returns:
- None
Examples
>>> g = gt.collection.data["lesmis"] >>> label_len = g.new_vertex_property("int64_t") >>> gt.map_property_values(g.vp.label, label_len, ... lambda x: len(x)) >>> print(label_len.a) [ 6 8 14 11 12 8 12 8 5 6 7 7 10 6 7 7 9 9 7 11 9 6 7 7 13 10 7 6 12 10 8 8 11 6 5 12 6 10 11 9 12 7 7 6 14 7 9 9 8 12 6 16 12 11 14 6 9 6 8 10 9 7 10 7 7 4 9 14 9 5 10 12 9 6 6 6 12]