infect_vertex_property

infect_vertex_property#

graph_tool.infect_vertex_property(g, prop, vals=None)[source]#

Propagate the prop values of vertices with value val to all their out-neighbors.

Parameters:
propVertexPropertyMap

Property map to be modified.

valslist (optional, default: None)

List of values to be propagated. If not provided, all values will be propagated.

Returns:
NoneNone

Examples

>>> from numpy.random import seed
>>> seed(42)
>>> gt.seed_rng(42)
>>> g = gt.random_graph(100, lambda: (3, 3))
>>> prop = g.vertex_index.copy("int32_t")
>>> gt.infect_vertex_property(g, prop, [10])
>>> print(sum(prop.a == 10))
4