Getting adjacent vertices on the boundary of a mesh

Hello,
I noticed that in some meshes obtained with “trunc” the boundary elements are not ordered. I wish to get access to the adjacent vertices to a vertex on the boundary. Using the boundary elements I can get one neighbor, but since the elements are not ordered, finding the other one is not straightforward.

I could make a loop to find the right order of the boundary elements, but I was wondering if there was already something available for this in FreeFem.

Thank you and best regards,
Beni