[英]Choose edges from weighted graph, such that each vertex is an endpoint of one edge, and the sum of edge weights is minimized
For simplication, we can assume that the graph G=(V,E) has 2N vertexes and the answer has N edges. 为了简化起见,我们可以假设图G =(V,E)具有2N个顶点,并且答案具有N条边。
I have learned that if the graph is bipartite, Hungarian algorithm works well. 我了解到,如果该图是二分图,则匈牙利算法效果很好。 However, I wonder if there is any nontrivial solution(ie a polynomial one) for a general graph.
但是,我想知道一般图形是否存在非平凡的解(即多项式)。
Any polynomial solutions, as well as a proof of NP Complexity, are welcome. 欢迎使用任何多项式解以及NP复杂度的证明。
If you want every vertex be incident to exactly one edge, then you need to find perfect matching. 如果要使每个顶点恰好入射到一个边缘,则需要找到完美的匹配。 But perfect matching not always exists even for a graph with even number of vertices.
但是,即使对于具有偶数个顶点的图,也不总是存在完美匹配。
You can see example in this answer . 您可以在此答案中看到示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.