\HeaderA{dijkstra.sp}{Dijkstra's shortest paths using boost C++}{dijkstra.sp}
\keyword{graphs}{dijkstra.sp}
\begin{Description}\relax
dijkstra's shortest paths
\end{Description}
\begin{Usage}
\begin{verbatim}
dijkstra.sp(g,start=nodes(g)[1], eW=unlist(edgeWeights(g)))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{g}] instance of class graph 
\item[\code{start}] character: node name for start 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.

For some graph subclasses, computing the edge weights can be expensive.
If you are calling \code{dijkstra.sp} in a loop, you can pass the edge
weights explicitly to avoid the edge weight creation cost.
\end{Details}
\begin{Value}
A list with elements:
\begin{ldescription}
\item[\code{distance}] The vector of distances from \code{start} to each node
of \code{g}; includes \code{Inf} when there is no path from \code{start}.
\item[\code{penult}] A vector of indices 
(in \code{nodes(g)}) of predecessors corresponding to each node
on the path from that node back to \code{start}
\item[\code{start}] The start node that was supplied in the call to
\code{dijkstra.sp}.
\end{ldescription}
\end{Value}
\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{johnson.all.pairs.sp}{johnson.all.pairs.sp}}, \code{\LinkA{sp.between}{sp.between}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
dd <- fromGXL(file(system.file("XML/dijkex.gxl",package="RBGL"), open="r"))
dijkstra.sp(dd)
dijkstra.sp(dd,nodes(dd)[2])
ospf <- fromGXL(file(system.file("XML/ospf.gxl",package="RBGL"), open="r"))
dijkstra.sp(ospf,nodes(ospf)[6])
\end{ExampleCode}
\end{Examples}

