primPath: Minimum Spanning Tree Path

Description Usage Arguments Details Value Examples

View source: R/primPath.R

Description

primPath Given a starting node, creates the minimum spanning tree path through a point configuration.

Usage

1

Arguments

A

the distance matrix for which the minimum spanning tree path will be created

start

the starting node for the path

Details

Given a starting node, compute Prim's algorithm, resulting in the path taken to construct the minimum spanning tree.

Value

return a 2x(n-1) matrix, where row 1 contains the parent nodes of the MST path, and row 2 contains the corresponding child nodes.

Examples

1
2
3
A <- dist(cbind(rnorm(100,0,1),rnorm(100,0,1)))
primPath(as.matrix(A),1)
primPath(as.matrix(A),2)

Datasmith documentation built on May 29, 2017, 10:19 p.m.