Click here to Skip to main content
15,893,161 members
Everything / Trees

Trees

trees

Great Reads

by Dirk Bahle
A list of advanced tips & tricks on Virtualized WPF TreeViews
by Dirk Bahle, Alaa Ben Fatma
Tips & tricks on visting and searching nodes in WPF TreeViews
by Vyacheslav Voronenko
Three approaches to store tree like structures with NoSQL databases in MongoDB
by BrainlessLabs.com
This tip describes a n ary tree structure.

Latest Articles

by IAmJoshChang
How to traverse a postorder binary tree
by Vlad Neculai Vizitiu
Mocking/stubbing lambda expressions to have a bit more control over our unit tests
by Akshay Srinivasan2
This article describes a technique to quickly retrieve and present hierarchical information from a flat relational database table with only one table scan.
by chuck in st paul
This is a utility program for bulk/batch renaming of files that demonstrates using and creating events

All Articles

Sort by Updated

Trees 

4 Jan 2011 by #realJSOP
Part of being a programmer is being able to analyze the problem, and then design and implement the solution. If you ask someone else what *they* would do, then it becomes that person's solution instead of yours. How are going to learn from doing what someone else would do?Lastly, you should...
15 Nov 2010 by 35aim
Hi Mukesh I need Project Files for for CustomControl.Collapsible DataGrid.......my Id is vidhyut_mca@gmail.com.thanksvidhyut
15 Nov 2010 by 35aim
thanks a lot Mukesh ....i have used your DLL as part of my Application so as a control i need that projects...thanks again.vidhyut
16 Jun 2016 by _eol_
This article presents the minimal code necessary to display a hierarchical tree using Popups.
1 Nov 2010 by Abhinav S
What have you tried so far? If you post some code here someone maybe able to help you better.
4 Jan 2011 by AbnormalCreations
I am currently creating a small 2D game engine for my final year project at university, but when ever i think im going in the right direction i get stuck on things like real time rendering in c#, creating and rendering a BSP tree in c# which I have come to find is a difficult task.So i turn my...
23 Apr 2011 by aditya kiran maroju
Hi ,Can any one guide me how to create a file Explorer in winformsMy requirement is i want a tree view to display all the directortes in the directories in the system and on clicking the particular folder in the tree view i want to display all the text files with size and date in the...
16 Mar 2013 by AfnanMof
This WebPart is developed to display all site collections and subsites based on logged in authentication
21 May 2020 by Akshay Srinivasan2
This article describes a technique to quickly retrieve and present hierarchical information from a flat relational database table with only one table scan.
6 Sep 2012 by alc_aardvark
Simple Generic Tree in c#
23 Apr 2011 by algrn912005
Hi,I'm having a little trouble with creating a function to find the average depth of a binary search tree. The definition of average depth of a tree is the sum of the depth of all nodes divided by the total number of nodes. The definition of the depth of a node is the distance from the root of...
12 Jul 2018 by Ali Majed HA
HelloI have a table in SQL Data Base named "Groups". with fields :Id Title ParentId the values are shown in jqxTree correctly, but I need to when user clicks on a Product to Update it, jqxTree select the current node for the Group of that product so the user can change it or...
8 Nov 2012 by Am Gayathri
What is The order of adding 1 to each element in a one dimensional array of integers. please share your thoughts.
10 Feb 2012 by Andreas Gieriet
If you are willing to pay a permanent runtime penalty for your argument of maintainability, you could do it via reflection. You would also lose type savety.private static void SetStatic(string prop, T value){ var p = MethodInfo.GetCurrentMethod().DeclaringType.GetProperty(prop); ...
10 Feb 2012 by Andreas Gieriet
Or an alternative of Solution #1 to play around a bit ;-)public static int StaticProp { get; set; }public int Prop { get; set; }private static string StaticSet(Expression> p, T v){ string name = p.Body.ToString().Split('.', '+', '/').Last(); ...
11 Feb 2012 by Andreas Gieriet
Hello Clifford,maybe it helps if I first elaborate a bit on lambda expressions and then explain why it is not possible what you aim to do with properties.Delegate: what they are forA delegate is the means of C# to hold a handle to a method without executing the method. Once you have...
6 Sep 2012 by Andrei Straut
I would recommend you take a different look at how your database is structured. I would recommend you go with Nested Set Model[^] structure. In combination with a PostreSQL DB (which supports recursive queries) it can be a very powerful solution.I've implemented this once (actually it was BS...
14 May 2015 by Andy Lanng
Here is a threaded version of your code: private void AddNode(XmlNode inXmlNode, TreeNode inTreeNode) { //XmlNode xNode ; TreeNode tNode ; XmlNodeList nodeList ; int i = 0; if (inXmlNode.HasChildNodes) ...
12 Aug 2014 by angiangi
I'm trying to get nested hierarchy data from large XML file and show it in a tree structure in MVC application.I need to considerate performance issue as well, because I'm using a large xml file.I started with parsing the xml with XmlReader and now i thinking to use XmlSerializer, what do...
13 Jan 2015 by Anup Kasat
I want to build a report which should generate output like the image here[^] How do I do this using C# & Visio or if possible any other tool?
1 Nov 2010 by arindamrudra
Please check the below link. At the first time I also use the concept from there.http://stackoverflow.com/questions/2572721/recursive-treeview-in-asp-ne[^]
21 Jul 2010 by AspDotNetDev
As CG suggested: vb.net treeview -asp.net
3 Oct 2012 by austinbox
Hello,Your question seems a bit vague but interesting, I would recommend using a treeview becuase it supports nodes and images like you said. //First lets read the xml.. List parents = new List(); List nodes = new...
15 Apr 2010 by Bahraini0
Good day,I've read your article "Horizontal Tree"; it is nice but I need to use the tree for drawing family tree. Could I append Child automatically to a node? Could I add another tree inside the parent tree? Could the node has mutiple parents?I hope if you could help me in...
5 Aug 2011 by beratxt
Hi GuysI have a trouble with this website https://ebeyanname.gib.gov.tr/giris.html . After I navigate this link in webBrowser Control , Website is directed to automatically https://ebeyanname.gib.gov.tr/index.html . So , I have trouble to show in webBrowser this link .How can i solve this...
8 Jun 2018 by BerthaDusStuf
I am reading jumping into c++ and in it there is this code that is made to insert into a tree: node* insert (node *p_tree, int key) { // base case--we have reached an empty tree and need to insert our new // node here if ( p_tree == NULL ) { node* p_new_tree = new node; p_new_tree->p_left =...
30 May 2012 by Beula Joyce
Hi,I am constructing a tree view nodes dynamically from server side. I want to trigger a client side event for only two types of nodes - Child node - Parent node that has no child I need to disable clicking the parent node that has child.Expecting your suggestions/help...
30 May 2012 by Beula Joyce
I found the solution to invoke client side event using jquery$(document).ready(function() { $(".rootNode").live("click", function() { //do something }); $(".childNode").live("click", function() { //do something ...
13 Apr 2016 by BillWoodruff
As Sergey suggested, the "big win" here would be to get whatever is producing your data formatted as string into JSON, or XML format; parsing those formats to a Tree data structure, or creating a populated TreeView Control using those formats, is straightforward.If you are going to try and...
24 Feb 2018 by BillWoodruff
Knowing your tree's item nodes are always leaf nodes of a specific type makes your task a bit simpler. I'm going to post a sketch of a structure that will implement a tree of this type which I know works. I say "sketch" because my goal is to assist you in developing your programming skills ......
27 Jul 2016 by Bit87
Hello, I need some help with this, I'm trying to call a function from my header file to my main, this function return a structure.The problem here is that I don't get how to call a function that returns a structure from it, I have tried some things but nothing has worked. Output...
24 Jun 2011 by BobJanova
I think this is easiest in two passes (which has been alluded to in previous answers), a precalculation pass where the totals for each node are recorded (which must traverse the whole tree), and a calculation pass where the branch's value is compared to the parent or root.class Branch {...
26 Jul 2011 by BobJanova
First question: how complex are your components? Recalculating the price each time may not be a problem, and means that you have no issues with caching and making sure updates work.What you essentially want for rebuilding the prices is a reverse tree: starting from the component that you...
9 Aug 2013 by Brady Bar
//The following line of code gives above mentioned error//printf("%d",root->left->info);// is there any flaw in the algorithm or coding#include#include#includetypedef struct Node{ int info; struct node* left; struct node*...
9 Aug 2013 by Brady Bar
//The following code does not give any output //Is there any flaw in its coding.#include#include#includetypedef struct Node{ int info; struct Node* left; struct Node* right;}node;void insert(node *root,int item){ node...
17 Aug 2013 by Brady Bar
/* 12 /\ 9 15 / \ \ 4 11 21The node with data 15 is not being deleted in the above binary serach tree.*/#include#include#includetypedef struct Node { int info;...
26 Mar 2015 by BrainlessLabs.com
This tip describes a n ary tree structure.
31 Mar 2015 by BrainlessLabs.com
This tip describes a n ary tree structure. We will see how traversal works.
7 Sep 2012 by c0derM
Hi, im trying to draw a family tree. i will try to tell the conceptheres the main data table|ID | Name | ....| Spouse ID| Mother | Father |________________________________________________|p01 | Jhon | ....| p02 | | ...
21 Jul 2012 by Chris___808
If I use the DC of my CTreeCtrl-derived class to calculate the horizontal extent of a tree item I would like to insert: CDC *pDC = GetDC(); CSize nameSize = pDC->GetTextExtent (*dString);... it seems I cannot depend on this function while appending characters to the...
21 Jul 2010 by Christian Graus
I would suggest you need to search for winforms, and exclude ASP.NET from your search, it sounds like you're reading ASP.NET articles. There are tree and list controls in winforms that are far richer than the web stuff that exists.
11 Aug 2015 by Christian Specht
Building a pseudo-dynamic tree menu with Jekyll
24 Feb 2019 by chuck in st paul
This is a utility program for bulk/batch renaming of files that demonstrates using and creating events
10 Feb 2012 by Clifford Nelson
It appears that I need to pass an Expression Tree to a method to be able to get its name, but i also want to set the value also, is there a way to do that: name = Method(() => property, value); public string Method(Expression> property, T value) { var propertyName...
21 Jul 2012 by Code-o-mat
My guess would be that when you do the GetDC-GetTextExtent thing the DC has a different font selected into it (System font maybe?) than when the tree is drawing the items.When you do the calculation, maybe try querying the tree for its font with GetFont[^] and use it for the calculation.
2 May 2014 by Coder_Jack
I am trying to make a complete tree recursive but It randomly adds element in order. How do I convert this binary search tree to a complete tree. Thanks in advance. @Override public boolean offer(E item) { if(root == null){ root = new Node(item); ...
5 May 2016 by corupted
i have a binary search tree that stores details of countries financial situation,i have added all the countries now i just want to search them by countrynamei have a find method in my BST class that is supposed to do that but it doesnt work, it doesent print anything when i call...
11 Feb 2010 by CPallini
(Hope I got you) ANTLR is great at this. the ANTLR web page [^] has tutorials, reference documentation, sample grammars. :)
17 Dec 2013 by CPallini
Microsoft genlty provides an article on the argument: "An Extensive Examination of Data Structures Using C# 2.0 - Part 3: Binary Trees and BSTs"[^].
6 Jan 2014 by CPallini
Quote:But I've no idea how to implement it in the test program.Keeping it simple:// the dumbest monotonic function...char my_fun(char c){ return c;}int main(){ bst_char * ptree; // ... // ... create the tree, make ptree pointing to it // ... ...
27 Mar 2022 by CPallini
I think you should revise your data structure. I propose you a skeleton (you might complete it adding dynamic memory allocation and all the details) #include #include #include #define SIZE 100 struct MemberNode {...
30 Sep 2012 by cs101000
Hey! How can I store a treeview nodes text properties in a file and retrieve them back later in the same treeview format as it was created? Is it possible to save it in linear format in a text file and then retrive it somehow?
14 Feb 2010 by d_saravanan
Hi,Any one please tell me how to represent an xml file content in a tree data structure format. This is to be used for the tree comparison based on the similarity.Please help me...Addition on 15.02.2010:Hi,Please note that i want to apply the tree edit distance algorithm for...
18 Aug 2012 by Dan Randolph
C# interop using platform invoke and C++ vectors to implement fast searching and selection on index keys
31 Aug 2011 by dasblinkenlight
Convert the tree to a list using an in-order traversal[^]. The list will be sorted, except for the two swapped elements. The first of them will be followed by a smaller number; the second one will be preceded by a larger number.9 10 16
15 Nov 2010 by Dave Kreskowiak
Noone is going to send over a project to you. You can Google for such a thing, as there may be some open source projects on CodePlex or SourceForge. But, finding a project that is exactly what you're looking for is entirely up to you.
8 Jun 2011 by Dave Kreskowiak
It's not that simple. The standard TreeView control in the ToolBox doesn't support doing this natively, so you have to make your own, or find a third party control that does this for you.There's a couple of CP articles that cover doing something like this here[^] and here[^].
12 Apr 2010 by DaveyM69
I've never used it but here[^]'s the first link I found on google for 'R-Tree C#'.
17 Dec 2018 by dhaya sagar
I need code to read data from text file and display the data in Tree Control...With a condition if, the text in the file not preceded by tab, it should be in parent node and if preceded by tab, it should be in child node. Example: Notepad contains two lines..... Hello -> (not preceded by tab...
14 May 2015 by dinesh_redhawk
Hello Friends,I need to display a large XML file (>21MB) in a tree view control in a C# Windows Form application. I have written the code which is working for small XML files but when i am trying to open a BIG XML file (>1 MB), its taking too much of time.Can anyone suggest how i can...
10 Jun 2016 by dipesh deb
I have two folders path. One is fixed - suppose "D:\Test". And another is variable, it may be under "D:\Test" tree (e.g,"D:\Test\abc\xyz" etc.) or in any other place of the local / network places. If the variable folder is under the fixed folder tree, message box - "Found in the folder" ...
16 Sep 2017 by Dirk Bahle
A list of advanced tips & tricks on WPF TreeViews
22 Sep 2017 by Dirk Bahle
A list of advanced tips & tricks on Virtualized WPF TreeViews
8 Dec 2017 by Dirk Bahle, Alaa Ben Fatma
Tips & tricks on visting and searching nodes in WPF TreeViews
22 Dec 2017 by Dirk Bahle
Tips & Tricks on loading and saving WPF Tree View based content.
24 Feb 2018 by Dntdothis
I ran to an issue, I have a task with categories and items, I need to make a menu tree list, it can be N deep, parent can have many children as he wants: Menu tree looks like this: - Category (6) - Category (3) - Item (€0.50) - Category (2) - Item (€1.10) -...
9 Sep 2013 by dotdeveloper2008
I am using telerik treeview for populating some information. I have the tree view (as a user control) on the left and a list of images (as thumbnail - user control) on the right side. I want to drag and drop the thumbnail images on to the tree nodes. I checked the demo in Telerik web site and...
23 Apr 2011 by Ed Nutting
I would suggest you start by looking at the System.IO namespace with specific reference to the File and Directory classes. The static methods of the Directory class include GetDirectories (which will return top level or all sub directories of a directory you specify) and also GetFiles which will...
21 Apr 2010 by ely_bob
quickest way is a ///Pass into this the base Node.TreeNode recursiveFind(TreeNode Node, obj yourCritera){TreeNode HoldTN = null; foreach(TreeNode tn in Node.Children){ if([YOUR SEARCH CRITERA]){ return tn; } else{ HoldT = recursive(tn);...
20 Jan 2021 by Emre Yaşar
Draw an expression tree for " k p * t / m n r - $ + ." What does ıt mean " $ " symbol . in Data Structure . What I have tried: $ ı dont know that symbol meanıng So ı cant tried anything.
4 Jan 2011 by Espen Harlinn
#3) I think demonstrating that you know how to use the right structures and algorithms for the various tasks your project has to perform will be fairly important. It's often equally important to show that you have thought your way through this, possibly showing more than one approach and...
2 Apr 2012 by Eugene Sadovoi
Various approaches to implementation of property initialization with DefaultValue attributes
20 May 2011 by farishkagalwala
Hi all,I am looking for a toolkit which displays a tree structure on a webpage. The toolkit should allow adding and editing entries (nodes) in the tree and interaction with the nodes (e.g. clicking performs some action). It should be able to populate the entries of the tree nodes using...
26 Jul 2011 by fgoldenstein
I'm working on a Product BOM (bill of material) and I'm stucked. This is my class diagram: •A Component has ComponentItems. A ComponentItem has a Component and a quantity. Example: Component ABC has 3 Component C1 and 2 Component C2. •A Product has ComponentItems and ProductItems (similar to...
6 Sep 2012 by fjdiewornncalwe
I actually did this years ago as a project for my father, but I don't have the source anymore. Basically what you have to do is this:The key is to break down the solution into smaller bits that are manageable.1) Decide how to draw a single node on the tree and build that object.2) Decide...
2 Dec 2013 by Freak30
Since your nodes have a Parent property you can just move up until you reach the one with order 1. Something like this.Node primary = (currentNode.Order 1) primary = primary.Parent;
11 May 2011 by gaps96
Draws sets of tree nodes in a vertical way. Allows to Export an Image to SVG.
5 Aug 2019 by geek code
I came across this problem while giving a sample test. The problem was that we have given a tree which is undirected. We can start from any node of our choice. Initially we have power "P" and while going from one node to other node we loose some power "X" (consider as cost of travelling) and...
21 Jul 2010 by Geewiz_Aa
Normally I'm a Database guru, but today I'm looking to build a complete application. I've written my procedures, loaded my data and I'm ready to develop the application.My application needs to display data in 2 tree views (or listviews) in a side by side relation. A simple button will...
27 Jul 2010 by Geewiz_Aa
I found this example helpfulhttp://xldennis.wordpress.com/2010/03/02/populate-treeview-control-with-tables-views-and-columns-from-a-sql-server-database[^]
16 Aug 2018 by Gerry Schmitz
Python implementation of Dijkstra's Algorithm · GitHub[^] Implementing Djikstra’s Shortest Path Algorithm with Python – Ben Alex Keen[^]
16 Nov 2015 by girish sp
I have to work with c tree(Conditional Inference Trees) in my Asp.net project,i know c tree is directly not supported, so i am looking for the alternatives which i can start with, i came across r.net i cannot use it as it requires executable to be installed on client side, i went through the...
25 Jan 2016 by GravityPhazer
This article demonstrates how you can simply enumerate any generic tree depth-first as well as breadth-first using the described construct. Trees can be serialized binary (using the BinaryFormatter), custom binary and as XML.
13 Apr 2016 by Gun Gun Febrianza
i wonder how and what is the best method to create a data tree from particular string with specific pattern into TreeView Control in c#?For example i have input string like this :(program (statements (statement (var_declaration (primitive_type string) (identifier a) = (expression "hi")...
31 May 2016 by Hamid Mosalla
Dynamically building JSON tree for use In JavaScript components using C#
18 Apr 2012 by hamid-shrk
hi,try below links :Generating Tree View from database1Generating Tree View from database2
12 Jul 2010 by HaNnOuU
Hi everybody.I am doing a project with WPF, it's the first time, so i am not an expert in WPF, and i have some problems with treeView.I am trying to create a treeView from an instance of my class menu. A menu is composed by Items and every Item can have a collection of subItems, which can...
25 Aug 2019 by higii
Trying to learn about Binary Tree while preparing for an exam, and I came across this code. And even tho it looks like it makes sense I simply cannot understand the purpose of this and how it actually works, so can anyone please elaborate? And this is the code : space += 5; ...
18 Apr 2012 by Hitul Mistry
I am developing MLM(Multi Level Marketing) website and i want to generate Tree View from Database.Screen shot Screenshot In this screenshot data comes from database.
14 Nov 2010 by infinateone
A file manager app with Clipboard interaction and drag and drop support.
3 Sep 2019 by Insoft Nepal
For the first time jstree is loaded but if i callback jstree through js ,then it is not loaded. What I have tried: var PGroupdata = JSON.parse(newStr) $('#data').jstree({ 'core': { 'data': PGroupdata } }); ...
9 Nov 2013 by Jakob Lithner
Extension to the TreeView control making it very fast to load items
19 Mar 2018 by jcsanchez1
I am trying to create a b* tree data structure using list. List> List> I am not pretty sure, in the first one I just get 2 levels of the tree, but in the case, the tree will be deeper? I think in the second case fit more with my needs because I can use a list as an...
3 Sep 2019 by jimmson
I would say that your jsTree script is loaded after your code. Try to initialize it on the page load: $(function () { $('#data').jstree({ 'core': { 'data': PGroupdata } }); }
16 Aug 2013 by JoCodes
Hi ,Have some doubts regarding how to implement the Composite Design Pattern to implement a tree structure using Asp.net MVC3 architecture. My concerns are mainly due to the requirement that the tree structure has nodes which have different attributes or properties for each level . May...
15 Mar 2013 by johngorman1
I'm starting a new application to search a text file with up to 12000 items for a given term and also allow a depth to be specified.My application requirements are as folllows:A word search tree that allows:1.Parse a text file and build the tree.2. Allow a depth to be specified3....
23 Sep 2012 by Jörgen Andersson
How to find the Lowest Common Ancestor in a tree.
27 Apr 2015 by Jörgen Andersson
A high performance extension for creating a DataTable from a Generic collection.