function isTree