/**
  * Read a partition from disk.
  *
  * @param partitionId Id of the partition to read
  * @return The partition object
  * @throws IOException
  */
 private Partition<I, V, E, M> readPartition(Integer partitionId) throws IOException {
   Partition<I, V, E, M> partition = new Partition<I, V, E, M>(conf, partitionId);
   File file = new File(getPartitionPath(partitionId));
   DataInputStream inputStream =
       new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
   int numVertices = onDiskPartitions.get(partitionId);
   for (int i = 0; i < numVertices; ++i) {
     Vertex<I, V, E, M> vertex = conf.createVertex();
     vertex.readFields(inputStream);
     partition.putVertex(vertex);
   }
   inputStream.close();
   file.delete();
   return partition;
 }