Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertex-Coloring/Assignment to minimize the number of "color crossings"

I am not sure if this is really a "coloring" problem as much as it is an assignment/linear-programming problem. I have zero expertise in either, so pardon any noob-ness that might follow. But I get the feeling that this problem must have almost definitely been solved/investigated before, I just couldnt find anything after looking through many of the graph algorithms on http://en.wikipedia.org/wiki/Category:Graph_algorithms . I was hoping to get some pointers in the right direction.

The "problem-statement" effectively boils down to :

  1. There are two types of vertices in the graph : routers and cores.

  2. Cores are connected to routers ONLY. Each core is connected only to a SINGLE router. And each has a user-inputed/defined "color". (In my specific problem the color is limited to one of say 4/5 possible colors). Their color cannot be changed, it is an input parameter. (Cores are the squares in the image below)

  3. Routers are connected to cores as well as other routers. They do not have a "color" assigned to them. Assigning a color is part of the objective of the program/algorithm. (Routers are the circular vertices in the image below.)

  4. The objective of the program is to assign colors to each router in the graph such that the number of "crossings"/edges between vertices of a different colors are minimized.

(An alternative view : In essence you are given a graph where some vertices are colored, others are not. The objective is to color the ones that are not such that the number of edges between vertices of different color is minimized.)

I was able to formulate this (quite poorly I am sure) as an Integer-Linear-Program and have setup a solution/approach using LP-Solve. I also have a heuristic of my own. I would love to know the "proper"/known/other approaches towards solving this?!

Many Thanks!

Trivial example for demonstration.

like image 816
ryecatcher Avatar asked May 25 '12 00:05

ryecatcher


People also ask

What is the smallest number of colors that can be used for coloring a graph?

Definition 16 (Chromatic Number). The chromatic number of a graph is the minimum number of colors in a proper coloring of that graph.

What is a proper vertex coloring?

Painting all the vertices of a graph with colors such that no two adjacent vertices have the same color is called the proper coloring(or sometimes simply coloring) of a graph and a coloring using at most k colors is called a (proper) k-vertex coloring of a graph.

What is the term used to the minimum number of colors needed to color a graph for the purpose that no edge will connect vertices of the SME color?

The smallest number of colors needed to color a graph G is called its chromatic number, and is often denoted χ(G).

How many unique Colours will be required for a proper vertex Colouring of an empty graph having n vertices?

How many unique colors will be required for proper vertex coloring of an empty graph having n vertices? Explanation: An empty graph is a graph without any edges. So the number of unique colors required for proper coloring of the graph will be 1.

What is a method to assign colors to the vertices of a graph so that no two adjacent vertices have the same color?

Graph coloring is the procedure of assignment of colors to each vertex of a graph G such that no adjacent vertices get same color. The objective is to minimize the number of colors while coloring a graph. The smallest number of colors required to color a graph G is called its chromatic number of that graph.


1 Answers

Let's start by focusing on the case with two colors. We can turn this into an instance of s-t min cut. The idea is that we have designated an s node and a t node in a graph, and that we want to divide the remaining nodes into either the s group or the t group, such that the sum of the edge weights between the two groups is minimized. For your version, we have a master yellow node s and master red node t, and we place a high weighted edge exceeding the count of all edges in your original graph between each of the cores and their corresponding master color node, with all the original edges intact having weight 1 each. The high cost edges ensure that we will never illegally recolor any of the cores as it will be cheaper to move all of the routers. This problem can be solved in polynomial time using standard max flow algorithms via the Max flow-Min cut theorem. The best choice depends on your edge and vertex count.

In the case of multiple colors, you are trying to solve the "multiterminal cut" problem. This is related to the minimum k-cut problem, but the standard reference for this problem is the paper The Complexity of Multiterminal Cuts (which the k-cut article links to indirectly). For more than 2 colors, apparently if the graph is planar, the problem is still solvable in polynomial time; otherwise, it is NP-hard, so you might as well use your integer programming solver as this is another NP-hard problem.

like image 172
Martin Hock Avatar answered Sep 25 '22 15:09

Martin Hock