tree_broadcast_center#
- graph_tool.structure.tree_broadcast_center(g)[git][source]#
Return the broadcast time and the broadcast center of a tree.
- Parameters:
- g
Graph Undirected tree.
- g
- Returns:
- time
int The broadcast time of the tree: the minimum, over the vertices, of the number of rounds needed to inform all vertices from it, when in each round every informed vertex can inform one neighbor.
- center
numpy.ndarray The vertices from which this time is achieved.
- time
See also
tree_broadcast_timeBroadcast time from one vertex
centerVertices of minimum eccentricity
Notes
The algorithm of Slater, Cockayne, and Hedetniemi [slater-information-1981] removes the leaves repeatedly, assigning to every removed vertex the time needed to inform its subtree, which is obtained by informing its children in decreasing order of their times. 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_center(g)) (3, array([1, 3]))