dominator_tree#
- graph_tool.topology.dominator_tree(g, root, dom_map=None)[source]#
Return a vertex property map the dominator vertices for each vertex.
- Parameters:
- g
Graph
Graph to be used.
- root
Vertex
The root vertex.
- dom_map
VertexPropertyMap
(optional, default:None
) If provided, the dominator map will be written in this property map.
- g
- Returns:
- dom_map
VertexPropertyMap
The dominator map. It contains for each vertex, the index of its dominator vertex.
- dom_map
Notes
A vertex u dominates a vertex v, if every path of directed graph from the entry to v must go through u.
The algorithm runs with \(O((V+E)\log (V+E))\) complexity.
References
Examples
>>> g = gt.random_graph(100, lambda: (2, 2)) >>> tree = gt.min_spanning_tree(g) >>> g.set_edge_filter(tree) >>> root = [v for v in g.vertices() if v.in_degree() == 0] >>> dom = gt.dominator_tree(g, root[0]) >>> print(dom.a) [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]