tree

URL tree walker in Python?

For URLs that show file trees, such as Pypi packages, is there a small solid module to walk the URL tree and list it like ls -lR? I gather (correct me) that there's no standard encoding of file attributes, link types, size, date ... in html <A attributes so building a solid URLtree module on shifting sands is tough. But surely this wheel...

Traversing a graph Vs Traversing a tree

Would a function that traversed a graph work equally well to traverse a tree? ...

Changing property of an object and Tree update

I have an ArrayCollection which is a dataProvider for a Tree component. Objects inside ArrayCollection have _selected property. After setting object's _selected property to true the Tree component should get updated (specific row should get highlighted). How could I achieve this? Do I have to write an ItemRenderer? ...

How to add context menu to Silverlight tree items?

I want to have context menus attached to tree items in my Silverlight Toolkit tree. How can I do this? ...

Finding the smallest subtree

Given a graph of n nodes that are all interconnected on a coordinate plane, what's the best way to find a subtree of minimal distance that contains m nodes? The only solution I've found to this problem is to generate all combinations of the nodes to connect and attempt to connect these nodes via either Kruskal's or Prim's algorithm whil...

navigate all items in a wpf tree view

I want to be able to traverse the visual ui tree looking for an element with an ID bound to the visual element's Tag property. I'm wondering how i do this. Controls don't have children to traverse. I started using LogicalTreeHelper.GetChildren, which seems to work as intended, up until i hit a TreeView control... then LogicalTreeHelp...

Flex: extract data from a Tree control

So Flex provides great APIs for user-manipulation of its data-fed controls, but, for the life of me, I can't figure out how to get the data back out of the control once the user is done playing with it. Specifically, I've enabled the dragMove controls on a Tree component, but I can't figure out how to get the user-initiated changes back...

Dojo Tree Refresh

Using Dojo 1.3, after adding a child (i.e. folder or item) to a tree, is there a way to have it reflected immediately via refresh or some other method? ...

js/jQuery Drag'n'Drop, recalculate the drop targets.

I have the following issue, I have a large tree which has subnodes which can be folded and unfolded on demand (the data within nodes gets fetched with AJAX). However, I use jquery.event.drop/drag to create my drag/drop targets. However, when I fold/unfold the drop targets change position and I need to recalculate. This is how I wanted t...

Finding all objects of type T in a tree structure C#

Hi, I need to write a tree search method which takes a type parameter T and returns all items of type T that exist in the tree. Is there any way to do this? I would prefer elegance over efficiency at this point... ...

Binary Trees question. Checking for similar shape

Hi I'm stuck doing this, not sure how to go about it. If I have two binary trees, how would I check if the have the same shape? Data in the nodes doesn't matter, just if the tree structures are equal. Any ideas on how to solve this problem? ...

How to determine if binary tree is balanced?

It's been a while from those school years. Got a job as IT specialist at a hospital. Trying to move to do some actual programming now. I'm working on binary trees now, and I was wondering what would be the best way to determine if the tree is height-balanced. I was thinking of something along this: public boolean isBalanced(Node r...

Adjacency tree from single table

I've read a lot of people discussing nested lists, but I was wondering how to iterate through an adjacancy list/tree in PHP. I have a table with: id, title, parent_id And I've selected all records out into an array called $pages. Then using this php: function makeList($pages, $used) { if (count($pages)) { echo "<ul>"; ...

Convert Tree Structure Data to XML-- Performance Concerns

I have a set of data in tree structure. Currently I save those data to a binary file. The downside is that the sorting, filtering of these data are exceedingly difficult.Not only that, when the data size is large, it's very slow to read them from hard disk into memory. So I am thinking about saving these tree like data to XML files. The...

Manipulating the tree on the client - please advise

Here is my scenario. I am going to have a page with the treeview displayed. A user can add and delete nodes: when the user clicks on the node, a pop up will come up with a form, where a user will enter data, this data then gets saved into the database, and the pop-up script comes back with the id (from the database). This id needs to get...

Iterative tree walking

It's been quite a while since I took data structures and algorithms in college, so I was surprised recently by a suggestion that recursion may not be the way (tm) to do tree traversal. For some reason iterative, queue based traversal has not been a technique that I've ever used. What, if any, are the advantages of iterative vs. recursiv...

Jquery tree and asp.net 2.0

I have few specific questions on how to make these two work. I need the tree that can be manipulated on the client side (add/delete nodes, expand/collapse) and that can be saved in the database when the user specifically presses a SAVE button. From the research I have done, I gather that what I need to do is use a callback (asp.net call...

Converting tree list to hierarchy dict

I have a list of elements with attrs: parent, level, is_leaf_node, is_root_node, is_child_node. I want to convert this list to hierarchy dict. Example of output dict: { 'Technology': { 'Gadgets':{}, 'Gaming':{}, 'Programming': { 'Python':{},...

.net ajax and jquery tree

I need to save a jquery tree in the database. i am using .net web forms, c#. From what I hear, I need to use AJAX to collect the data on the client, package it up, and send it to the server method. WHat are the details involved? If anyone has a simple working example, please share. ...

How can I recursively search a list of lists for an item, getting the "closest" match

This may take a little explaining, so please bare with me. I have a class "Class" which has a member std::list, I want to search that list/tree for an item, specifically an item with a specific name. A basic representation of my class is as follows. #include <list> #include <string> class Class { std::string _name; std::list<C...