\HeaderA{bfs}{Breadth and Depth-first search}{bfs}
\aliasA{bfs,graph,ANY,ANY-method}{bfs}{bfs,graph,ANY,ANY.Rdash.method}
\aliasA{bfs,graph,character,logical-method}{bfs}{bfs,graph,character,logical.Rdash.method}
\aliasA{bfs,graph,character,missing-method}{bfs}{bfs,graph,character,missing.Rdash.method}
\aliasA{bfs,graph,character-method}{bfs}{bfs,graph,character.Rdash.method}
\aliasA{bfs,graph,missing,logical-method}{bfs}{bfs,graph,missing,logical.Rdash.method}
\aliasA{bfs,graph,missing,missing-method}{bfs}{bfs,graph,missing,missing.Rdash.method}
\aliasA{bfs,graph-method}{bfs}{bfs,graph.Rdash.method}
\aliasA{dfs}{bfs}{dfs}
\aliasA{dfs,graph,character,ANY-method}{bfs}{dfs,graph,character,ANY.Rdash.method}
\aliasA{dfs,graph,character,logical-method}{bfs}{dfs,graph,character,logical.Rdash.method}
\aliasA{dfs,graph,character,missing-method}{bfs}{dfs,graph,character,missing.Rdash.method}
\aliasA{dfs,graph,character-method}{bfs}{dfs,graph,character.Rdash.method}
\aliasA{dfs,graph,missing,missing-method}{bfs}{dfs,graph,missing,missing.Rdash.method}
\keyword{graphs}{bfs}
\begin{Description}\relax
These functions return information on
graph traversal by breadth and depth first search using
routines from the BOOST library.
\end{Description}
\begin{Usage}
\begin{verbatim}
bfs(object, node, checkConn=TRUE)
dfs(object, node, checkConn=TRUE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] instance of class graph from Bioconductor graph class
\item[\code{node}] node name where search starts; defaults to the
node in first position in the node vector.
\item[\code{checkConn}] logical for backwards compatibility; this
parameter has no effect as of RBGL 1.7.9 and will be removed in future versions.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These two functions are interfaces to the
BOOST graph library functions for breadth first
and depth first search. Both methods handle
unconnected graphs by applying the algorithms
over the connected components. 

Cormen et al note (p 542) that `results of depth-first search
may depend upon the order in which the vertices are examined ...
These different visitation orders tend not to cause problems
in practice, as any DFS result can usually be used effectively,
with essentially equivalent results'.
\end{Details}
\begin{Value}
For \code{bfs} a vector of node indices in order of BFS visit.

For \code{dfs} a
list of two vectors of nodes, with elements
\code{discover} (order of DFS discovery),
and \code{finish}
(order of DFS completion).
\end{Value}
\begin{Author}\relax
VJ Carey <stvjc@channing.harvard.edu>
\end{Author}
\begin{Examples}
\begin{ExampleCode}
dd <- fromGXL(file(system.file("XML/bfsex.gxl",package="RBGL"), open="r"))
bfs(dd, "r", FALSE)
bfs(dd, "s", TRUE)

dd2 <- fromGXL(file(system.file("XML/dfsex.gxl",package="RBGL"), open="r"))
dfs(dd2, "u", FALSE)
\end{ExampleCode}
\end{Examples}

