How to determine if two UV verts are linked?

If you want to check if geometry is linked, it’s pretty trivial- BMVert, BMEdge, and BMLoop all have lists of linked edges and faces. But what If you want to check if two UV verts are linked? Edges, Verts, Faces, and Loops all have indices that correspond to unique elements. UVs seem to be just buried in Loops without any way to tell them apart. For example- You may have a single vert with index 3 in your mesh, but that same vert could appear four times in UV space. Once you’re in UV space, I can’t find a way to tell the four UV verts apart. There’s got to be a way to do this, right?

In case anybody is wondering, I’m working on a script that operates on multiple “groups” of linked verts in a single selection- so I need to figure out a way to break the selection apart into separate groups based on whether or not they’re linked to another vert in the selection.

They are not explicitly linked in any data structure. Blender just tests if the UV coordinates are identical and belong to the same vertex, and then considers them linked.

Yeah I figured as much, I’m working on a script that looks at all of the faces that are touching a selected vert, then loops through all of the UV verts in that face to compare identical vert indices that have different UV coordinates. It’s a bit messy right now but I think it’ll work out all right in the end. Thanks!

Not sure if I understand you correctly but you can look into bpy.ops.mesh.select_linked(which has uv component), you might be able either utilize it in your script or check the code to see
if you can reverse engineer the logic