@Override
 protected void preSubmit() throws Exception {
   verticesPath =
       createTempFile(
           "vertices.txt", ConnectedComponentsData.getEnumeratingVertices(NUM_VERTICES));
   edgesPath =
       createTempFile(
           "edges.txt",
           ConnectedComponentsData.getRandomOddEvenEdges(NUM_EDGES, NUM_VERTICES, SEED));
   resultPath = getTempFilePath("results");
 }
  @SuppressWarnings("serial")
  @Test
  public void testRun() throws Exception {
    int verticesCount = 5000;
    int edgesCount = verticesCount * 2;

    ExecutionEnvironment environment = ExecutionEnvironment.getExecutionEnvironment();
    environment.getConfig().disableSysoutLogging();

    Graph<Long, Long, Long> graph =
        GraphGenerator.generateGraph(verticesCount, edgesCount, environment);

    PCConnectedComponents<Long, Long> algo = new PCConnectedComponents<>(verticesCount);

    List<Tuple2<Long, Long>> result =
        algo.run(graph)
            .map(
                new RichMapFunction<Vertex<Long, Long>, Tuple2<Long, Long>>() {
                  @Override
                  public Tuple2<Long, Long> map(Vertex<Long, Long> value) throws Exception {
                    return new Tuple2<>(value.getId(), value.getValue());
                  }
                })
            .collect();

    ConnectedComponentsData.checkOddEvenResult(result);
  }
 @Override
 protected void postSubmit() throws Exception {
   for (BufferedReader reader : getResultReader(resultPath)) {
     ConnectedComponentsData.checkOddEvenResult(reader);
   }
 }