title: Four Color Theorem
body: <p>I have been trying to write a code that would use the four color theorem to color regions defined by an adjacency matrix. An adjacency matrix would look like:</p>
  
  <pre><code>    A B C D
  
  A   0 1 0 1
  B   1 0 1 0
  C   0 1 0 1
  D   1 0 1 0
  </code></pre>
  
  <p>So for this example A is not adjacent to itself or C, but it is adjacent to B and D.</p>
  
  <p>The program I am writing has to use recursion and back-tracing to assign 4 colors (or less) to the defined regions.</p>
  
  <p>So far my algorithm is as follows:</p>
  
  <pre><code>global int[] colors = &lt;region one color,region two, region three, region four &gt;
  public static int color(row,column)
    if out of bounds ??
      loop(!colored)
      {
        case 1: are any adjacent regions this color? assign
        case 2: are any adjacent regions this color? assign.
        case 3: are any adjacent regions this color? assign.
        case 4: are any adjacent regions this color? assign.
        case 5: if nothing found, steal closest (in #) region's color and call method from there
    }
  </code></pre>
  
  <p>But I have a few questions:</p>
  
  <ol>
  <li>What would this method return?</li>
  <li>Would this work and have recursion/backtracing like it should?</li>
  <li>What would I output if the given row/column are out of bounds?</li>
  </ol>
  
  <p>Thank you!</p>