Re: Adjacency list to Nested set model statement
From: Kendall <kendall_at_localhost.localdomain>
Date: Fri, 01 Mar 2002 00:07:20 -0800
Message-ID: <u7udlon7fqlqe0_at_news.supernews.com>
Date: Fri, 01 Mar 2002 00:07:20 -0800
Message-ID: <u7udlon7fqlqe0_at_news.supernews.com>
I've cleaned up the code and posted it at:
http://willets.org/treecrawl.sql
It's now clean Oracle PL/SQL, and it works. I simplified it slightly to do only the DFS node numbering, but the rest is not hard.
One only needs a stack if a node can have multiple paths to it from root. In that case the stack is needed as a breadcrumb trail to ensure that backtracking goes back the way it came. In a single-parent tree there's no ambiguity.
I have another idea for a more parallelizable algorithm based on some stuff I did a few years ago. I'll see if I can reconstitute the stuff I need to try that out. Received on Fri Mar 01 2002 - 09:07:20 CET