Adds depth property to nodes