tree

Flex Tree Properties, Null Reference?

I am pulling down a large XML file and I have no control over it's structure. I used a custom function to use the tag name to view the tree structure as a flex tree, but then it breaks. I am guessing it has something to do with my other function, one that calls attribute values from the selected node. See code. <mx:Tree x="254" y...

Browse, Child Layout: Tree, Form or Both?

This is a UI paradigm question I think. How do you display Child information? Is the Browse a Tree? Do you have a Form (double-click on browse)? Or some other way, or amalgum of things? I'm having a discussion with a Trainer regarding the layout of a browse. They don't like the Tree (for displaying child records), but I'm not yet con...

Algorithm for Finding Redundant Edges in a Graph or Tree

Is there an established algorithm for finding redundant edges in a graph? For example, I'd like to find that a->d and a->e are redundant, and then get rid of them, like this: => Edit: Strilanc was nice enough to read my mind for me. "Redundant" was too strong of a word, since in the example above, neither a->b or a->c is considered ...

Total number of nodes in a tree data structure?

I have a tree data structure that is L levels deep each node has about N nodes. I want to work-out the total number of nodes in the tree. To do this (I think) I need to know what percentage of the nodes that will have children. What is the correct term for this ratio of leaf nodes to non-leaf nodes in N? What is the formula for working...

Pseudorandom directory tree generation?

I'm trying to write a program which will pseudorandomly autogenerate (based on a seed value so I can re-run the same test more than once) a growing directory structure consisting of files. (this is to stress test a source control database installation) I was wondering if any of you were aware of something similar to the quasirandom "spa...

About Trees and Prefix (Polish) Notation?

My MIPS Assembly class required me to read in an expression of unknown size into a Parse Tree. I've never had to deal with trees, so this is how I went around storing values: Lets say the user entered the expression 1 + 3 - 4 (each operand could only be a digit 1-9) My leftmost child node would be the starting point and contain 2 piec...

Counting nodes in a tree in Java

Hi, First of all, I swear this is not homework, it's a question I was asked in an interview. I think I made a mess of it (though I did realise the solution requires recursion). Here is the question: Implement the count() method which returns the number of nodes in a tree. If a node doesn't have either a left or right child, the relevan...

Trigerring a change event in a Flex tree control programatically

I have a method to add an XML node structure to the currenltly selected tree node. This appends the xml, and opens the parent node to display the newly added node. I then select the node by setting the selectedItem of the tree. I have an editing form that updates its values on the tree change event. When I set the selectedItem in th...

Flex - How to get Tree itemClick event to mimic itemOpen event?

I am using a Tree control with an XMLListContainer dataProvider.... I use an itemOpen event with the following code to update another data provider when a tree folder is opened (using small triangle) - the data provider contains all the <slide /> elements in that particular tree folder... private function itemOpenEvent(event:TreeEvent):...

Graph visualisation in Silverlight

I have a data structure that represents a directed graph and I'm looking for a good Silverlight visualisation to allow me to navigate from node to node, preferably with some nice animation. Does anyone know of any good UI controls or frameworks for this kind of display? Even a sample from another field (maybe a social network?). My grap...

Tree construction from an ordered list

In java, im creating a SortedSet from a list which is always going to be ordered (but is only of type ArrayList). I figure adding them one by one is going to have pretty poor performance (in the case for example of an AVL tree), as it will have to reorder the tree a lot. my question is, how should i be creating this set? in a way that ...

Preorder tree traversal copy folder. [CLOSED]

Hi, We have a database that contains several Trees. These trees are build using the "Preorder tree traversal" principle. This is a very powerful way of creating trees but it has one big disadvantage, adding multiple nodes at once. We have to create a copy function in our tree, copying a single (lowest level) node is very easy, you can...

Building a tree in Java

I'm a newbie in Java. I want to build a tree with one root node and multiple children nodes with some weight on each branch. Can somebody help me in this. ...

CRUD scaffolding and trees

Every time you read the introduction to an MVC web framework, you meet the same things: just describe your data classes and viola - you get auto generated administrative interface. Even Microsoft finally released its Dynamic Data. In general, that's great. I was making (simple) sites for a couple of years and CRUD was all the customer w...

Real world examples of tree structures

I'm looking for some examples of tree structures that are used in commercial/free software projects, modern or old. I can see examples on wikipedia, but I am looking for more concrete examples and how they're used. For example primary keys in databases are (from what I've read) stored in BST structure or a variation of the BST (feel free...

Easy way to find Subtree in a Tree

I'm writing some code that uses a Tree (a regular tree that can have an unlimited number of nodes, but no crossover, i.e. two parent nodes will not point the the same child node). Anyway, two things: 1) Are there any well-known algorithms for finding a sub-tree within a tree. 2) Are there any Java libraries (or any libraries for that ...

PostgreSQL - tree organization

I'm working on a project wich requires a tree of categories, organized as id, parent, title table. Which are the best ways to retrieve category and its subcategories(and a full tree, if root categories have parent=0) in Postgres? I'm looking for a pure database solution, but if there is a way for Ruby and PHP - it will be great too. The...

Regular expression (glob) search tree

Anyone know how one might adapt a search tree to handle limited regular expressions? The task is, given a file name, find all nodes matching that file name. Nodes may contain usual file name globs (* and ?). Obviously, since this is a search tree, speed is of the essence. EDIT: I should add that the most important case for speed is the ...

Is PostgreSQL's Ltree module a good fit for threaded comments?

I'm considering using PostgreSQL's Ltree module in my application to help with threaded comments. I've been eying it for a while to use for threaded comments. I figure it would help with cases where you need to update a node and its children, like when you want to hide a comment and its replies. I'm thinking ltree (or something like...

Django MPTT - tree filtering

I am using MPTT's templatetag to render my genre tree. {% for genre, structure in genres|tree_info %} {% if tree.new_level %}<ul><li>{% else %}</li><li>{% endif %} {{ genre.name }} {% for level in tree.closed_levels %}</li></ul>{% endfor %} {% endfor %} The thing is, my genre object has is_visible property w...