Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: [X] Tree/Graph structure in many-to-many relationship, avoiding/detecting circularity

Re: [X] Tree/Graph structure in many-to-many relationship, avoiding/detecting circularity

From: OddesE <OddesE_XYZ_at_hotmail.com>
Date: Mon, 4 Mar 2002 13:43:43 +0100
Message-ID: <a5vq60$3ns$1@news.hccnet.nl>


"Kendall" <kendallwillets_at_yahoooooo.com> wrote in message news:u7vjq5b5mqg189_at_news.supernews.com...
> In article <a5nh7d$hj8$1_at_news.hccnet.nl>, "OddesE"
> <OddesE_XYZ_at_hotmail.com> wrote:
>
> That's a familiar problem. One way to find the circuits is to build the
> transitive closure and look for nodes which have themselves as
> descendants. That's the method I've used in the past.
>
> I put a conceptual version of the code for transitive closure up at
> http://willets.org/tc.sql. I may clean it up soon and convert it to
> PL/SQL. It's based on Warshall's algorithm. Sorry if the code is dense.
>
> Good luck,
>
>
> Kendall

Thank you very much Kendall.
I have looked at the code but I dont really understand it. Could you tell me something more. What are transitive closures? English is not my native tongue, so excuse me if I ask something that I should know.
What about the situation when circularity already exists? I tried this:

From a root, Recursively examine each of it's children. When examining a child, recursively examine each of it's parents to see if one of them has an equal ID as the current node. If Yes, you detected circularity.

The problem is that each node can have multiple parents, so you may go up over another path then you used to go down. If such a path is circular, you end up in a eternal loop again. Consider that the data probably already contains circularity to begin with.

Will your code be able to deal with this situation too?

--
Stijn
OddesE_XYZ_at_hotmail.com
http://OddesE.cjb.net
________________________________________________________
Please remove _XYZ from my address when replying by mail
Received on Mon Mar 04 2002 - 06:43:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US