| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: modeling a network in an rdbms
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:
-- Greetings from Troels ArvinReceived on Thu Nov 10 2005 - 13:49:26 CST
![]() |
![]() |