I am working on a grasshopper definition to create a random pattern out of spheres that are populated on a 3d object’s exterior. It is fairly basic and looks something like this.

However, since the end goal is a 3D print, I would like to know the number of “islands” based on a point’s proximity to every other points populated around the object. This is so that I do not have any disconnected parts that would create large holes in the print. From my searching, it seems like a connected components graph is the way to achieve this goal using the closest point or point proximity component in Grasshopper.

I have found an article about connected components in an undirected graph and it seems like its is a step in the right direction, but I was wondering if someone here has made an implementation of this in a plugin or a python component. I have limited experience implementing algorithms, so any help would be greatly appreciated.