title: Looking for an algorithm to find the shortest path
body: <p>Basically I have a graph with 12 nodes (representing cities) and 13 edges (representing routes). </p>
  
  <p><img src="https://i.stack.imgur.com/K2oHW.png" alt="enter image description here"></p>
  
  <p>Now let's say that (randomly) I have a plan for visiting n nodes, departing from a specific one (A). So (<code>having N &lt;= (12-1)</code>) and then come to the starting point.</p>
  
  <p>For what I've been looking, it seems almost like the <code>Traveling Salesman Problem</code> but with the difference that in my salesman doesn't necessarily needs to visit all nodes.</p>
  
  <p>What algorithm am I looking for?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Apparently this is not going to be a TSP, because TSP says that the graph must be closed and we go through every city (node) <strong>only</strong> once. In my case, it can cross a city more than once, if it makes the route shorter.</p>
  
  <p>A few more examples for what am I looking for:</p>
  
  <p>Example one:</p>
  
  <pre><code>Depart from: A
  Need to visit (B,D,E,L,G,J,K)
  Come back to: A
  </code></pre>
  
  <p>Example two:</p>
  
  <pre><code>Depart from: A
  Need to visit (B,C,D,G,H,I,J,K)
  Come back to: A
  </code></pre>
  
  <p>Rules:</p>
  
  <pre><code>- Get shortest path
  - No specific order
  - Can visit one node (city) more than once
  </code></pre>
  
  <p>Remember, this is for a project in C, so this is just pre-coding research.</p>