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: Carl Rosenberger <carl_at_db4o.com>
Date: Fri, 1 Mar 2002 12:37:40 +0100
Message-ID: <a5np4e$5u6$06$1@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
Received on Fri Mar 01 2002 - 05:37:40 CST

Original text of this message

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