I'm looking for a PHP (with MYSQL) nested sets class with all needed functions.
For example:
createLeftNode, createRightNode,createRootNode, createSubNode,deleteNode and moveTree. Not only 1 left, 1 right, 1 up and 1 down but also a part of a tree in a nother tree.
Thanks!
...
I'm storing a tree in a DB using nested sets. The table's fields are id, lft, rgt, and name.
Given a node ID, I need to find all of its direct children(not grandchildren) that are themselves leaf nodes.
...
I have a list of items in a hierarchy, and I'm attempting to parse this list out into an actual hierarchy of objects. I'm using modified pre-order tree traversal to store/iterate through this list, and so what I have is a subset of the tree, including all children, ordered by their "left" value.
For example, given the tree:
Item A
It...
Among the known limitations of Joe Celko's nested sets (modified pre-order traversal) is marked degredation in performance as the tree grows to a large size.
Vadim Tropashko proposed nested intervals, and provides examples and theory explanation in this paper: http://arxiv.org/html/cs.DB/0401014
Is this a viable solution, are there any...
Hey All,
Im building a Threaded Comment System for a website of mine and I ran into a problem...
I have a list PULLED FROM A DATABASE that has a ID field and a Parent ID Field. The parent ID field can be null, but the ID field will NEVER be null.
Since this will be a threaded comment system, I organize the list to where the ID is the...
Hi,
I have a set of objects in a hierachy. There's a top "root" node and that has child nodes, which in turn have child nodes etc. I'm trying to save this structure into a DB using the nested set model, where each "side" of each node is numbered to define the hierarchy, as in:
http://dev.mysql.com/tech-resources/articles/hierarchical...
I'm using nested sets (aka modified preorder tree traversal) to store a list of groups, and I'm trying to find a quick way to generate breadcrumbs (as a string, not a table) for ALL of the groups at once. My data is also stored using the adjacency list model (there are triggers to keep the two in sync).
So for example:
ID Name Par...
I've been implementing some nice interactive interfaces that can sort lists in my m rails app for models that use acts_as_list. I have a sort function that gets called and sets the position for each record afterr each drag and drop using the sortable_element script.aculo.us function.
This is an example of the controller action that han...
I am using "acts_as_nested_set" in my rails app. (extended with awesome nested set plugin). I was trying to logic out the best way to write a function/method to clone an element and its entire nested set so that each element gets a clone but the relationship structure mimicks the original, just with the new elements.
With nested sets y...
We're currently building a website with a categorized MySQL table containing various competences, and we noticed that the nested set model would be optimized for this. Although, we've got a pretty serious problem - the nested set model doesn't allow any sorting, and we really need that possibility.
I'd like the output data to be array(id...
I've got an array with data from a MySQL table in nested set model I'd like to get sorted, not only alphabetical but also with the child nodes directly after the parent node.
Example - array to be sorted (before the sorting):
Array
(
[0] => Array
(
[id] => 1
[name] => Kompetenser
[parent] ...
I'd need a MySQL query that moves a node and all it's children within a nested set. I found this site, but that function just seems so illogical - there's no universeid or treeid in a nested set model, and the code itself it just longer than what feels required. The only extra column I've got in the table is "parent".
I couldn't just re...
I'm trying to tie django-mptt and contrib.admin together by providing something friendlier than a flat list in the admin. Because the trees are supposed to be large (otherwise i wouldn't be using nested sets), users should be able to expand and collapse parts of it.
When a user expands or collapses or expands a branch (ajax is used for...
I am creating a Category model and using the awesome_nested_set plugin (a replacement for acts_as_nested_set) to deal with the hierarchy. With awesome_nested_set, objects are created, then saved, and then placed within the set. As well, lft, rgt and parent_id are attr_protected so they cannot be written to directly.
I am running into tw...
I am trying to build a dynamic menu in my PHP CMS; the pages/categories are organized using the nested sets model.
Full tree:
root
A
B
B1
B1.1
B1.2
B2
B2.1
B2.1
C
C1
C2
C3
D
I want to convert this result set to an unordererd list, which only displays a part of the tree.
For example:
If I click on B, I want...
I've been thinking about the modified preorder tree traversal algorithm for storing trees within a flat table (such as SQL).
One property I dislike about the standard approach is that to insert a node you
have to touch (on average) N/2 of the nodes (everything with left or right higher than the insert point).
The implementations I've...
I have a number of distinct items stored in different MySQL tables, which I'd like to put in a tree hierarchy. Using the adjacency list model, I can add a parent_id field to each table and link the tables using a foreign key relationship.
However, I'd like to use a nested sets/modified preorder tree traversal model. The data will be use...
Given that I have this resultset structure (superfluous fields have been stripped)
Id | ParentId | Name | Depth
----------------------------
is it possible to have the records returned in tree order i.e. Parent then Children, if a Child is a Parent, then their Children, if not then Sibling, etc? For example,
Id | ParentId | Name | De...
How should new nodes be added with SQLAlchemy to a tree implemented using the Nested Set Model?
class Category(Base):
__tablename__ = 'categories'
id = Column(Integer, primary_key=True)
name = Column(String(128), nullable=False)
lft = Column(Integer, nullable=False, unique=True)
rgt = Column(Integer, nullable=False,...
I've got a MySQL table that acts like a nested set in order to contain a hierarchy of categories. The table schema looks like:
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(200) NOT NULL,
`parent_id` int(11) default NULL,
`lft` int(11) default NULL,
`rgt` int(11) default NULL,
...