dijkstra.sp {RBGL}R Documentation

Dijkstra's shortest paths using boost C++

Description

dijkstra's shortest paths

Usage

dijkstra.sp(g,start=nodes(g)[1])

Arguments

g instance of class graph
start character: node name for start of path

Details

These functions are interfaces to the Boost graph library C++ routines for Dijkstra's shortest paths.

Value

A list with elements:

distance The vector of distances from start to each node of g; includes Inf when there is no path from start.
penult A vector of indices (in nodes(g)) of predecessors corresponding to each node on the path from that node back to start
start The start node that was supplied in the call to dijkstra.sp.

Author(s)

VJ Carey <stvjc@channing.harvard.edu>

See Also

bellman.ford.sp, dag.sp, johnson.all.pairs.sp, sp.between

Examples

dd <- fromGXL(file(system.file("XML/dijkex.gxl",package="RBGL")))
dijkstra.sp(dd)
dijkstra.sp(dd,nodes(dd)[2])
ospf <- fromGXL(file(system.file("XML/ospf.gxl",package="RBGL")))
dijkstra.sp(ospf,nodes(ospf)[6])

[Package RBGL version 1.6.0 Index]