def breadth_each(max_depth=999,&block)
      node_queue = [self] # Create a queue with self as the initial entry

      # Use a queue to do breadth traversal
      until node_queue.empty?
        node_to_traverse = node_queue.shift
        yield node_to_traverse
        # Enqueue the children from left to right.
        node_to_traverse.children { |child| node_queue.push child }
        max_depth -= 1
        break if max_depth == 0
      end
    end
def breadth_each(max_depth=999,&block)
      node_queue = [self] # Create a queue with self as the initial entry

      # Use a queue to do breadth traversal
      until node_queue.empty?
        node_to_traverse = node_queue.shift
        yield node_to_traverse
        # Enqueue the children from left to right.
        node_to_traverse.children { |child| node_queue.push child }
        max_depth -= 1
        break if max_depth == 0
      end
    end
http://github.com/evolve75/RubyTree/blob/master/lib/tree.rb