I'm looking for an algorithm for the transitive reduction of a digraph (a DAG in fact).
The wikipedia article displays a formula $R^-$ = $R - (R \times R^+)$ — where $R^-$ is the transitive reduction of $R$ and $R^+$ is the transitive closure of $R$ — but that Cartesian product doesn't form an edge (unless I'm missing something), so how can I take away from $R$?
For example, say $3$ depends on $2$ and $1$, and $2$ depends on $1$. The edges of this graph $G$ are $(2, 1)$, $(3, 1)$, and $(3, 2)$.
I'm expecting the reduction to be $G' = \{(2, 1), (3, 2)\}$. The transitive closure of $G$ is $G$, right?