def add_ancestors_that_only_contain_nodes!(nodes)
      levels.reverse_each do |level_nodes|
        level_nodes.each { |node| nodes << node if node.children? && node.children.all? { |c| nodes.include?(c) } }
      end
    end
def add_ancestors_that_only_contain_nodes!(nodes)
      levels.reverse_each do |level_nodes|
        level_nodes.each { |node| nodes << node if node.children? && node.children.all? { |c| nodes.include?(c) } }
      end
    end
Adds all the ancestors that only contain the given nodes as descendants to the given nodes.
 @param nodes [Set] Modified in-place.