I'm working on a graph-coloring project using Java. I need to implement four different graph coloring algorithms using four-color theorem. I have a problem with one of the algorithms named few neighbors greedy algorithm.
I have a map which contains bunch of polygon objects (stored in an arraylist) in it. Also, I have a 2D boolean array that represents the adjacencies of different polygons.
I know the algorithm theoretically: I have a priorityqueue that stores my uncolored polygons. The order of the queue based on adjacency counts. If a polygon has few neighbors, it is considered better than a polygon which has a lot of neighbots. Anyway, the algorithm should repeatedly draw a polygon from the priorityqueue and attemp to color it based on its adjacencies.
Unfortunately, I have problems with the implementation part. I got the priorityqueue based on thie adjacency counts, but I have problems while assigning colors to those polygons. If is there anyone who worked on that kind of algorithms, or anyone with an idea, please share with me. I need some ideas to speed up the implementation part.
Thanks in advance.