*         negative log probability).
   */
  public List<ScoredObject<Tree>> getKBestParses(int k) {

    cand = new HashMap<Vertex,PriorityQueue<Derivation>>();
    dHat = new HashMap<Vertex,LinkedList<Derivation>>();

    int start = 0;
    int end = length;
    int goal = stateNumberer.number(goalStr);

    Vertex v = new Vertex(goal, start, end);
    List<ScoredObject<Tree>> kBestTrees = new ArrayList<ScoredObject<Tree>>();
    for (int i = 1; i <= k; i++) {
      Tree internalTree = getTree(v, i, k);
      if (internalTree == null) { break; }
      // restoreUnaries(internalTree);
      kBestTrees.add(new ScoredObject<Tree>(internalTree, dHat.get(v).get(i-1).score));
    }
    return kBestTrees;
  }