简体   繁体   English

找到使共享顶点颜色的边的权重总和最小化的图形着色

[英]Find graph colouring that minimises sum of weights of edges that share vertex colours

Suppose we have a weighted complete graph with n vertices.假设我们有一个带有 n 个顶点的加权完全图。 We want to colour each vertex one of k colours.我们想为每个顶点着色 k 种颜色。 The cost of any colouring is the sum of the weights of all edges that connect vertices of the same colour.任何着色的成本是连接相同颜色顶点的所有边的权重之和。

For my use case, n will be around 20-50.对于我的用例,n 将在 20-50 左右。 For k = 2, 3 brute force worked fine, but I would ideally like a solution for any k.对于 k = 2, 3 蛮力工作正常,但理想情况下我想要任何 k 的解决方案。 It is also the case that the graphs I'm dealing with have reasonable sparsity, but again, I would ideally like to solve the general case.我正在处理的图表也具有合理的稀疏性,但同样,我理想地希望解决一般情况。

A first start could be to throw this at a MIQP solver.第一个开始可能是把它扔给 MIQP 求解器。 It can be linearized into a MIP (that is what Cplex is doing automatically).它可以线性化为 MIP(这是 Cplex 自动执行的操作)。

min sum( (arcs(i,j),c), w(i,j)*x(i,c)*x(j,c))   (sum over all arcs i<j and colors c)
sum(c, x(i,c)) = 1 for all nodes i
x(i,c) in {0,1} 

With 50 nodes, weights 25% dense, k=5 it took me a couple of seconds to solve to optimality (but can be much more depending on the data; many zero weights makes the problem easier).有 50 个节点,权重 25% 密集,k=5,我花了几秒钟来解决最优问题(但可能更多取决于数据;许多零权重使问题更容易)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从加权图中选择边,这样每个顶点都是一个边的端点,并且边权重的总和被最小化 - Choose edges from weighted graph, such that each vertex is an endpoint of one edge, and the sum of edge weights is minimized 在有向无环图中,找到一条路径的权重是组成该路径的有向边的权重之和 - In Directed Acyclic graph, find the weight of a path is the sum of the weights of the directed edges comprising the path 将图划分为三顶点图,以使边缘权重之和最小 - Dividing a graph to triple-vertices graphs such the sum of weights of edges is minimized 找到一组要去除的边缘,以使每个顶点的度不超过K,并且使边缘权重的总和最大化 - Finding a set of edges to remove such that that the degree of each vertex is no more than K and the sum of edge weights is maximized 如何使用Java查找图的中心(顶点,该顶点与其他每个顶点相连,但边指向图的中心) - how to Find the center of graph (vertex, that is connected with every other vertex, but edges are directed to the center of graph) with java 如何找到某个顶点可到达的所有边的总权重? - How to find the sum weight of all edges reachable from some vertex? 如何在加权图中找到具有最大权重总和的路径? - How do I find the path with the biggest sum of weights in a weighted graph? 使用 PHP 从无向图中找到最大的权重总和 - Find largest sum of weights from an undirected graph using PHP Boost有向图:比较顶点的边 - Boost directed graph: comparing edges of a vertex 找出图中无用的边 - Find the Useless Edges in a Graph
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM