views:

146

answers:

1

I have an excel like grid where values can be typed referencing other rows

To check for circular references when a new value is entered, i traverse the tree and create a list of values referenced thus far, if the current value is found in this list, i return an error thus avoiding a circular reference. This is infrequent enough where extreme performance is not an issue but...

Question - is there a better way ? I'm told it's not the most optimal but no answer was provided so on to the experts @ SO :)

+1  A: 

Will this help http://stackoverflow.com/questions/428267/what-would-be-a-good-algorithm-for-a-circular-reference-check-in-this-case ?

zespri
hmmm, it might if only i can find my reference books :) thanks, will take a look, might take a while though !
Kumar