Actually, maybe just use the immediate dominator directly without that special case for zero/one predecessor. I had a hunch it would make a definition based on orders more elegant, but it also introduces a special case there. Defining the reuglar idom of a DAG in terms of orders is pretty elegant however: consider the partial order obtained from a single-source DAG by taking the reflexive, transitive closure of the edge relation. The idom of a node n
is the unique largest node that can be compared to all nodes that are <= n
and that is not n
itself.