Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#addV()
The following examples show how to use
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#addV() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TraversalConstructionBenchmark.java From tinkerpop with Apache License 2.0 | 6 votes |
@Benchmark public GraphTraversal testAddVWithPropsChained() { // construct a traversal that adds 100 vertices with 32 properties each GraphTraversal t = null; for (int ix = 0; ix < 100; ix++) { if (null == t) t = g.addV("person"); else t = t.addV("person"); for (int iy = 0; iy < 32; iy++) { if (iy % 2 == 0) t = t.property("x" + String.valueOf(iy), iy * ix); else t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ix)); } } return t; }
Example 2
Source File: GraphMutateBenchmark.java From tinkerpop with Apache License 2.0 | 6 votes |
@Benchmark public Vertex testAddVWithPropsChained() { // construct a traversal that adds 100 vertices with 32 properties each GraphTraversal<Vertex, Vertex> t = null; for (int ix = 0; ix < 100; ix++) { if (null == t) t = g.addV("person"); else t = t.addV("person"); for (int iy = 0; iy < 32; iy++) { if (iy % 2 == 0) t = t.property("x" + String.valueOf(iy), iy * ix); else t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ix)); } } return t.next(); }
Example 3
Source File: TraversalConstructionBenchmark.java From tinkerpop with Apache License 2.0 | 5 votes |
@Benchmark public GraphTraversal testAddVAddEWithPropsChained() { // construct a traversal that adds 100 vertices with 32 properties each as well as 300 edges with 8 // properties each final Random rand = new Random(584545454L); GraphTraversal t = null; for (int ix = 0; ix < 10; ix++) { if (null == t) t = g.addV("person"); else t = t.addV("person"); for (int iy = 0; iy < 32; iy++) { if (iy % 2 == 0) t = t.property("x" + String.valueOf(iy), iy * ix); else t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ix)); } t = t.as("person" + ix); if (ix > 0) { int edgeCount = ix == 9 ? 6 : 3; for (int ie = 0; ie < edgeCount; ie++) { t = t.addE("knows").from("person" + ix).to("person" + rand.nextInt(ix)); for (int iy = 0; iy < 8; iy++) { if (iy % 2 == 0) t = t.property("x" + String.valueOf(iy), iy * ie); else t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ie)); } } } } return t; }
Example 4
Source File: GraphMutateBenchmark.java From tinkerpop with Apache License 2.0 | 5 votes |
@Benchmark public Edge testAddVAddEWithPropsChained() { // construct a traversal that adds 100 vertices with 32 properties each as well as 300 edges with 8 // properties each final Random rand = new Random(584545454L); GraphTraversal<Vertex, ?> t = null; for (int ix = 0; ix < 10; ix++) { if (null == t) t = g.addV("person"); else t = t.addV("person"); for (int iy = 0; iy < 32; iy++) { if (iy % 2 == 0) t = t.property("x" + String.valueOf(iy), iy * ix); else t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ix)); } t = t.as("person" + ix); if (ix > 0) { int edgeCount = ix == 9 ? 6 : 3; for (int ie = 0; ie < edgeCount; ie++) { t = t.addE("knows").from("person" + ix).to("person" + rand.nextInt(ix)); for (int iy = 0; iy < 8; iy++) { if (iy % 2 == 0) t = t.property("x" + String.valueOf(iy), iy * ie); else t = t.property("x" + String.valueOf(iy), String.valueOf(iy + ie)); } } } } final Edge e = (Edge) t.next(); return e; }