private JobCache buildJobCache(final JobDescriptor job) {
			LocalPhysicalGraph graph = jobInfo.getLocalPhysicalGraph(job);
			Collection<LocalVertex> vertices = graph.vertices();
			ArrayList<LocalPhysicalVertex> targetList = new ArrayList<>();
			for (LocalVertex v : vertices) {
				if (v instanceof LocalPhysicalVertex)
					targetList.add((LocalPhysicalVertex)v);
			}

			Collections.sort(targetList, new LocalVertexOrder());

			LocalPhysicalVertex[] lpvs = new LocalPhysicalVertex[targetList.size()];
			ArrayList<Integer> localVertexCounts = new ArrayList<>();
			int lastGlobalid = targetList.get(0).getGlobalVertexId();
			int localVertexCount = 0;
			for (int i = 0; i < targetList.size(); i++) {
				lpvs[i] = targetList.get(i);
				if (lpvs[i].getGlobalVertexId() != lastGlobalid) {
					localVertexCounts.add(localVertexCount);
					lastGlobalid = lpvs[i].getGlobalVertexId();
					localVertexCount = 0;
				}
				localVertexCount++;
			}
			localVertexCounts.add(localVertexCount);

			int[] localVertexCountArray = new int[localVertexCounts.size()];
			for (int i = 0; i < localVertexCountArray.length; i++)
				localVertexCountArray[i] = localVertexCounts.get(i);

			JobCache ret = new JobCache(job, lpvs, localVertexCountArray, jobInfo.getJobScheduler(job), jobInfo.getLocalPhysicalGraph(job));
			return ret;
		}