Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

extractPath

convert a dijkstra.sp predecessor structure into the path joining two nodes


Description

determine a path between two nodes in a graph, using output of dijkstra.sp.

Usage

extractPath(s, f, pens)

Arguments

s

index of starting node in nodes vector of the graph from which pens was derived

f

index of ending node in nodes vector

pens

predecessor index vector as returned in the preds component of dijkstra.sp output

Value

numeric vector of indices of nodes along shortest path

Author(s)

Vince Carey <stvjc@channing.harvard.edu>

References

Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )

The Boost Graph Library: User Guide and Reference Manual; by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine; (Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp. ISBN 0-201-72914-8

See Also

Examples

data(FileDep)
dd <- dijkstra.sp(FileDep)
extractPath(1,9,dd$pen)

RBGL

An interface to the BOOST graph library

v1.66.0
Artistic-2.0
Authors
Vince Carey <stvjc@channing.harvard.edu>, Li Long <li.long@isb-sib.ch>, R. Gentleman
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.