Three-dimensional gravity inversion using graph theory to delineate the skeleton of homogeneous sources