Dijkstra's shortest paths using boost C++
dijkstra's shortest paths
- instance of class graph
- node name(s) for start of path(s)
- node name(s) for end of path(s)
- if TRUE, output additional info on the shortest path
These functions are interfaces to the Boost graph library C++ routines for Dijkstra's shortest paths.
sp.between.scalar is obsolete.
- total length (using edge weights) of this shortest path ,
- if requested, a vector of names of the nodes on the shortest path ,
- if requested, a list of edge weights of this shortest path .See
finishare vectors, we use the normal cycling rule in R to match both vectors and try to find the shortest path for each pair.Function
sp.betweenreturns a list of info on the shortest paths. Each such shortest path is designated by its starting node and its ending node. Each element in the returned list contains:
pathWeightsfor caveats about undirected graph representation.
con <- file(system.file("XML/ospf.gxl",package="RBGL"), open="r") ospf <- fromGXL(con) close(con) dijkstra.sp(ospf,nodes(ospf)) sp.between(ospf, "RT6", "RT1") sp.between(ospf, c("RT6", "RT2"), "RT1", detail=FALSE) sp.between(ospf, c("RT6", "RT2"), c("RT1","RT5")) # see NAs for query on nonexistent path sp.between(ospf,"N10", "N13")
Looks like there are no examples yet.