Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Graph Schema

Re: Graph Schema

From: <barias_at_axiscode.com>
Date: 13 Nov 2006 10:09:36 -0800
Message-ID: <1163441376.287195.213490@h54g2000cwb.googlegroups.com>


Neo wrote:
> > ... a graph (as in graph theory, nodes and edges), when represented recursively in a schema ...
>
> What does this mean? Suppose we start with N1 connected to N2 by E1.
> How do I represent this recursively in a schema?

The nodes live in a table called "Node". The edges live in a table called "Dependency." Table Node has a 1 to many relationship with table Dependency. Table Dependency, in turn, has a 1 to many relationship with Node. Thus, two of the columns in table Dependency are actually just the primary key of Node. These "NodeID" pairings represent the "edges" of the graph.

This way, with a single select statement, you can find out that N1 is connected to N2, N3, and N4. Then you can use the values N2, N3, and N4 in seperate select statements to discover what they in turn are connected to (such as N2 being connected to N3 and N9). But this is recursive ("so called"), because you just keep sending out the select statements every time you want to "step" from one node to another. Or if you prefer, call it an "iterative" graph rather than "recursive," since you could do a non-recursive loop to walk from node to node in this fashion. Received on Mon Nov 13 2006 - 12:09:36 CST

Original text of this message

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