tree

C# tree/collection algorithm

I need to fill a tree-like UI control with some items (of course in parent-child1-child2-...childN relations) and before proceeding I want to ensure that the my collection that holds the content is ordered properly as follows: Each object(in this case an instance of my Category class) from my collection (ObservableCollection that is not...

MySQL: Move node in nested set

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...

Code Separation Paradox: Create HTML Tree from Multi-Dimensional Array AND Keep the HTML Outside of the Recursive Function

This working code seems to be the typical solution to this problem. It takes a multi-dimensional array that holds categories and their subcategories (with no implied limitation on how many levels deep it goes) and creates an HTML unordered list from it, echoing it out onto the page from inside a recursive function. Sub-levels are trave...

how to wordwrap in flex tree node

I have a Tree object in my Flex code. It's width is 100%, and it is contained by a Panel with width=200. I am using a custom itemrenderer that extends TreeItemRenderer. I need the text in each node to word wrap if it's too big (as happens often). I have tried label.wordWrap = true; in my item renderer without any luck. Any other sugg...

Red Black Tree <Black Height> (Redraft)

/** The following function checks the red black tree black height * @param n the root node is inputed then a traversal is done to calculate the black-height * @return Return an error message / mesages informing the user whether or not the black height was maintained * @author Ferron Smith */ public static void getCount (SkaRedBlackTreeN...

m-estimate for continuous values

I'm building a custom regression tree and want to use m-estimate for pruning. Does anyone know how to calculate that. http://www.ailab.si/blaz/predavanja/UISP/slides/uisp07-RegTrees.ppt might help (slide 12, how should Em look like?) ...

Are there any tools to find duplicate sections in a tree data structure?

I'm looking for a tool that finds duplicate nodes in a tree data structure (using Freemind to map the data structure, but I'll settle for anything I can export a generic data tree out too...) The idea is that I can break the tree down into modules which I can repeat thus simplifying the structure of the tree. ...

mysql "with rollup" query morphed into a tree structure

Background: I have this "with rollup" query defined in MySQL: SELECT case TRIM(company) when 'apple' THEN 'AAPL' when 'microsoft' THEN 'MSFT' else '__xx__' END as company ,case TRIM(division) when 'hardware' THEN Trim(division) ...

What is a good algorithm for getting the minimum vertex cover of a tree?

What is a good algorithm for getting the minimum vertex cover of a tree? INPUT: The node's neighbours. OUTPUT: The minimum number of vertices. ...

Tree Datastructures

I've tried to understand what sorted trees are and binary trees and avl and and and ... I'm still not sure, what makes a sorted tree sorted? And what is the complexity (Big-Oh) between searching in a sorted and searching in an unsorted tree? Hope you can help me. ...

Database Structure for Tree Data Structure

What would be the best way to implement a customizable (meaning, a tree structure with an unknown number of level) tree data structure in a database? I've done this once before using a table with a foreign key to itself. What other implementations could you see, and does this implementation make sense? ...

Any references on how to implement quadtrees with periodic limits?

Hi all, I have spatial data - (x, y) points on a plane - which I'm partitioning using quadtrees. The idea is to find which points are neighbors to a given (a, b) point. The points are neighbors if there some (say L) distance between the two. The problem is that the space is periodic, that is if a point is very close to the edge (< L) th...

How do I present a tree in an HTML table?

I'm trying to show a tree structure in an HTML table. It's basically a list of people you referred to a site, but you can expand each and see the people they referred too (only 2 or 3 levels). I'm also showing a number of pieces of information on each person, so I'm using a table, with several columns. I'm wondering what's the best way ...

What is the name of this type of directed acyclic graph?

Perhaps it isnt even a DAG, but as its naming im after i wasnt sure what title to give this... What is the name of a data structure where every node can only have 0 or 1 paths INTO it? Strictly, is this a tree? Thanks ...

Efficient query to get all child nodes of a tree (mysql)

I'm looking for an efficient query to return the child nodes of a tree . The data structure is: `ct_cid` int(10) unsigned NOT NULL default '0', // the data `ct_level` int(10) unsigned NOT NULL default '0', // the level (0 = topmost) `ct_parent` int(10) unsigned NOT NULL default '0', // parent ct_cid I need to make sure there won...

Children or Parent based Tree Structure

I'm developing a class that will be used to generate a tree structure. Each Node of the tree needs to know both who it's parent is and who it's children are. The fields used to track each Nodes parent and children are not accessible outside the base Node class. Right now I have methods for AddChild, and Remove child. Which consequently...

Size of a dictionary

I am currently designing a website in C#, which uses some very complex code to generate a search list, which I am currently designing as a Tree-like structure. The main reason I am using a tree is the fact that this website is high-traffic and has a very complex search filter, which means scalability is very important, however I am worr...

Is it true that the paragraph in Tree Menu of MSDN library is store in the database?

Hello guys, I was assigned to develop a website looks similar to MSDN Library. According to MSDN Library, I have sense that their tree menu is updated in the database. They are not fixed like others Javascript tree menu. But I am not sure, I just have doubt, is it true that the paragraph in Tree Menu of MSDN library is store in the dat...

Trigger to prevent infinite loop in a sql tree

I have node table with (NodeId, NodeName) and structure table (ParentNodeId, ChildNodeId). How can I write a trigger that check if an insert update or delete statement can cause infinite relation? ...

Modified preorder traversal for comment system

Hi, I'm trying to make a comments system for a blog. I have the modified preorder traversal system working (used this guide: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html). I have a few issues though. I do not think that guide explains how to manage having different blog posts, and adding a comment that is not a re...