Re: matrix encoding IS adjacency list

From: vc <boston103_at_hotmail.com>
Date: 19 Sep 2005 13:04:08 -0700
Message-ID: <1127160248.902438.178520_at_g44g2000cwa.googlegroups.com>


Vadim Tropashko wrote:
> As it has been written elsewhere, Nested Intervals gradually evolved
> into matrix encoding. To summarize, each node of a tree is encoded with
> 4 integers, which translates into the following schema design:
>
> table MatrixTreeNodes (
> a11 integer,
> a12 integer,
> a21 integer,
> a22 integer
> );
>
> As the title of the message says, there is adjacency list relation
> hidden there!

It's not surprising since you maintain a sort of materialized path in every node containing pairs (parent, child), So given a path 1.2.3.4, in order to access the fifth sibling just use 1.2.3.5, that's all. Much simpler than the matrix encoding. Received on Mon Sep 19 2005 - 22:04:08 CEST

Original text of this message