code: public void deleteLeaf(T payload) {
      Preconditions.checkState(contains(payload), "the node does not exist");
      DirectedAcyclicGraphNode<T> node = mIndex.get(payload);
      Preconditions.checkState(node.getChildren().isEmpty(), "the node is not a leaf");
  
      // delete from parent
      for (DirectedAcyclicGraphNode<T> parent : node.getParents()) {
        parent.removeChild(node);
      }
  
      // remove from index
      mIndex.remove(payload);
  
      if (node.getParents().isEmpty()) {
        mRoots.remove(node);
      }
    }
docs: Deletes a leaf DAG node that carries the given payload.
  
  @param payload the payload of the node to delete