Skip to content

akleemans/fourcolors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fourcolors

An visual demonstration of the four color theorem / map solver, powered by ProcessingJS.

For more information and a demo see this blog post.

graph coloring

How it works

The algorithm in action:

graph coloring

First, the user draws on the canvas. Once finished, the process could be as follows:

  1. Find areas/nodes using flood fill (BFS)
  2. Find neighbors/edges using "marginal points" for each area and comparing distances
  3. Build inner graph representation
  4. Solve graph with Welsh-Powell and if this fails, try backtracking
  5. Display results on canvas