Questions tagged [treenode]

The base element of a hierarchical tree-like data structure.

Trees are hierarchical data structures that represent undirected acyclic graphs. A tree is therefore composed of connected nodes.

One specific node is the root of the tree. The root node is connected to several nodes (sometimes called children), each of these being the root of a subtree, and so-on. A node of a tree that does not have any children is called a leaf. All nodes of the tree are connected directly or indirectly to the root.

Treenodes are usually recursive datastructures.

See also:

Specific usages:

  • In .Net framework a TreeNode is a node in TreeView UI control that displays tree-like objects.
  • In Java a TreeNode is an interface that nodes of a JTree UI control that displays tree-like objects.
630 questions
8
votes
7 answers

How to deep copy a Binary Tree?

I would like using my own Node class to implement tree structure in Java. But I'm confused how to do a deep copy to copy a tree. My Node class would be like this: public class Node{ private String value; private Node leftChild; private Node…
lkkeepmoving
  • 2,323
  • 5
  • 25
  • 31
8
votes
3 answers

TreeView search

This function find only first node in treeview, that contains SearchText. private TreeNode SearchNode(string SearchText,TreeNode StartNode) { TreeNode node=null; while (StartNode!= null) { if…
Romz
  • 1,437
  • 7
  • 36
  • 63
7
votes
2 answers

How to copy and paste SVG node using jQuery

I have some SVG embedded into a web page and need to copy a particular SVG node (including it's children), then paste it back into the DOM. Only problem is, the SVG node doesn't appear after being pasted, which is probably because it's…
Steve
  • 3,483
  • 5
  • 21
  • 20
7
votes
1 answer

how to reload a selected node of a tree

I need to reload a tree after deleting one of the leafs of a node. The problem of reloading the entire store is, it's too slow. That's why I just want to reload a node where its leaf is deleted. I tried this.. but it says…
EagleFox
  • 1,367
  • 10
  • 34
  • 58
7
votes
3 answers

Creating a list for a Treenode

I know this must be real easy but I just can't get it to work... I am trying to make a List for extjs Tree by comparing two columns from differnt rows and putting them as a Node or a leaf accordingly. this is my sample data ListA ListB labelName …
EagleFox
  • 1,367
  • 10
  • 34
  • 58
7
votes
3 answers

How to get depth of current node in JTree?

I have a JTree with a few nodes and subnodes. When I click on a node I want to know on which depth is it (0, 1, 3). How can I know that? selected_node.getDepth(); doesn't return the depth of current node..
c0dehunter
  • 6,412
  • 16
  • 77
  • 139
6
votes
4 answers

Problem with TreeNode.BeginEdit()

I'm using WinForms TreeView and reaction to AfterLabelEdit event. Here's the snippet of the code: if (e.Label.Contains("|")) { if (WantAutofix()) { label = e.Label.Replace('|', '_'); } else { e.CancelEdit = true; …
Migol
  • 8,161
  • 8
  • 47
  • 69
6
votes
3 answers

Color a node of treeview with different color

I have a treeview with some nodes. Under some condition I want to color each node with different color along with their children. I have written a function that colors node and its children. Will anyone please let me know is there any possibility…
user5814565
6
votes
1 answer

How to explain TreeNode type restriction and self-type in Spark's TreeNode?

From the definition of TreeNode in Spark SQL: abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product { self: BaseType => ... } What does it say about the subtypes of TreeNode and BaseType? What's acceptable?
expoter
  • 1,622
  • 17
  • 34
6
votes
2 answers

make a tree from a table using golang?

I want to make a tree from a table. the table is as following: OrgID OrgName parentID A001 Dept 0 -----th top A002 subDept1 A001 A003 sub_subDept A002 A006 gran_subDept A003 A004 subDept2 A001…
user3373877
  • 315
  • 1
  • 4
  • 17
5
votes
3 answers

Find the level of Deepest child Treenode

I have treenode & i would like to find the deepest child in the treenode. if there are 2 child nodes with level 11 & level 13 respectively then i need unction to return me the value 13. How can i do that ? public int FindLevel(TreeNode…
Sangram Nandkhile
  • 17,634
  • 19
  • 82
  • 116
5
votes
5 answers

"The type 'System.Windows.Forms.TreeNodeCollection' has no constructors defined"

I have this code: private TreeNodeCollection treeCollection; public Client(TcpClient c) { this.tcpClient = c; this.tree = null; this.treeCollection = new TreeNodeCollection(); …
Danpe
  • 18,668
  • 21
  • 96
  • 131
5
votes
3 answers

extjs treepanel: expand() & expandChildNodes()

If I write: rootNode.expand() I can only get access to the children nodes of this rootNode, but can't get access to the grandchildren nodes of this rootNode. I have to write: rootNode.expandChildNodes() in order to acheive it. Is there another way…
Simon
  • 1,463
  • 6
  • 34
  • 46
5
votes
3 answers

how many nodes can a binary tree have at level n? Use induction to prove the answer

This is a homework and i didn't have much time to spent on it but I know some of the answer and need a little help plz i'm thinking like this assume we have: 1 node ----> Level 1 2,3 nodes ----> Level 2 3,4,5,6,7 nodes ----> level 3 4,5,6,.....,15…
Bobj-C
  • 5,276
  • 9
  • 47
  • 83
5
votes
4 answers

C# - TreeView: inserting node at certain position

How does one insert a new child to a particular node in a TreeView in C# WinForms? I've been clumsily stabbing at TreeViews for almost an hour and I'd like to use C#'s TreeView like this: treeView.getChildByName("bob").AddChild(new Node("bob's…
Spectraljump
  • 4,189
  • 10
  • 40
  • 55
1
2
3
41 42