I'm working with a graph, where I need to highlight subgraphs. The graph is in 2D. Right now, I generate a set of points from bounding rectangles of all objects that need to be highlighted, and find a convex hull of these points, like this:
However, this doesn't work that well, since a convex hull can potentially have huge empty gaps in it. If there were another subgraph going through that empty space, it would incorrectly represent two graphs intersecting.
I've been playing around with different algorithms, but I can't find the one that works reliably and would produce desired results. The best I've come up with is this:
...but it's unstable and very hard to debug. Before I dive back into it, I was wondering if there are any well-known algorithms to shrink-wrap a set of points. If you were to represent a convex hull as something made of an elastic material, imagine if the air was sucked out of the graph, so the empty areas of the convex hull would cave in.
Are there any well-known algorithms to do this, or is this problem too specific?