TreeDepth
TreeDepth[tree] gives the maximum level of tree.
TreeDepth[tree, pattern]gives the maximum level of the subtree with data matching pattern.
Examples
TreeDepth[Tree[a, {Tree[b, {c, d}], e}]]TreeDepth[Tree[1, {Tree[2, {3}], 4}]]Please visit the official Wolfram Language Reference for more details.