I hava data in an Oracle table that is organized as a graph that can contain cycles (see example).
CREATE TABLE T (parent INTEGER, child INTEGER)
I have not worked with this myself, but what about a CONNECT BY with the NOCYCLE option? That should stop travering the tree when it sees a loop. Oracle 11i definitely has that, I think it came in somewhere in the Oracle 10g period.