Re: modeling a network in an rdbms
From: Troels Arvin <troels_at_arvin.dk>
Date: Thu, 10 Nov 2005 20:49:26 +0100
Message-ID: <pan.2005.11.10.19.49.25.665311_at_arvin.dk>
Date: Thu, 10 Nov 2005 20:49:26 +0100
Message-ID: <pan.2005.11.10.19.49.25.665311_at_arvin.dk>
On Thu, 10 Nov 2005 06:01:22 -0800, TrueBlue wrote:
> I'm having a tough time finding a simple answer to this conundrum.
> I have an RDBMS, no technology change allowed. Can anyone suggest a
> relational model to structure a network? The key goal would be to draw
> n relationships between nodes in an ever-increasing node number.
Have a table with nodes:
CREATE TABLE node (node_id WHATEVERTYPE PRIMARY KEY,...);
CREATE TABLE edge
(
node1 WHATEVERTYPE REFERENCES node,
node2 WHATEVERTYPE REFERENCES node,
PRIMARY KEY(node1,node2)
);
If needed, you may add an optimization-table with pre-computed paths, i.e. a transitive closure table. Inspiration:
- http://www.godatabase.org/dev/database/
- http://citeseer.ist.psu.edu/dong99maintaining.html
- http://www.oreillynet.com/pub/a/network/2002/11/27/bioconf.html
-- Greetings from Troels ArvinReceived on Thu Nov 10 2005 - 20:49:26 CET