I need to color polygons in different colors, ensuring that polygons sharing boundaries do not have the same color (the well-known four color theorem).
Is there a way to do that using GeoTools?
I have an implementation that will colour most (some?) simpler maps with 5 colours, it turns out 4 colours is a very hard algorithm to understand so I skipped that and went with the simpler 5 colours. I also only implemented Rule 1 rather than the more complex rule 2 so it can only handle maps where there are polygons with fewer than 5 neighbours. This is true for all the polygon sets I've tested on, but your mileage may vary.