combining vertex groups

Say I have a huge cluster of interconnected vertex groups in a mesh (i.e. a bunch of cubes that intersect but whose vertices are not connected). Is there a way for me to turn these into a single connected vertex group? One in which all the face intersections are replaced by edges and the surfaces that are not visible (because they are inside another vertex group) are removed?

Sorry, I had a hard time describing that. Let me know if you need clarification about what I’m asking :o