TSP(G,s)
- l ← ∞
- for each permutation P of V starting at vertex s do
- append s to P
- w = COMPUTE_COST(P)
- if w < l then
- l ← w
- R ← P
- return R
f(sa)-f(s*) e(sa) = ------------ f(s*)
NEAREST_NEIGHBOR_TSP(G=(V,E))
- Select a starting city at random
- while not all u ∈ V have been visited do
- select the least cost path out of the last vertex which does not lead to a selected city.
- add in the path from the last city to the start.
MHA_TSP(G=(V,E))
- Add all edges to the min-heap H
- count ← 0
- T ← {}, P ← {}
- while count < |V| do
- e=(u,v) ← H.Extract_Min()
- if u ∉ P or v ∉ P do
- add e to T
- if u ∉ P then
- add u to P
- if v ∉ P then
- add p to P
- Find u ∈ P and v∈ P such that each vertex appears in T only once
- Add (u,v) to T
- return T