\HeaderA{sp.between}{Dijkstra's shortest paths using boost C++}{sp.between}
\methaliasA{sp.between.old}{sp.between}{sp.between.old}
\methaliasA{sp.between.scalar}{sp.between}{sp.between.scalar}
\keyword{graphs}{sp.between}
\begin{Description}\relax
dijkstra's shortest paths
\end{Description}
\begin{Usage}
\begin{verbatim}
sp.between.scalar(g,start,finish, eW=unlist(edgeWeights(g))) 
sp.between(g,start,finish) 
sp.between.old(g,start,finish) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{g}] instance of class graph 
\item[\code{start}] character: node name(s) for start of path  
\item[\code{finish}] character vector: node names for end of path
\item[\code{eW}] numeric: edge weights.  
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These functions are interfaces to the Boost graph library C++
routines for Dijkstra's shortest paths.
\end{Details}
\begin{Value}
\code{sp.between.scalar} returns a list with elements:
\begin{ldescription}
\item[\code{length}] length (using edge weights) of shortest path
\item[\code{path}] vector of node names describing the path
\item[\code{pweights}] named vector of edge weights for all
weights constituting the path -- see \code{\LinkA{pathWeights}{pathWeights}}
for caveats about undirected graph representation.
\end{ldescription}


Note that if \code{start} or \code{finish} are vectors,
a list of results of repeated application of \code{sp.between.scalar}
is returned.
\end{Value}
\begin{Note}\relax
sp.between returns a list whose size depends upon the start and
finish arguments.  If start and finish are both scalar, then
a list is returned with elements the length of the shortest
path and the vector of nodes comprising that path.  If one of start
or finish is an n-vector, n>1, and the other is an atom,
a list is returned with n elements, each element of which is a list
possessing a length and path element.  If both start and finish
are n-vectors, a list of n elements is returned, with ith element the distance
and path between start[i] and finish[i].  It is an error to have
start and finish of different nonunity lengths.

sp.between.old is included for archival purposes.
\end{Note}
\begin{Author}\relax
VJ Carey <stvjc@channing.harvard.edu>
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{bellman.ford.sp}{bellman.ford.sp}}, \code{\LinkA{dag.sp}{dag.sp}}, \code{\LinkA{dijkstra.sp}{dijkstra.sp}}, \code{\LinkA{johnson.all.pairs.sp}{johnson.all.pairs.sp}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
ospf <- fromGXL(file(system.file("XML/ospf.gxl",package="RBGL"), open="r"))
dijkstra.sp(ospf,nodes(ospf)[6])
sp.between(ospf, "RT6", "RT1")
sp.between(ospf, c("RT6", "RT2"), "RT1")
sp.between(ospf, c("RT6", "RT2"), c("RT1","RT5"))
if (interactive()) # see an error for query on nonexistent path
sp.between(ospf,"N10", "N13")
\end{ExampleCode}
\end{Examples}

