I have the following problem: There are points (P0…P6) on the plane, and I have a need to find the shortest cyclic path connecting them. What I have found, this is the classical Travelling Salesman Problem. But how do I solve it in Python? (The amount of points is supposed to be something about [3…12])

By now I have got it this far:

```
import math
def dist(a,b):
(x1,y1) = a
(x2,y2) = b
return math.sqrt((x2-x1)**2+(y2-y1)**2)
points=[(0.0,0.0),(2.0,4.0),(4.0,1.0),(3.0,6.0),(7.0,4.0),(6.0,0.0)]
w={}
for i in range(len(points)):
for j in range(i,len(points)):
w[i,j]=w[j,i]=dist(points[i],points[j])
print w
```