Identifying Voronoi Cells with Shared Edges

Firstly, I would like to report that providing an argument out of range returns a random value for the function: first_face_vertex(face: int) -> int.

As the title suggests, I am interested in knowing if there is a method to determine whether two Voronoi cells are sharing an edge, or at least to calculate the shortest distance between them in Ovito

Yes, thank you for bringing this up. All functions of the SurfaceMeshTopology class do not perform out-of-bounds checks in the current version of OVITO. They directly map to the C++ APIs, which assume valid inputs for performance reasons. We are going to add out-of-bounds checks to the Python layer in the next OVITO release to make this safer.

Regarding your question: I think this is doable using the still undocumented function SurfaceMeshTopology.next_manifold_edge(). This function lets you visit all Voronoi faces (surface manifolds) adjacent to an edge, which in turn allows determining all Voronoi cells (spatial regions) that are adjacent to a given edge. But the details of this approach still need to be worked out.