Four Color Theorem in Grasshopper

Here a new version of n Color of faces with non similar color for adjacent faces. I add some improvements. And it seems to give good agreement for most of the uses. it no more uses SandBox.
So the script needs :

  1. Face-Face topology so it could be brep topology or mesh topology or whatever…
  2. Seed : a seed that is useful to change the patterns
  3. A number of color wanted (lowest possible =2), but with autonoumous mode the number of color will be augmented if no solutions found
  4. nextColorNotRandom, if true the next color choosen is not a random one but the lowest color number possible
  5. if autonomous set to true, the script try to find the best solution, augment the number of color if needed, change nextColorNotRandom if needed, could be stopped by using Escape touch.

I put some examples. All are solved in reasonable time. Time will surely be very long for a big number of faces or with things like a mesh cube.
The cube (here just 3 faces) is long if you ask for 2 colors, because it makes many tests with 2 colors. If you put 3 colors it is OK



Pentagons is now OK with 3 colors

Hope it is clear and useful.

nColors_Legacy.gh (260.2 KB)

10 Likes