nnl: Construct the Nearest Neighbor Link (NNL)

Description Usage Arguments Value See Also Examples

View source: R/NNL.R

Description

This function provides a method to construct the NNL.

Usage

1
nnl(distance, K)

Arguments

distance

The distance matrix on the distinct values (a "number of unique observations" by "number of unique observations" matrix).

K

The value of k in "k-MST" or "k-NNL" to construct the similarity graph.

Value

E

The edge matrix representing the similarity graph on the distinct values with the number of edges in the similarity graph being the number of rows and 2 columns. Each row records the subject indices of the two ends of an edge in the similarity graph.

See Also

gSeg, gseg1_discrete, gseg2_discrete

Examples

1
2
3
4
5
6
7
8
9
n = 50
d = 10
dat = matrix(rnorm(d*n),n)
sam = sample(1:n, replace = TRUE)
dat = dat[sam,] 

# This data has repeated observations
dat_uni = unique(dat)
E = nnl(dist(dat_uni), 1)

gSeg documentation built on Oct. 23, 2020, 5:54 p.m.