title: Finding shortest path in two dimensional array (Javascript)
body: <p>I am trying to implement an algorithm, that finds the shortest path in the following two dimensional array (from the top left corner, to the right bottom corner):</p>
  
  <pre><code>      [ [ 'A', 'A', 'A', 'B', 'A' ],
          [ 'B', 'B', 'B', 'B', 'B' ],
          [ 'A', 'B', 'A', 'A', 'A' ],
          [ 'A', 'B', 'B', 'B', 'B' ],
          [ 'A', 'A', 'A', 'A', 'A' ] ]
  </code></pre>
  
  <p>The rules are, that the path must alternate between A's and B's.</p>
  
  <p>The output must be a number specifying the smallest number of steps it will take to go through the array. (In the example the expected output is 13)</p>
  
  <p>Does anyone know of a simple Graph implementation that can help me solve this problem?</p>