abstracted relative depth to tree