NN — Nearest Neighbors Superclass
adjacencylist(x, ...) ## S3 method for class 'NN' adjacencylist(x, ...) ## S3 method for class 'NN' sort(x, decreasing = FALSE, ...) ## S3 method for class 'NN' plot(x, data, main = NULL, pch = 16, col = NULL, linecol = "gray", ...)
x |
a |
... |
further parameters past on to |
decreasing |
sort in decreasing order? |
data |
that was used to create |
main |
title |
pch |
plotting character. |
col |
color used for the data points (nodes). |
linecol |
color used for edges. |
Michael Hahsler
data(iris) x <- iris[, -5] # finding kNN directly in data (using a kd-tree) nn <- kNN(x, k=5) nn # plot the kNN where NN are shown as line conecting points. plot(nn, x) # show the first few elements of the adjacency list head(adjacencylist(nn)) ## Not run: # create a graph and find connected components (if igraph is installed) library("igraph") g <- graph_from_adj_list(adjacencylist(nn)) comp <- components(g) plot(x, col = comp$membership) # detect clusters (communities) with the label propagation algorithm cl <- membership(cluster_label_prop(g)) plot(x, col = cl) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.