traversal intree(n1, n2) ¶ Return True iff n1 occurs in the subtree rooted at n2. Source code in src/finch/symbolic/traversal.py 20 21 22 23 24def intree(n1, n2): """ Return True iff `n1` occurs in the subtree rooted at `n2`. """ return any(node == n1 for node in PostOrderDFS(n2)) isdescendant(n1, n2) ¶ True iff n1 is a strict descendant of n2. Source code in src/finch/symbolic/traversal.py 27 28 29 30 31 32 33def isdescendant(n1, n2): """ True iff `n1` is a strict descendant of `n2`. """ if n1 == n2: return False return intree(n1, n2)