tree

How to build nested menu "trees" in HAML

Hey there, I am trying to build a simple nested html menu using HAML and am not sure how to go about inserting the elements with the correct indentation, or the general best way to build nested trees. I would like to be able to do something like this, but infinitely deep: - categories.each_key do |category| %li.cat-item{:id => "ca...

Need to show a tree-like structure that can be dynamically (and infinitely) added to (java)?

Hello, I'm looking to build a tree-like structure for my Java application. I've tried using libraries such as Prefuse and Jung, but they do not seem to (easily, at least) allow me to dynamically expand the trees based on users' selections. For example, here is a starting tree: Branch Branch Root -> Branch B...

Which programming language presents a program as a tree?

I heard that a program can be presented as a tree. I also heard that there is a programming language whose syntax make this idea very clear. I mean that programs written in this language can be easily represented as a tree. Does anybody know what is the name of this language? ...

Insert element into a tree from a list in Standard ML

I have just started to learn SML on my own and get stuck with a question from the tutorial. Let say I have: tree data type datatype node of (tree*int*tree) | null insert function fun insert (newItem, null) = node (null, newItem, null) | insert (newItem, node (left, oldItem, right)) = if (newItem ...

PHP Moving mySQL Tree Node

I am having trouble trying to move sub nodes or parent nodes up or down... not that good at math. CREATE TABLE IF NOT EXISTS `pages` ( `page-id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, page-left mediumint(8) unsigned NOT NULL, page-right smallint(8) unsigned NOT NULL, page-title text NOT NULL, page-content te...

UVa #112 Tree Summing

I'm working on UVa #112 Tree Summing. I have what I think should be a working solution but it is not accepted by the online judge due to a basic misunderstanding of the problem on my part. Consider the following inputs: -1 (-1()()) 77 (77(1()())()) or diagrammatically, the trees look like: -1 77 / \ / \ (...

Dojo treemodel- adding large number of items

I am trying to add a large number of items (100+) to my tree via ForestStoreModel by calling newItem in a loop. This seems to be quite slow and locks up the browser. Is there any way I can do something similar to grid's beginUpdate & endUpdate? I want to basically 'turn off' my tree, add 100 items in a batch, then 'turn on' my tree. ...

Tree libraries in python

Are there any python libraries for data trees? I mean a tree as a general data structure, not just an xml tree. (Like in this question, but in python.) ...

Building a directory tree from a list of file paths

I am looking for a time efficient method to parse a list of files into a tree. There can be hundreds of millions of file paths. The brute force solution would be to split each path on occurrence of a directory separator, and traverse the tree adding in directory and file entries by doing string comparisons but this would be exceptionall...

jsTree: Prevent before and after TYPE, only use inside

I am using jsTree which is very nice. When dragging and dropping, I don't really care for the before and after types, I only want to use inside. Meaning, I am only concerned about that parent that a child is dropped into, rather than where the order is with other elements INSIDE the parent. So, I wanted to build my callback, so it alw...

help with tree-like structure

I've got some financial data to store and manipulate. Let's say I have 2 divisions, with offices in 2 cities, in 2 currencies, and 4 bank accounts. (It's actually more complex than that.) I want to show a list like this: Electronics Chicago Dollars Account 2 -> transactions in acct2 in $ in chicago/electronics ...

Any tips of how to handle hierarchical trees in relational model?

Hello all. I have a tree structure that can be n-levels deep, without restriction. That means that each node can have another n nodes. What is the best way to retrieve a tree like that without issuing thousands of queries to the database? I looked at a few other models, like flat table model, Preorder Tree Traversal Algorithm, and so....

FIlling a Java Bean tree structure from a csv flat file

Hi, I'm currently trying to construct a list of bean classes in Java from a flat description file formatted in csv. Concretely : Here is the structure of the csv file : MES_ID;GRP_PARENT_ID;GRP_ID;ATTR_ID M1 ; ;G1 ;A1 M1 ; ;G1 ;A2 M1 ;G1 ;G2 ;A3 M1 ;G1 ;G2 ;A4 M1 ;...

CakePHP Tree Behavior - products has more than one category

How rebuild table 'products' with actually field 'category_id', when I use Tree Behavior, to for one products belongs to more than one category? ...

Dynamically evaluating simple boolean logic in Python

I've got some dynamically-generated boolean logic expressions, like: (A or B) and (C or D) A or (A and B) A empty - evaluates to True The placeholders get replaced with booleans. Should I, Convert this information to a Python expression like True or (True or False) and eval it? Create a binary tree where a node is either a bool or ...

SQL server - climb up in the tree structure

Hello. I have some sql table, named Object, which saves tree data in fields ObjectID, ParentID, and others. I have implemented recurse procedure, which select everything down by objectID from tree, like this: 1. 1.1. 1.2. 1.2.1. ... Now o need to "Climb up" - by some ObjectID i need to select everything Up, like this: 1.2.1. 1.2. 1. ...

print the longest path between two leaf nodes

hi all, we know how to computer diameter but i came across a question where they asked you to print this longest path .. how can it be done? ...

How to use 2 different item renderers in mx:Tree

Question for Flex guys. How can I use multiple item renderers in mx:Tree depending on item's depth/level in tree? For example. For the first level items I want to use label with button and for second level items combobox. Is this somehow possible? ...

GWT: Change padding of tree rows?

A GWT tree looks roughly like this: <div class="gwt-Tree"> <div style="padding-top: 3px; padding-right: 3px; padding-bottom: 3px; margin-left: 0px; padding-left: 23px;"> <div style="display:inline;" class="gwt-TreeItem"> <table> ... </table> ...

Binary Tree in C Insertion Error

I'm quite new to C and I'm trying to implement a Binary Tree in C which will store a number and a string and then print them off e.g. 1 : Bread 2 : WashingUpLiquid etc. The code I have so far is: #include <stdio.h> #include <stdlib.h> #define LENGTH 300 struct node { int data; char * definition; struct node *left; struct node *...