extractPath {RBGL} | R Documentation

## 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

### Author(s)

Vince Carey <stvjc@channing.harvard.edu>

### See Also

`allShortestPaths`

### Examples

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

[Package RBGL version 1.10.0 Index]