3D edge detection from pointclouds

Hi, I’m trying to detect the edges of this 3D grid of points. I’ve attached the points below. I am trying to detect the points that lie on edges. Although this current grid is simple, I also want it work when I try different forms of pointclouds. I have been working with c# using the accord.net library and trying to do it with the Knearestneighbors and the Ransac algorithm but I am unable to do it. I read a paper that works on generating folded edges ( as seen in the picture below ) , that is the exact result I want. They have a specific pseudo code mentioned ( see attached img), however I am not able to fully execute it on c#. Does anyone know the best way to go about this?

foldeed edge

I see an image of points but no GH file with points internalized?

Without examples, it’s difficult to imagine a general purpose solution.