code: public int addRef(final int root) {
      if (root < 2)
        return root;
      if (root >= this.nodesize)
        throw new IllegalArgumentException("Not a valid BDD root node: " + root);
      if (low(root) == -1)
        throw new IllegalArgumentException("Not a valid BDD root node: " + root);
      incRef(root);
      return root;
    }
docs: Adds a reference for a given node.  Reference counting is done on externally referenced nodes only and the count for
  a specific node {@code r} can and must be increased using this function to avoid loosing the node in the next
  garbage collection.
  @param root the node
  @return return the node
  @throws IllegalArgumentException if the root node was invalid