public void testNeo4jRaw() throws Exception {
    double totalTime = 0.0d;
    Graph graph = graphTest.getGraphInstance();
    GraphMLReader.inputGraph(graph, GraphMLReader.class.getResourceAsStream("graph-example-2.xml"));
    graph.shutdown();

    for (int i = 0; i < TOTAL_RUNS; i++) {
      graph = graphTest.getGraphInstance();
      GraphDatabaseService neo4j = ((Neo4jGraph) graph).getRawGraph();
      int counter = 0;
      this.stopWatch();
      for (final Node node : neo4j.getAllNodes()) {
        counter++;
        for (final Relationship relationship : node.getRelationships(Direction.OUTGOING)) {
          counter++;
          final Node node2 = relationship.getEndNode();
          counter++;
          for (final Relationship relationship2 : node2.getRelationships(Direction.OUTGOING)) {
            counter++;
            final Node node3 = relationship2.getEndNode();
            counter++;
            for (final Relationship relationship3 : node3.getRelationships(Direction.OUTGOING)) {
              counter++;
              relationship3.getEndNode();
              counter++;
            }
          }
        }
      }
      double currentTime = this.stopWatch();
      totalTime = totalTime + currentTime;
      BaseTest.printPerformance(
          neo4j.toString(), counter, "Neo4j raw elements touched", currentTime);
      graph.shutdown();
    }
    BaseTest.printPerformance(
        "Neo4jRaw", 1, "Neo4j Raw experiment average", totalTime / (double) TOTAL_RUNS);
  }
Exemple #2
0
 public String toString() {
   return StringFactory.graphString(this, baseGraph.toString());
 }