Dear list,

I have a (small) directed graph which I would be able to fins all
ancestors or descendents of a certain vertex (transitive closure?).
So, using this graph:

CREATE TABLE levels_levels (parent_id INTEGER ,child_id INTEGER,
UNIQUE(parent_id, child_id));
INSERT INTO "levels_levels" VALUES(6,7);
INSERT INTO "levels_levels" VALUES(6,8);
INSERT INTO "levels_levels" VALUES(8,9);
INSERT INTO "levels_levels" VALUES(7,10);
INSERT INTO "levels_levels" VALUES(9,10);

which would look like this:

 6
7 8
|  9
10

I would like to make it possible to find 10 as a descendent of 8 and 6
as a parent of 9 (for instance).

I have found a couple of procedural solutions using procedural calls
in sql server or postgresql, but is there a solution that I could get
into sqlite?

The graph will never be very big, updating efficiency is not an
important factor. It will be queried a lot though, so search
efficiency is important.

/Fredrik

-- 
"Life is like a trumpet - if you don't put anything into it, you don't
get anything out of it."
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to