# `Reach.Dominator`
[🔗](https://github.com/elixir-vibe/reach/blob/v2.8.4/lib/reach/dominator.ex#L1)

Immediate dominator/post-dominator trees and dominance frontiers.

# `dominates?`

```elixir
@spec dominates?(map(), term(), term()) :: boolean()
```

Checks if `a` dominates `b` in the given idom map.

# `frontier`

```elixir
@spec frontier(Graph.t(), map()) :: %{required(term()) =&gt; MapSet.t()}
```

Computes the dominance frontier for each node.

The dominance frontier of a node N is the set of nodes where
N's dominance ends — where a node has a predecessor dominated by N
but is not itself strictly dominated by N.

# `idom`

```elixir
@spec idom(Graph.t(), term()) :: %{required(term()) =&gt; term()}
```

Computes the immediate dominator map for a directed graph.

Returns `%{vertex => immediate_dominator}`. The root vertex maps to itself.

# `ipdom`

```elixir
@spec ipdom(Graph.t(), term()) :: %{required(term()) =&gt; term()}
```

Computes the immediate post-dominator map.

Reverses the CFG and computes dominators from the exit node.

# `tree`

```elixir
@spec tree(map()) :: Graph.t()
```

Builds a dominator tree from an immediate dominator map.

Returns a `Graph.t()` where edges go from dominator to dominated.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
