code: public Iterator<Compound> toRootOrder(final Compound c) {
          return new Iterator<Compound>() {
  
              Compound curr;
              TreeNode n = node(c);
              Compound parent = c;
  
              public boolean hasNext() {
                  return !n.isRoot();
              }
  
              public Compound next() {
                  if (hasNext()) {
                      curr = parent;
                      parent = n.parent;
                      n = node(n.parent);
                      return curr;
                  } else {
                      throw new NoSuchElementException();
                  }
              }
  
              public void remove() {
                  throw new UnsupportedOperationException();
              }
          };
      }
docs: Returns all compounds from the Compound argument to the root of
  the tree following the path.
  
  @param c the Compound to start with.
  @return the set of Compounds in the given order.