Re: What databases have taught me

From: Aloha Kakuikanu <aloha.kakuikanu_at_yahoo.com>
Date: 25 Jun 2006 10:50:25 -0700
Message-ID: <1151257825.060167.245260_at_m73g2000cwd.googlegroups.com>


Dmitry A. Kazakov wrote:
> On 24 Jun 2006 08:26:15 -0700, Aloha Kakuikanu wrote:
> And, guys, what about presenting a query statement for building a dual
> graph?

What about it? It's rather easy.

table Nodes (

   node_id integer
)

table Edges (

   node1 integer,
   node2 integer
   --foreign keys to Nodes
)

table Faces (

   edge_id integer,
   node_id integer,
   --foreign keys to Nodes
)

Faces are needed, because specification consisting of the only Nodes and Edges defines planar graph ambiguously.

Example:
Nodes: {1,2,3,4,5}
Edges: {(1,2),(1,3),(2,3),(2,4),(3,5),(4,5)} defines 2 planar graphs -- one where the trianfle is inside the rectangle, and the other one where it's outside.

Next. Nodes in the dual graph are the faces of the original. Rather trivial query.

Edges in the dual graph are pairs of faces such that there are 2 common nodes which also belong to an edge. Rather easy query as well. Received on Sun Jun 25 2006 - 19:50:25 CEST

Original text of this message