The author of django-treebeard created the ns-tree implementation based on Joe Celko as SQAlchemy's [1].
Here is its implementation [2]. I hope that helps. [1] http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/nested_sets/nested_sets.py [2] http://code.google.com/p/django-treebeard/source/browse/trunk/treebeard/ns_tree.py On 18 ene, 18:47, Michael Bayer <mike...@zzzcomputing.com> wrote: > We have a proof of concept for nested sets in the /examples folder. > > However what I cant figure out with nested sets is, how do I load only > the immediate children of a node ? That is the most common accessor > I'd like on a self referential node and I'm not aware of how to do > it. It makes it sort of impossible for there to be a ".children" > accessor on a node, unless you load the full subtree and organize. > > On Jan 18, 2009, at 1:33 PM, Kless wrote: > > > > > SQA recommends the adjacency list pattern [1] over another patterns: > > > "Despite what many online articles say about modified preorder, the > > adjacency list model is probably the most appropriate pattern for the > > large majority of hierarchical storage needs, for reasons of > > concurrency, reduced complexity, and that modified preorder has little > > advantage over an application which can fully load subtrees into the > > application space." > > > But should be in mind that it's slow in reads (althought it's fast in > > writes). In change, the nested sets have very efficient reads at the > > cost of high maintenance on write/delete operations. > > > If any is interested in tree structures, there is an excelent > > implementation for django ORM, django-treebeard [2], which has > > included any benchmarks where you can see the reading differences > > between different structures. > > > [1]http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relatio... > > [2]http://code.google.com/p/django-treebeard/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---