In my addon I’d like avoid duplicate vertices and edges.

Here is how I see it.

Suppose we need a vertex with coordinates x,y,z

We check if there is already a vertex with coordinates x,y,z with dictance tolerance d, where d is a small value (e.g. 0.00001)

If that vertex already exists, we simply take it and use it

Otherwise create a new vertex with coordinates x,y,z

Is there already existing code to solve that problem?

How would you implement it otherwise?