user2022068
user2022068

Reputation:

What is node in a tree?

According to wiki, everything in a tree is a node.

Terminologies used in Trees

Root – The top node in a tree.
Parent – The converse notion of child.
Siblings – Nodes with the same parent.
Descendant – a node reachable by repeated proceeding from parent to child.
Ancestor – a node reachable by repeated proceeding from child to parent.
Leaf – a node with no children.
Internal node – a node with at least one child.
External node – a node with no children.
Degree – number of sub trees of a node.
Edge – connection between one node to another.
Path – a sequence of nodes and edges connecting a node with a descendant.
Level – The level of a node is defined by 1 + the number of connections between the node and the root.
Height of tree –The height of a tree is the number of edges on the longest downward path between the root and a leaf.
Height of node –The height of a node is the number of edges on the longest downward path between that node and a leaf.
Depth –The depth of a node is the number of edges from the node to the tree's root node.
Forest – A forest is a set of n ≥ 0 disjoint trees.

But then I find the following picture from SAP http://www.sapdesignguild.org/community/design/print_hierarchies2.asp enter image description here

So my question - is it right to call root, leaf, parents, children, siblings in a tree as nodes?

Upvotes: 3

Views: 9073

Answers (1)

Jim Mischel
Jim Mischel

Reputation: 134125

Yes. The root is "the root node." A parent is a "parent node." A leaf is a "leaf node." The tree is made up of nodes. The terms root, parent, child, sibling, leaf, etc. just describe the relationships among nodes.

For example, the root node has no parent. Leaf nodes have no children. Sibling nodes share the same parent.

Upvotes: 4

Related Questions