tree_common_op detect_cycle(nodes, visited) Detect the cycles in the tree. list_index(collection, node) Check if node is in list with "is" operator. swap_node_position_in_tree(top_node, child_node) Top node becomes child, child becomes top node.