public void ingestPairsWithCalculatedIDs(int vert) { int idLength = 8; for (int i = 0; i < vert; i++) { Map<String, String> personProperties = new HashMap<String, String>(); personProperties.put("age", i + ""); personProperties.put("firstname", "John" + i); personProperties.put("lastname", "Doe" + i); // Calculate id of given size from attributes: String id = IDUtils.md5(personProperties, idLength); Vertex person = graph.addVertex(id); person.setProperty("age", i); person.setProperty("firstname", "John" + i); person.setProperty("lastname", "Doe" + i); Map<String, String> locationProperties = new HashMap<String, String>(); locationProperties.put("address", i + ""); // Calculate id of given size from attributes: String id2 = IDUtils.md5(locationProperties, idLength); Vertex location = graph.addVertex(id2); location.setProperty("address", i); Edge edge = graph.addEdge(i, person, location, "edge"); edge.setProperty("fr", i); } }
public void ingestPairs(int vert) { StopWatch timer = new StopWatch(); timer.start(); for (int i = 0; i < vert; i++) { Vertex person = graph.addVertex("p" + i); person.setProperty("type", "person"); person.setProperty("age", i); person.setProperty("firstname", "John" + i); person.setProperty("lastname", "Doe" + i); Vertex location = graph.addVertex("l" + i); location.setProperty("type", "location"); location.setProperty("address", "address" + i); Edge edge = graph.addEdge(i, person, location, "e"); edge.setProperty("type", "lived at"); edge.setProperty("from", "199" + i); edge.setProperty("to", "201" + i); } System.out.println("Created graph\n"); }