Detect Closest Point Around Other Points then Visualize It

The Idea: within a group of points (say over 100) in 3d space, how can I make a script where each point detects the closest point around it, then draw a shape (could be just a simple sphere) based on the distance of the detection. ie a point far out from the cluster of points will be a big sphere, where as points tightly packed in the middle of the cluster will be tiny spheres

My File: I have a file with cloud points, then converted to points and isolated using a criteria, in my case, I isolated the color of the points. Right now I have an attractor point which determines the radius of the sphere projected on each point based on how close or far it is from the attractor. As indicated above, I want determine the radius of the spheres based on how close each one is from it’s nearest neighboring point. ie if a point nearest point to it is say 5mm, project a sphere that is 2.5mm in radius. if a point nearest point to it is say 1mm, project a sphere that is 0.5mm in radius

detect closest point.3dm (75.2 KB)
detect closest (12.3 KB)

maybe something like this? (43.5 KB)

Ah thank you, I found a way to do it without using the closest point node but it’s great to learn from the way you did it, thanks!