tree_broadcast_time

tree_broadcast_time#

graph_tool.structure.tree_broadcast_time(g, v=None)[git][source]#

Return the broadcast time of a tree, or from one of its vertices.

Parameters:
gGraph

Undirected tree.

vVertex or int (optional, default: None)

Source vertex. If not given, the largest time over all sources is returned.

Returns:
timeint

The number of rounds needed to inform all vertices from v (or, if v is None, the maximum over all vertices), when in each round every informed vertex can inform one neighbor.

See also

tree_broadcast_center

Broadcast time and broadcast center

eccentricity

Eccentricity of every vertex

Notes

The time from a vertex is the broadcast time of the tree (see tree_broadcast_center()) plus its distance to the nearest vertex of the broadcast center [slater-information-1981], which is the minimum over the broadcast schemes. The time is \(O(V\log V)\).

References

[slater-information-1981]

Peter J. Slater, Ernest J. Cockayne and Stephen T. Hedetniemi, “Information dissemination in trees”, SIAM Journal on Computing 10, 692-701 (1981), DOI: 10.1137/0210052 [sci-hub, @tor]

Examples

>>> g = gt.Graph([(0, 1), (1, 2), (1, 3), (3, 4), (3, 5), (5, 6)],
...              directed=False)
>>> print(gt.tree_broadcast_time(g), gt.tree_broadcast_time(g, 6))
5 5