posted 17 years ago
hi everyone,
im currently working on minimal spanning tree style program. Im having a small but significant problem. Whenever my program selects a minimum edge, i add this edge to an array so that it cant be chosen again, however when i loop through on the second iteration, the program replaces this with the new minimum edge and so next time the minimum edge it finds is the same as the first time. Basically:
florida -- 312 -- orlando
texas -- 345 -- milwaukee
florida -- 312 -- orlando
texas -- 345 -- milwaukee etc etc etc.
Can anyone tell me how i can continually add the minimum edges to an array so that they all stay in it and stop the cycle occurring