tree and graph common ancestor and check if subtree empty file