\HeaderA{transitive.closure}{Computes the transitive closure of a directed graph}{transitive.closure}
\keyword{graphs}{transitive.closure}
\begin{Description}\relax
Computes the transitive closure of a graph. Introduces a direct edge whenever 
there is a path between two nodes in a digraph.
\end{Description}
\begin{Usage}
\begin{verbatim}
transitive.closure(g, mat=FALSE, loops=TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{g}] graphNEL object or adjacency matrix.
\item[\code{mat}] convert result to adjacency matrix.
\item[\code{loops}] Add loops from each node to itself?
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function calculates the transitive closure of a given
graph. We use the matrix exponential to find the transitive closure.
\end{Details}
\begin{Value}
returns a graphNEL object or adjacency matrix
\end{Value}
\begin{Author}\relax
Florian Markowetz \textless{}URL: http://genomics.princeton.edu/\textasciitilde{}florian\textgreater{}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{transitive.reduction}{transitive.reduction}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   V <- LETTERS[1:3]
   edL <- list(A=list(edges="B"),B=list(edges="C"),C=list(edges=NULL))
   g <- new("graphNEL",nodes=V,edgeL=edL,edgemode="directed")
   gc <- transitive.closure(g,loops=FALSE)
    
   par(mfrow=c(1,2))
   plot(g,main="NOT transitively closed")
   plot(gc,main="transitively closed")
\end{ExampleCode}
\end{Examples}

