Skip to main content

dominator_tree

Function dominator_tree 

Source
pub fn dominator_tree(dominators: &Dominators) -> Graph
Expand description

Returns the dominator tree of dominators as a graph, with an edge d -> n for every node n whose immediate dominator is d.

The result has the node IDs of the analyzed graph, and its edges point away from the roots of the tree, for a walk down the tree such as with a DfsTraverser. Its root nodes are the entries, the nodes that only the virtual root above several entries dominates, and the unreachable nodes. To ask whether one node dominates another, use Ancestry::of_dominators, which shares the immediate dominators instead of building this graph.

Time: O(node_count). Memory: 4 bytes per node and per edge for the result.