Hi all I have an stl file with faces and points read with pyvista. I would implent efficient alghoritm to determine the faces connectivity (for example triangle 1 is connected to triangle 2 3 4 and so on)

Secondly I would determine the list of segment to triangles connectivity (for example segment 1 belongs to triangle 54 and 67 etc)

Can some one help me?

I would suggest looking at “Winged-edge” and “Half-edge” data structures.

The winged edge data structure allows for quick traversal between faces, edges, and vertices due to the explicitly linked structure of the network.

This data structure provides efficient manipulation of the topological information associated with the objects in question (vertices, edges, faces).