Re: Nested set model for graphs
Date: 19 Feb 2002 14:03:04 -0800
Message-ID: <c0d87ec0.0202191403.29aaef71_at_posting.google.com>
>> It is possible to use the nested set model for graphs of any kind.
Hint : for graphs that aren't trees, a node can have more than just
one interval <<
Let me if you find something, let me know.
When I have to model a general graph, I fall back to the adjacency list model or the adjacency array model. If the graph is a lattice (is that the right term?), then I can decompose it into a tree with repeated nodes.
I like the adjacency array model because I can convert it easily into an adjacency list model. But you get a very wide table for a real graph...
CREATE TABLE Graph
(node CHAR(5) NOT NULL PRIMARY KEY,
node_nbr INTEGER NOT NULL
CHECK (node_nbr BETWEEN 1 AND nn), n1 INTEGER NOT NULL DEFAULT 0
CHECK (n1 IN (0,1)),
n2 INTEGER NOT NULL DEFAULT 0
CHECK (n2 IN (0,1)),
...
nn INTEGER NOT NULL DEFAULT 0
CHECK (nn IN (0,1))); Received on Tue Feb 19 2002 - 23:03:04 CET