I ran into this problem. On an undirected graph, each node and edge has weight. All weights are non-negative. If S is specified, find the associated subgraph with the minimum sum of the weights of the edges, so that its sum of the weights of the node is at least S.
The most obvious solution is a brute force approach that takes into account all possible subgraphs. But the time complexity is exponential. Is there a better algorithm for this? My intuition is that we can convert node weights to edge weights, and then apply the spanning tree algorithm. But I could not solve it clearly. How to solve this problem?
EDIT: It looks like I was not clear enough about the description of the subgraph. The selected subgraph should be the only connected component. Hope this is clear now.
source share