title: Shortest path in a matrix
body: <p>I am a bit confused, i have following pattern</p>
  
  <pre><code>S...*...
  ....*.....
  **...**.
  .G1....*.
  ........
  ...G2**..
  ........
  ....*.G3D
  </code></pre>
  
  <p>meaning of legends are as follows</p>
  
  <pre><code>S = source 
  D = Destination 
  G = point to be visited before reaching destination
  . = paths 
  * = blocked path
  </code></pre>
  
  <p>Will this approach give me the shortest path?</p>
  
  <pre><code>Distance = Min((S,G1) (S,G2) (S,G3))  
  Distance = Distance + Min((G1,G2) (G1,G3))  // Assuming that G1 is shortest  
  Distance = Distance + Distance(G3 , D)
  </code></pre>
  
  <p>G points can be randomly distributed  and i am using BFS</p>
  
  <p>G&lt;15 and matrix &lt;= 100x100</p>