It's pretty straightforward to keep a list of objects you have visited while recursively traversing a superior chain. If an object is seen more than once, there is a circle. Should be easy to do