Handle weighted trees