/**
  * Append some vertices to an out-of-core partition.
  *
  * @param partitionId Id of the destination partition
  * @param vertices Vertices to be added
  * @throws IOException
  */
 private void appendVertices(Integer partitionId, Collection<Vertex<I, V, E, M>> vertices)
     throws IOException {
   File file = new File(getPartitionPath(partitionId));
   DataOutputStream outputStream =
       new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file, true)));
   for (Vertex<I, V, E, M> vertex : vertices) {
     vertex.write(outputStream);
   }
   outputStream.close();
 }
 /**
  * Write a partition to disk.
  *
  * @param partition The partition object to write
  * @throws java.io.IOException
  */
 private void writePartition(Partition<I, V, E, M> partition) throws IOException {
   File file = new File(getPartitionPath(partition.getId()));
   file.getParentFile().mkdirs();
   file.createNewFile();
   DataOutputStream outputStream =
       new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
   for (Vertex<I, V, E, M> vertex : partition.getVertices()) {
     vertex.write(outputStream);
   }
   outputStream.close();
 }