Learn R Programming

gSeg (version 1.1)

nnl: Construct the Nearest Neighbor Link (NNL)

Description

This function provides a method to construct the NNL.

Usage

nnl(distance, K)

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.

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.

See Also

gSeg, gseg1_discrete, gseg2_discrete

Examples

Run this code
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)

Run the code above in your browser using DataLab