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: Fri, 1 Mar 2002 13:39:29 +0100
Message-ID: <a5nsq2$2a8$1@news.hccnet.nl>


"Carl Rosenberger" <carl_at_db4o.com> wrote in message news:a5np4e$5u6$06$1_at_news.t-online.com...
> OddesE wrote:
> > 1) Is it possible to create an algorithm to detect
> > this circularity? I have tried running recursively
> > back up to the root to check parents for duplicates
> > but so far haven't been succesful. Is there anyone
> > on these groups that has experience with this?
>
> The simple solution:
> Store the IDs of your added nodes in another datastructure
> and search this structure for the ID before you add
> a node.
>
> Storing the IDs to a balanced BTree should be the fastest
> method but even an array will do.
>
>
> Kind regards,
> Carl
> ---
> Carl Rosenberger
> db4o - database for objects - http://www.db4o.com
>

Thanks Carl for your quick response.
Could you eloborate on your answer some more? Because I don't readily understand what you mean. Assuming I use a simple array, do you mean that, before storing a unit's ID in the tree I would run through the array to check if it wasn't already there, then store it and after storing the ID I would place that units ID in the array?
If so, then consider that I am talking about a graph, rather than a tree, where one unit can contain multiple other units, but can also be contained by multiple units, a many-to-many relationship. Look at the example tree:

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

Original text of this message

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