The following code implements some of the concepts of the paper:

R. A. Jarvis and E. A. Patrick. 1973. Clustering Using a Similarity Measure Based on Shared Near Neighbors. IEEE Trans. Comput. 22, 11 (November 1973), 1025-1034. DOI=http://dx.doi.org/10.1109/T-C.1973.223640

library("dbscan") # for kNN search
library("mlbench") # for data
set.seed(2015)

Create Spirals Data

Spirals <- mlbench.spirals(500, 1, 0.05)
plot(Spirals)

x <- Spirals$x

Try with clusters with different density

# x <- rbind(
#  matrix(rnorm(n = 2*100, mean = -1, sd = .2), ncol = 2),
#  matrix(rnorm(n = 2*200, mean =  1, sd = 1), ncol = 2)
#)

plot(x)