How would I apply weights to vertices when calculating the center of mass to make it more accurate

So I know that the center of mass can be calculated by averaging the vertices of a mesh, but what if the density of vertices is uneven. now I would find the distance between a vertex and it’s neighbors, but how do I proportion this?

Vertex density is not how you would determine an accurate center of mass. Assuming a uniform density, what you need to compute is the volume of an object. This is defined by vertices and the topology between them, but it has nothing to do with “the distance between a vertex and it’s neighbors”.