title: Algorithm of finding the shortest way to pass all points in a graph
body: <p>I have a NxN table, let's say 5 times 5, in which given a point A at random position and unknown number of point Bs:</p>
  
  <pre><code>+---+---+---+---+---+
  | B |   |   |   |   |
  +---+---+---+---+---+
  |   | A |   |   | B |
  +---+---+---+---+---+
  |   |   | B |   |   |
  +---+---+---+---+---+
  |   |   |   | B |   |
  +---+---+---+---+---+
  | B |   |   | B |   |
  +---+---+---+---+---+
  </code></pre>
  
  <p>From point A, is there any way to find the shortest way to pass through all points B?</p>
  
  <p>The same question has been asked <a href="https://stackoverflow.com/questions/2501732/algorithm-shortest-path-between-all-points">here</a> and I've done several researches about the travelling salesman problem. However, the approach to the solution on graph and on a table-like is different, as I can't determine the length between 2 slots, and on this table-like graph, A can only move up/down/left/right. Also, wiki doesn't break down to details of how the algorithm works or how to translate it into programming rather than Math operations all the way. I am stuck and not sure where to move on now. Any advice is high appreciated. Please suggest me some solutions.</p>
  
  <p>EDIT: <em>Adrian Wragg suggested me to draw lines as distance, so 1 problem is done. I'm not sure how to solve the problem to exact steps, because all the resources I found (even in my language) is about theory with Math symbols. Too far to my knowledge.</em></p>
  
  <p>Tim.</p>