private <N extends InternalTitanVertex> void persist(
      ListMultimap<N, InternalRelation> mutatedEdges,
      Map<TitanType, TypeSignature> signatures,
      InternalTitanTransaction tx,
      StoreMutator mutator)
      throws StorageException {
    assert mutatedEdges != null && !mutatedEdges.isEmpty();

    Collection<N> vertices = mutatedEdges.keySet();
    //		if (sortNodes) {
    //			List<N> sortedvertices = new ArrayList<N>(vertices);
    //			Collections.sort(sortedvertices, new Comparator<N>(){
    //
    //				@Override
    //				public int compare(N o1, N o2) {
    //					assert o1.getID()!=o2.getID();
    //					if (o1.getID()<o2.getID()) return -1;
    //					else return 1;
    //				}
    //
    //			});
    //			vertices=sortedvertices;
    //		}

    for (N node : vertices) {
      List<InternalRelation> edges = mutatedEdges.get(node);
      List<Entry> additions = new ArrayList<Entry>(edges.size());
      List<ByteBuffer> deletions = new ArrayList<ByteBuffer>(Math.max(10, edges.size() / 10));
      List<TitanProperty> properties = new ArrayList<TitanProperty>();
      for (InternalRelation edge : edges) {
        if (edge.isRemoved()) {
          if (edge.isProperty()) {
            deleteIndexEntry((TitanProperty) edge, mutator);
          }
          deletions.add(getEntry(tx, edge, node, signatures, true).getColumn());
        } else {
          assert edge.isNew();
          if (edge.isProperty()) properties.add((TitanProperty) edge);
          additions.add(getEntry(tx, edge, node, signatures));
        }
      }
      mutator.mutateEdges(IDHandler.getKey(node.getID()), additions, deletions);
      // Persist property index for retrieval
      for (TitanProperty prop : properties) {
        addIndexEntry(prop, mutator);
      }
    }
  }
 public static double round(double d) {
   return Math.round(d * 1000.0) / 1000.0;
 }