Reputation: 11369
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 :)
Upvotes: 0
Views: 1649
Reputation: 26300
Will this help What would be a good algorithm for a circular reference check in this case? ?
Upvotes: 1