assume nodes are in tree