Re: Graph Schema

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Mon, 13 Nov 2006 18:35:09 GMT
Message-ID: <xV26h.18648$cz.299815_at_ursa-nb00s0.nbnet.nb.ca>


barias_at_axiscode.com wrote:

> 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.

Neo is a crank. You can safely ignore him.

> 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.

I suggest you investigate transitive closures. Received on Mon Nov 13 2006 - 19:35:09 CET

Original text of this message