- #1
SamTsui86
- 31
- 0
Homework Statement
I need to calculate the relative error of the nearest neighbor algorithm. The book says it is the difference between the worst and nearest neighbor solution to the nearest neighbor solution. Does the mean that for example I have CITY A, find the fastest way to back to city A while reaching all the vertex and find the longest way back to city A while reaching all the vertex. Then I take the difference and divide it by the shortest way?
Can anyone explain how to do the cheapest link algorithm:
My professor told me is
1) Pick the link with the smallest weight
2) Pick the next cheapest link
3) Contine picking the cheapest link availabe
4) Close the circuit
I am very confuse with his step, how do I close the link? How is that different from the nearest neighbor algorithm??
Thank You