\HeaderA{transitive.reduction}{Computes the transitive reduction of a graph}{transitive.reduction}
\keyword{graphs}{transitive.reduction}
\begin{Description}\relax
\code{transitive.reduction} removes direct edges, which can be explained by another path in the graph. Regulation directions  inferred via \code{infer.edge.type} are taken into account.
\end{Description}
\begin{Usage}
\begin{verbatim}
transitive.reduction(g)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{g}] adjacency matrix
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{transitive.reduction} uses a modification of the classical algorithm from the Sedgewick book for computing transitive closures. The so-called "transitive reduction" is neither necessarily unique (only for DAGs) nor minimal in the number of edges (this could be improved).
\end{Details}
\begin{Value}
returns an adjacency matrix with shortcuts removed
\end{Value}
\begin{Author}\relax
Holger Froehlich
\end{Author}
\begin{References}\relax
R. Sedgewick, Algorithms, Pearson, 2002.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{transitive.closure}{transitive.closure}}, \code{\LinkA{infer.edge.type}{infer.edge.type}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   V <- LETTERS[1:3]
   edL <- list(A=list(edges=c("B","C")),B=list(edges="C"),C=list(edges=NULL))
   gc <- new("graphNEL",nodes=V,edgeL=edL,edgemode="directed")
   g <- transitive.reduction(gc)
    
   par(mfrow=c(1,2))
   plot(gc,main="shortcut A->C")
   plot(as(g,"graphNEL"),main="shortcut removed")
\end{ExampleCode}
\end{Examples}

