add `root` argument to (prev|next)leaf.