I have several different types of tree nodes, each of which may have anywhere from 0 to 5 children. I'm trying to figure out an algorithm to generate all possible trees of depth <= N. Any help here? I'm having trouble figuring out how to recursively walk the tree given that each change I make to a node may expose new subtrees (or remo...
Suppose there is a tree, for argument's sake an XML tree. And you want a complete set of root to node paths, however you want to divide that set into groups of i, where i is user specified.
So for example a html document:
/html
/html/head
/html/head/title
/html/head/title/[text]
/html/body
/html/body/[text]
becomes for example...
What is the optimal (easy to maintain, reasonably fast, robust) implementation of tree-like data structure with three levels?
I would like to use Dictionary or SortedDictionary, because all values (nodes have unique key).
The first level is supposed to have about 300 items, every of these zero to tens (hardly more than 100, usually less...
I'm building a list of hashes that represent root to node paths in a tree. My functions work but they are incredibly slow over large tree structures - is there a better way? I've tried building the list in one function but I get unique hashes where I don't want them.
public ArrayList<Integer> makePathList(AbstractTree<String> tree){
...
I'm importing an existing source tree as an Eclipse Java project. When I do, I get errors in classes (such as mycompany.logging.LogEntry) along the following lines:
The package mycompany.logging does not match the expected package ""
The problem seems to be that Eclipse does not realize that the directory src/mycompany/logging is a pac...
I'm searching for tutorials on how to draw a family tree with WPF (and C#).
Something like http://www.myheritage.nl/FP/family-tree.php?s=65040841 or Family.Show but for a complete beginner. Family.Show is a bit too complex to start. I don't want to implement external controls but instead I want to learn how to write them myself.
So I n...
How should new nodes be added with SQLAlchemy to a tree implemented using the Nested Set Model?
class Category(Base):
__tablename__ = 'categories'
id = Column(Integer, primary_key=True)
name = Column(String(128), nullable=False)
lft = Column(Integer, nullable=False, unique=True)
rgt = Column(Integer, nullable=False,...
Does a library exist to work with trees for iPhone ?
...
In my webapp, we have many fields that sum up other fields, and those fields sum up more fields. I know that this is a directed acyclic graph.
When the page loads, I calculate values for all of the fields. What I'm really trying to do is to convert my DAG into a one-dimensional list which would contain an efficient order to calculate th...
I'm trying to build several 'trees' in memory, and later assign one of them to a TTreeView control that the user can interact with. However, I can't construct any TTreeNodes objects without passing a pointer to an existing TTreeView. Passing in NIL causes AVs.
Two questions:- What's the reason for this "hard" linking between TTreeNodes ...
I am just getting into Grails having had some experience with Rails, and I am looking at creating an app where I have to primarily persist tree structures (and query them as well).
Rails has several very useful acts_as helpers for representing domain objects as different data structures, such as acts_as_tree. From my initial reading it ...
Is this a list of lists or just a bunch of trees(forest)?
...
I'm writing an application that makes use of a tree structure, so of course I have some recursive methods that will iterate down every node of the tree and do something. The problem is sometimes these take a while, and I'd rather show a progress bar of some sort to the user rather then the program stop responding for a period of time.
I...
How can I find the preorder listing of a tree if only the postorder listing is given and vice versa. Also, in the tree, every non-leaf node has two children (i.e. Each node has either two or zero children.)
EDIT: Another given assumption is that the label of each node is unique and has a field that will identify it as an internal node o...
I'm creating a tree-structure of categories with parentid's which can be called from children in such a way:
ID | Name | ParentID
1 1 0
2 2 1
3 3 2
4 4 1
Resulting in this:
1 = 1
2 = 1 -> 2
3 = 1 -> 2 -> 3
4 = 1 -> 4
which means 3 is a child of 2, which is a child of 1.
when trying to get this idea ...
I'm struggling with a sorting problem.
I've got a table which is as follows:
aspect_id (int)
aspect_text (memo)
root_id (int) which has as a foreign key a aspect_id
I've got a non cyclic tree with the following dummy data:
aspect_id aspect_text root_id
1 root null
2 aspect1 1
3 aspect2 ...
Hello everyone,
quite a funny question I have.
I am working now on the HTML parser and I was using vector for all my input purposes which seemed quite fine and fast for creating tree.
In another application I need to edit HTML structure and now inserting or reordering of the elements would be extremely painful using vector so I decid...
I have a tree structure
A -> B -> D -> Y
-> C -> X
-> X
I want to do an operation on all objects of class X, or all the children objects of class D (for example). I want to call start this operation from any node in the tree (ie recursively).
For e.g,
A.SetupDecorators();
(although I'm open to suggestions)
All classes i...
I have a c file that looks like this:
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
{
pid_t child_pid;
printf ("The PID is %d\n", (int) getpid ());
child_pid = fork ();
if (child_pid != 0)
{
printf ("this is the parent process, with PID %d\n",
(int)getpid());
prin...
I'm trying to implement a tree like structure using a Materialized Path model described here: http://www.dbazine.com/oracle/or-articles/tropashko4.
Is it possible to enforce referential integrity on the [path] field? I don't see how SQL could do it, do I have to do it manually in the DAL?
...