MSTDist: Calculates the minimum spanning tree distance, in kilometers,...

Description Usage Arguments Details Value References Examples

Description

Calculates the minimum spanning tree distance, in kilometers, using Prim's Algorithm [1]

Usage

1
MSTDist(longs, lats)

Arguments

longs

- Longitudinal occurrences in decimal degrees

lats

- Latitudinal occurrences in decimal degrees

Details

Uses Prim's algorithm for finding the minimum spanning tree, time-consuming calculation as the number of locations increases past 1000

Value

Returns the minimum spanning tree distance in kilometers, the pairwise distance matrix of occurrences, the order points were connected in, and a 2-column array of coordinates

References

[1] Prim, R.C. 1957. Shortest Connection Networks and Some Generalizations. The Bell System Technical Journal 36:1389-1401.

Examples

1
2
3
longs<-c(12,34,-55)
lats<-c(-41,3,56)
MSTDist(longs,lats)

Example output

$MST_km
[1] 15030.47

$MST_DistMat
  X1       X2       X3
1 NA 12457.78 9670.166
2 NA       NA 5360.309
3 NA       NA       NA

$MST_pt_connects
[1] 1 3 3 2

$Longitude
[1] -55  12  34

$Latitude
[1]  56 -41   3

Warning message:
In min(GCDMatrix[, VertList], na.rm = TRUE) :
  no non-missing arguments to min; returning Inf

GeoRange documentation built on May 1, 2019, 8:03 p.m.

Related to MSTDist in GeoRange...