I wonder if anyone can point me to an algorithm for the following problem:
We have a graph G of N nodes. Edges between nodes define whether the two nodes are compatible, this is, can be merged. Compatibility for this problem is not transitive.
Each node also has a cost. The interesting thing about this problem is that when two nodes are merged their costs do not necessarily add. It might be the case that cost (ab) < cost(a) + cost(b). I don’t think that cost (ab) is ever > (cost(a) + cost(b)) but I’m not absolutely positive,
Though they cannot be merged, the costs of two incompatible sets of merged nodes A and B is cost(A) + cost (B)
The goal is to find the minimal cost merging of all nodes.
This is not quite bin packing, since we do not have fixed costs bins. I have found a bin packing algorithm that claims it handles conflicts, but the conflicts are transitive. It is not quite graph coloring either, because of the lack of transitivity.
I’d be happy with a heuristic - I’m not looking for optimality. My first thought is this:
Label each edge with a weight consisting of the increase in cost if nodes a and b connected by that edge are merged. (based on the greatest cost node.)
Find all edges with minimal cost. Merge the two nodes (if there is a choice) with maximum edges.
Recompute the edges if the merged node, removing those for nodes with which there is now a conflict. Also recompute node counts for all connected nodes, and the weight growth metric for all the edges still associated with the merged node.
Repeat until there are no more edges. The total cost is the sum of the costs of these nodes.
This seems fairly simplistic though - anyone have anything better?