how to represent being minimum spanning tree in linear programming constrains?

女生的网名这么多〃 提交于 2019-12-12 05:27:13

问题


suppose we are given a weighted graph G and a spanning tree T of it.we want to change weights of edges so that T be a minimum spanning tree and sum of all |w_i - w'_i| be minimum where w_i is the weight of edge i_th and w'_i is the weight of edge i_th after changing it.

I think it's obvious our goal is to minimize sum of |w_i - w'_i| for all i and our variables are w'_i but i can't find how to represent T is minimum spanning tree in constrains.


回答1:


For each i such that the ith edge is not in T, for each j such that the jth edge lies on the unique path in T from one endpoint of the ith edge to the other, there is a constraint wi' - wj' ≥ 0.




回答2:


You could use a modified version of Prim's algorithm.

This algorithm builds up a connected component, at each point adding the edge with lowest weight from the component to a vertex outside the component.

Note that at each stage there will be exactly one edge (call it e) in your original spanning tree that connects the component to a vertex outside the component, but there may be additional edges in the graph.

You can examine all the potential edges (from the component to outside the component) and compute the minimum weight. Then you need to change edge e from having its original weight to having the computed minimum weight.

You can then add edge e to the component and repeat until you have computed the minimal spanning tree using all of the original spanning tree edges.



来源:https://stackoverflow.com/questions/27562235/how-to-represent-being-minimum-spanning-tree-in-linear-programming-constrains

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!