I am interested in the traditional graph partitioning problem, which roughly speaking seeks to obtain a partition of a graph into a number of components, in which each component has about the same size (either in terms of number of nodes or sum total of node weight), and the sum total weight of edges that cross between components is minimized. Problems of this nature are generally NP-hard, but I am aware of the software METIS which can obtain good quality partitions very quickly. METIS also has the feature that it can enforce the constraint that each component in the resulting partition be contiguous ("connected").
What I am looking for is an algorithm or some sort of software package that is similar to METIS, but can also enforce the constraint that each partition is still contiguous when only a certain subset of edges from the original graph are considered.
Here is an example:
The graph on the left is the original graph. All nodes have the same weight. If I want to partition the graph into two components, while enforcing contiguity constraints, I would choose the highlighted groups. This partition has a "cost" of 5. But what I actually want to do is partition the graph on the left, while enforcing the constraint that each component be contiguous if it only had the edges in the graph in the middle. This obviously results in a different partition (which is actually the only feasible partition in this small example). This partition has a cost of 9 (note I am still counting the edges from the original graph), but it satisfies the constraints.
I would be interested in algorithms that solve this problem directly, or that transform the problem into something that can be solved by currently-existing software, e.g. METIS.
It is not sufficient to just perform graph partitioning on the middle graph, because that ignores the potential cost of the additional edges that may or may not cross between different components in the resulting partition.
(For those wondering the use case, I am interested in redistricting. I have a graph that quantifies the relationships between different precincts, but I need to enforce a contiguity constraint on the graph that represents which precincts actually border each other, which is much smaller than my input graph.)