Add node depth calculation