code: public <E> ObjectGraph generateGraph(E entity, PersistenceDelegator delegator, NodeState state)
      {
  
          this.builder.assign(this);
          Node node = generate(entity, delegator, delegator.getPersistenceCache(), state);
          this.builder.assignHeadNode(node);
          return this.builder.getGraph();
      }
docs: Generate entity graph and returns after assigning headnode. n
  
  @param entity
  entity.
  @param delegator
  delegator
  @param pc
  persistence cache
  @return object graph.