private void createRelationships( BatchTransaction tx, Node node, RelationshipType type, Direction direction, int count) { for (int i = 0; i < count; i++) { Node firstNode = direction == OUTGOING || direction == BOTH ? node : db.createNode(); Node otherNode = direction == INCOMING || direction == BOTH ? node : db.createNode(); firstNode.createRelationshipTo(otherNode, type); tx.increment(); } }