adds has_cycles for is_tree