pathway: Find a pathway of nearest neighbors between two points in a...

Description Usage Arguments Details Value Examples

View source: R/pathway.R

Description

Given two points in a matrix p1 and p2, find the points nearest to an ideal path of n points between them.

Usage

1
2
pathway(x, p1, p2, n = 4L, navigator = navigate_unique, verbose = FALSE,
  ...)

Arguments

x

A two-dimensional numeric matrix.

p1

Integer. Row index of point at the start of the path.

p2

Integer. Row index of point at the end of the path.

n

Integer. Number of intervening points to find.

navigator

Function for constraining nearest neighbor search based on previously-selected steps.. See navigate for more details.

verbose

Display progress messages.

...

Additional arguments passed to distances::distances.

Details

To put restrictuions on the search made, specify a navigator function. Several are supplied in this package, such as navigate_unique, which will produce a path that does not revisit any points, or navigate_ordered, that will on return points from progressively later posiiton int he matrix. It is also possible to specify a custom function using navigate.

Value

A list with the following values

Examples

1
2
3
4
5
6
7
set.seed(10)
m <- matrix(runif(1000), nrow = 500, ncol = 2)
m[2,]
m[5,]
pathway(m, 2, 11)

pathway(m, 2, 400, navigator = navigate_ordered)

mdlincoln/pathway documentation built on May 23, 2019, 1:13 p.m.