         console.log('not attempting to tidy multiple trees')
   },
   {
-    name: 'remove values'
-    action: (c, t) ->
-      console.log('remove values')
-      c.removeValues()
-  },
-  {
-    name: 'Shannon-Fano',
-    action: (c, t) ->
-      console.log('Shannon-Fano')
-      if not c.nodes[0].value?
-        console.log('values required for Shannon-Fano')
-      else
-        c.reconstruct_as = ShannonFanoNodeCollection
-  },
-  {
-    name: 'Huffman',
-    action: (c, t) ->
-      console.log('Huffman')
-      if not c.nodes[0].value?
-        console.log('values required for Huffman')
-      else
-        c.reconstruct_as = HuffmanNodeCollection
-  },
-  {
-    name: 'sort by weight',
-    action: (c, t) ->
-      console.log('sort by weight')
-      if not c.nodes[0].value?
-        console.log('weights/values required to sort by weight')
-      else
-        c.addAnimations(c.sortNodes( ((n1, n2) -> n2.value - n1.value), t))
-  },
-  {
     name: 'delete'
     action: (c, t) ->
       console.log('delete')


  makeMove1Anim: (node, dest, duration, t) ->
    return new CollectionAnimation([new NodeAnimation(node, dest, duration)], t)

  sortNodes: (compare, t) ->
    if @nodes.length == 1
      return []

    anims = []
    anims.push(@makeLineupAnim(default_node_radius*2, .1, t))

    minx = @nodes[0].x
    maxx = @nodes[0].x
    totaly =  @nodes[0].y

    for n in @nodes[1..]
      totaly += n.y
      minx = Math.min(n.x, minx)
      maxx = Math.max(n.x, maxx)

    desty = totaly / @nodes.length
    width = Math.max(maxx - minx, @nodes.length * default_node_radius * 2)
    spacing = width / (@nodes.length-1)

    oldnodes = @nodes.slice(0) # clone
    newnodes = []

    while oldnodes.length > 0
      max = oldnodes[0]
      maxi = 0
      for n,i in oldnodes[1..]
        if compare(n, max) > 0
          max = n
          maxi = i+1

      oldnodes = (n for n,i in oldnodes when i != maxi)
      anims.push(@makeMove1Anim(max,
        (x: minx+newnodes.length*spacing, y: desty), .1, -1))
      newnodes.push(max)

    @nodes = newnodes

    return anims

  addAnimations: (anims) ->
    @animations = @animations.concat(anims)

    action: (c, t) ->
      console.log('finish Huffman')
      # TODO: maybe first this should automatically finish the construction?
      c.reconstruct_as = WeightedNodeCollection
  }
]

