コード例 #1
0
  private void AddEdgesIntoDanfAndUpdateMeasurements(DANF danf, Edge[] edges) {
    long beforeDanf = System.currentTimeMillis();
    danf.addEdges(edges);
    long afterDanf = System.currentTimeMillis();

    totalDanfTime += afterDanf - beforeDanf;
    danfEps = (float) added / totalDanfTime * 1000;

    danfGraphGB = danf.getMemoryUsageGraphBytes() / (float) bytesPerGigaByte;
    danfCounterGB = danf.getMemoryUsageCounterBytes() / (float) bytesPerGigaByte;
    danfVCGB = danf.getMemoryUsageVCBytes() / (float) bytesPerGigaByte;
    danfMSBFSGB = danf.getMemoryUsageMsBfsBytes() / (float) bytesPerGigaByte;
    danfTotalMemory = danfGraphGB + danfCounterGB + danfVCGB + danfMSBFSGB;
  }
コード例 #2
0
  public void benchmark() throws IOException, InterruptedException {

    MutableGraph graph = new ImmutableGraphWrapper(BVGraph.loadMapped(graphFile));
    MutableGraph graph2 = new ImmutableGraphWrapper(BVGraph.loadMapped(graphFile));

    DANF danf = new DANF(h, log2m, graph);
    TrivialDynamicANF tanf = new TrivialDynamicANF(h, log2m, graph2);

    PrintWriter writer = new PrintWriter(dataFile);
    writer.println(
        "%"
            + dateString
            + " "
            + graphName
            + " "
            + maxBulkSize
            + " edges will be inserted into DANF in bulks of "
            + bulkSize
            + ". The time measured is the time to insert "
            + bulkSize
            + " edges.; h is set to "
            + h
            + " and log2m is "
            + log2m
            + ";");
    writer.println(
        "%BulkSize DanfEPS DanfGraphMemory DanfCounterMemory DanfVcMemory DanfMsbfsMemory TrivialEPS TrivialMemory nrArcs nrNodes");

    while (bulkSize <= maxBulkSize) {
      Edge[] edges = generateEdges(graph.numNodes(), bulkSize);

      AddEdgesIntoDanfAndUpdateMeasurements(danf, edges);
      addEdgesIntoTanfAndUpdateMeasurements(tanf, edges);

      writer.println(
          bulkSize
              + " "
              + danfEps
              + " "
              + danfGraphGB
              + " "
              + danfCounterGB
              + " "
              + danfVCGB
              + " "
              + danfMSBFSGB
              + " "
              + trivialEps
              + " "
              + trivialTotalMemory
              + " "
              + added
              + " "
              + graph.numNodes());
      writer.flush();

      System.out.println(
          bulkSize
              + " edges, "
              + danfEps
              + " Danf DPS, "
              + danfTotalMemory
              + "GB DANF memory, "
              + trivialEps
              + " Trivial DPS, "
              + trivialTotalMemory
              + "GB trivial memory, "
              + added
              + " "
              + graph.numNodes());

      added += bulkSize;
      bulkSize += bulkSizeIncrease;
    }

    danf.close();
    writer.close();
  }