Search in sources :

Example 1 with TitanLabel

use of com.thinkaurelius.titan.core.TitanLabel in project titan by thinkaurelius.

the class TitanGraphPerformanceMemoryTest method elementCreationPerformance.

@Test
public void elementCreationPerformance() {
    TitanLabel connect = makeSimpleEdgeLabel("connect");
    int noNodes = 20000;
    TitanVertex[] nodes = new TitanVertex[noNodes];
    PerformanceTest p = new PerformanceTest(true);
    for (int i = 0; i < noNodes; i++) {
        nodes[i] = tx.addVertex();
    }
    p.end();
    System.out.println("Time per node in (ns): " + (p.getNanoTime() / noNodes));
    p = new PerformanceTest(true);
    for (int i = 0; i < noNodes; i++) {
        new StandardEdge(i + 1, connect, (InternalVertex) nodes[i], (InternalVertex) nodes[(i + 1) % noNodes], ElementLifeCycle.New);
    }
    p.end();
    System.out.println("Time per edge in (ns): " + (p.getNanoTime() / noNodes));
    p = new PerformanceTest(true);
    for (int i = 0; i < noNodes; i++) {
        nodes[i].addEdge(connect, nodes[(i + 1) % noNodes]);
    }
    p.end();
    System.out.println("Time per edge creation+connection in (ns): " + (p.getNanoTime() / noNodes));
    tx.rollback();
    tx = null;
}
Also used : TitanVertex(com.thinkaurelius.titan.core.TitanVertex) TitanLabel(com.thinkaurelius.titan.core.TitanLabel) PerformanceTest(com.thinkaurelius.titan.testutil.PerformanceTest) StandardEdge(com.thinkaurelius.titan.graphdb.relations.StandardEdge) Test(org.junit.Test) PerformanceTest(com.thinkaurelius.titan.testutil.PerformanceTest)

Example 2 with TitanLabel

use of com.thinkaurelius.titan.core.TitanLabel in project titan by thinkaurelius.

the class EdgeSerializerTest method testValueOrdering.

@Test
public void testValueOrdering() {
    StandardTitanGraph graph = (StandardTitanGraph) StorageSetup.getInMemoryGraph();
    TitanLabel father = graph.makeLabel("father").manyToOne().make();
    for (int i = 1; i <= 5; i++) graph.makeKey("key" + i).single().dataType(Integer.class).make();
    TitanVertex v1 = graph.addVertex(null), v2 = graph.addVertex(null);
    TitanEdge e1 = v1.addEdge("father", v2);
    for (int i = 1; i <= 5; i++) e1.setProperty("key" + i, i);
    graph.commit();
    e1.remove();
    graph.commit();
}
Also used : TitanVertex(com.thinkaurelius.titan.core.TitanVertex) StandardTitanGraph(com.thinkaurelius.titan.graphdb.database.StandardTitanGraph) TitanLabel(com.thinkaurelius.titan.core.TitanLabel) TitanEdge(com.thinkaurelius.titan.core.TitanEdge) Test(org.junit.Test)

Aggregations

TitanLabel (com.thinkaurelius.titan.core.TitanLabel)2 TitanVertex (com.thinkaurelius.titan.core.TitanVertex)2 Test (org.junit.Test)2 TitanEdge (com.thinkaurelius.titan.core.TitanEdge)1 StandardTitanGraph (com.thinkaurelius.titan.graphdb.database.StandardTitanGraph)1 StandardEdge (com.thinkaurelius.titan.graphdb.relations.StandardEdge)1 PerformanceTest (com.thinkaurelius.titan.testutil.PerformanceTest)1