shortest path tsp algorithm
<p>Now below is a dictonary, I am trying find the shortest path.we have to go to all 5 houses based on shortest time. Each key is a house, each list of values is the time in seconds. For example, the first house has a time of 0 because it's obvious, now from 1st house to second house has 74 seconds... and so on. Each index is a time represenation to the next house.</p>

<p>now second row, with 2 as key. from second house to first house it's 74 seconds, and now from 2nd house to third house it's 4069 seconds as show below. </p>

<p>I am trying to find the best algo for this i am confused what should i use? combinations? permutations?</p>

<p>The goal is to find the shortest path FROM house to house with represetation below and SUM of all time traveld in the shortest path you find</p>

<pre><code>list = 0, 74 , 2213, 816, 1172 ,
</code></pre>

<p>The shortest path.</p>

<pre><code>1 -&gt; 2 -&gt; 5 -&gt; 4 -&gt; 3 -&gt; 1 
</code></pre>

<p>WE HAVE to return to first house again thats why 1 is shown again </p>

<p>numbers 1 through 5, represents houses
list</p>

<ol>
<li><p>go through each key,value find the minimum and index of the min. Add the time to a time_list</p></li>
<li><p>access the next home(keys) with the index found in previous</p></li>
<li><p>match the index of min to the next home, in the home ignore zero and 
the times already encounters in previous home times</p></li>
</ol>