tree

Which javascript realisation of getting values from nested tree will be more efficient?

I have a nested tree. Under each <li> tag I have a string value and an integer value. Which way is more efficient: storing them inside <li> options, say integer under "id" option and string under "title", or storing them in a hidden <input> values under each <li> I'm using jQuery to find elements in a DOM now, but I'll gladly accept mor...

Build Array Tree from URLs

I need to build an tree (with arrays) from given urls. I have the following list of urls: http://domain.com/a/a.jsp http://domain.com/a/b/a.jsp http://domain.com/a/b/b.jsp http://domain.com/a/b/c.jsp http://domain.com/a/c/1.jsp http://domain.com/a/d/2.jsp http://domain.com/a/d/a/2.jsp now i need an array like this: domain.com a ...

The most elegant way to walk trees in PHP

I have trees like this one: $tree = array("A", array( array("B", 1), array("C", 2), array("D", array("E", array("F")), array("G")), array("H", 3))); Each node is an array, type of node is its first element and other elements are node's ...

jquery file tree - folder open by default?

Hi all, I was wondering if anyone could help me out with jQuery file tree (jQuery File Tree) I was wondering if/how it would be possible to set some kind of variable that will tell the file tree to have a certain folder open on load. (eg. folder /images/fruit/ to be open by default) Here's the code to call the filetree: $('#container_...

Hibernate, SQL and recursive associations

My database has two tables, "question" and "field". Questions may have many fields, and fields may have many fields. It's a tree with a special root node. I want to use them with hibernate (currently potgresql) - so it should be straightforward and simple to use it from java. What is the best solution to this? add question_parent_id ...

about ordered tree and its features

Hi I have read a lot and I could not get what does ordered tree mean? would you explain me with some examples thanks! ...

check all items under a parent node in Visual Basic

I am trying to check all the childnodes under a parent node, the code I have so far only goes about 2-3 levels deep in the TreeView and I am looking to grab all nodes no matter how deep they are. Could someone shed some insight on this. Below is the code: Private Sub CheckChildNode(ByVal currNode As TreeNode) 'set the children check st...

Binary Tree: Longest path between 2 Nodes

Calculate the longest path between two nodes. The path is in an arch. Signature of method is: public static int longestPath(Node n) In the example binary tree below, it is 4 (going thru 2-3-13-5-2). This is what I have right now and for the given tree it just returns 0. public static int longestPath(Node n) { if (n != null) {...

Generate a nested list from flatten data in Python

Hi, To generate a Table of Content, I have these data available in a Python list: data = [ {title: 'Section 1', level: 1, page_number: 1}, {title: 'Section 1.1', level: 2, page_number: 2}, {title: 'Section 1.2', level: 2, page_number: 3}, {title: 'Section 2', level: 1, page_number: 4}, {title: 'Section 2.1', level: ...

C++ tree of pointers template question

I've just come across a nice STL-like tree container class written by Kasper Peeters: http://tree.phi-sci.com/ However, because it's STL-like, it's geared towards having a single class type in the tree; i.e. template <class T>. The trouble is, like STL-lists, if it suffers from the polymorphic class problem, in that the objects in the...

What is a tree graft point?

Hello, I've heard some terminology in regards to trees that I haven't heard before. There are some references to graft points in our code base in relation to n-ary trees. What exactly is a graft point in a tree and what could these references be referring to? Thanks! ...

Finding Controls of the Same Type

Does anybody have a good way of finding ALL the controls within an object that is of the same type? Here's my scenario, I have a tab control and within each tab control exists a user control (ALL of which match the same base type e.g. MyBaseClassControl). I want to be able to find that user control WITHOUT having to use the control.Fin...

Information related to Node in a Database Structure for Tree Data Structure

Hello, Imagine you have a tree data Structure in a database like this: Level: id nextlevel desc 1 2 company 2 3 department 3 4 group Nodes: id level parentnode 0 1 null -> the company 1 2 0 -> dep 1 2 2 0 -> ...

Build category - sub category html list from mysql table

Hello, i have a table with categoryId, name and parentId. I would like to build a html list with parent and child tree like structure my table looks like this ------------------------------------------------------------------ id categoryId parentId categoryName SortSeq ----------------------------------------------------------...

Parent/Child tables not referencing in LINQ or am I just wrong?

I have a categories table "Category" [ID, Title] and a Parent/Child table "CategoryParent" [ID,CategoryID,ParentCategoryID] where a many-to-many tree is represented by the parent of a category being indicated using the ParentCategoryID field in the join table. I thought this would be a simple structure to use to retrieve root categories...

Delete in Binary Search tree?

I am reading through the binary tree delete node algorithm used in the book Data Structures and Algorithms: Annotated Reference with Examples on page 34 , case 4(Delete node which has both right and left sub trees), following algorithm described in the book looks doesn't work, probably I may be wrong could someone help me what I am mis...

Flex - cancel a change event on a Tree

Hello there, Brief details: I'm using Flex 3.5. I have a Tree component that's used as a navigation menu between different 'pages'. When the user clicks a certain option in the menu, I switch the 'page' by switching between State components in my application. The thing is that when the user indeed clicks an option in the menu, I want t...

cakePHP Tree helper By Andy Dawson incorrect ?

Tree helper By Andy Dawson http://bakery.cakephp.org/articles/view/tree-helper-1 //---acl_aros_controller $aros = $this->AclAro->find('threaded'); $this->set('aros',$aros); //--- View echo $tree->generate($aros, array('alias'=>'alias')); RESULT ----------------------------------------------------- Root ----|Members ...

Decision Tree jQuery - How to Hide Questions if Not Selected?

Hello all. I am building a simple decision tree with jQuery. I have it running ok, but I would like to add a little more functionality. Currently I have this: <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script> $(document).ready(function() { $('ul').hide(); $('h3').css('cursor','pointer'); $('h3').click(funct...

constructing breadcrumbs from leaf node in Flex Tree control

hello all- I'm looking to generate a string that shows the path from the upper most branch node to the selected leaf. So for example: The user opens a branch which has two children, which are branches. They then open one of these branches, which have multiple children. These are all leaves. When the user clicks on one of the leaves,...