Prev     Next
Turn the English into Code

       city    ---    Identified as a number - then can use the city identity to index into a row or a column of some structure.
       cables    ---    2D matrix - each row is a cable, columns are city 1, city 2, cost.
       solution    ---    2D matrix holding cables that will be a solution.
       n    ---    The number of cables.
Repeat:     for i=1:n ... end
Lowest cost cable:     cables = sortrows(cables, 3);
Does adding a cable...     if redundancy(cables(i,:))
Add a cable to solution:     addcable(cables(i,:));