complete nested sorting for node tree