Introducing tree “node elevation” to replace both “node depth and “node height”.

A tree’s nodes may be assigned a depth and a height. If you would like to brush up on these concepts, then baeldung.com has a great explainer article Difference Between Tree Depth and Height. The difference may be summarised as

MeasureMeasures what?
The height difference between the node and the most distant member of the zero-reference set:
node depthroot node
node heightleaf nodes
What is the differentiator between the two measures?

Notice that the definitions of depth and height differ only in which is the zero-reference level for the measurement.

The weakness of current terminology is in two aspects:

  • calling the measures ‘depth’ and ‘height’ hides the essential difference between them which is the chosen zero-reference node(s) set.
  • there are other possible zero-reference sets (example below) and for all of these other zero-reference sets some nodes will be above the zero-reference (higher or positive elevation) and some nodes will be below the zero-reference (lower or deeper).

Relationship between Height, Depth and Elevation

Elevation is a single scale that incorporates both height and depth. Height is positive, and depth is negative with respect to a zero-reference level. This is shown in the following geographic example.

Colour three-dimensional regional elevation image of the northern Gulf of Eilat/Aqaba.

The zero reference (black line) is sea-level with the highest land at 600m and the deepest water at 700m. This corresponds to elevations between +600m (land height) and -700m (water depth).

Elevation from …

This article argues for replacing node depth and node height with the following:

Existing measureElevation from …
height (+ive)Elevation from Leaves (+ive)
depth (+ive)Elevation from Root (-ive)

The definition of elevation is exactly as currently defined for height and depth, with the exception that the sign of an elevation below the zero-reference level will be negative.

Other zero-reference levels

Defining elevation in this way allows us to consider other zero-reference levels in a tree. Here is a practical example taken from the domain of Project Management. The tree represents the project Work Breakdown Structure (WBS).

Project Management WBS.
‘A’ and ‘B’ are Summary Elements. ‘C’ and ‘K’ are Planning Packages. ‘D’ and ‘H’ are Work Packages with activities associated with them. And ‘E’, ‘F’, ‘G’, ‘I’ and ‘J’ are Activities.

The set of nodes {C, D, H, and K} are the leaf nodes in the WBS and form an interesting zero-reference level for the tree. Let’s call this the “WBS Leaves” zero-reference set.

Here are the Root, Leaves, and WBS Leaves elevations for all nodes:

NodeRoot ElevationWBS Leaves ElevationLeaves Elevation
A023
B-112
C-200
D-201
E-3-10
F-3-10
G-3-10
H-201
I-3-10
J-3-10
K-100
Elevations for each node

This zero-reference level is useful in Project Management because it allows us to give precise definitions for commonly used terms:

  • The WBS consists of all nodes with a non-negative “WBS Leaves” Elevation.
  • Summary Elements may be defined as nodes with “WBS Leaves” Elevation greater than zero.
  • Work Packages may be defined as nodes with “WBS Leaves” Elevation of 0 and “Leaves” Elevation of 1.
  • Planning Packages may be defined as nodes with “WBS Leaves” Elevation of 0 and “Leaves” Elevation of 0.
  • Activities may be defined as nodes with “WBS Leaves” Elevation of -1 and “Leaves” Elevation of 0.