I would like to know how I can divide the attached list of points to as many clusters as possible based on the gap between the patches. Then I can decide which one should be kept and which remove. I tried different options in Findclusters command but none of them gave me a correct answer. Any help is really appreciated.
Asked
Active
Viewed 161 times
1 Answers
6
This gets you four clusters with points grouped together in ccmp. The two large islands are depicted in orange and blue, the small long island in green, and a tiny island in red.
nng = NearestNeighborGraph[data, 8];
ccmp = ConnectedComponents[nng];
ListPointPlot3D[ccmp]
(* Length@ccmp == 4 *)
flinty
- 25,147
- 2
- 20
- 86


{k,r}it uses theknearest within distancer, and{All,r}connects all elements within distancer– flinty Jun 13 '20 at 17:31DistanceFunction, e.g ,DistanceFunction -> ManhattanDistance– flinty Jun 13 '20 at 17:43nng = NearestNeighborGraph[RandomReal[{-1, 1}, 1024], 4]; Length /@ ConnectedComponents[nng]– flinty Jun 13 '20 at 18:37Show[ListPointPlot3D[ccmp], ListPointPlot3D[Callout[#[[2]], Style["\[ScriptCapitalR]" <> ToString[#[[1]]], 14, Bold]] & /@Transpose[{Range@Length@ccmp, Mean /@ ccmp}], PlotStyle -> Opacity[0]]]– Bob Hanlon Jun 14 '20 at 02:41