private InputIterable nodes( final long randomSeed, final long count, int batchSize, final InputIdGenerator inputIdGenerator, final IdGroupDistribution groups ) { return () -> new GeneratingInputIterator<>( count, batchSize, new RandomsStates( randomSeed ), ( randoms, visitor, id ) -> { Object nodeId = inputIdGenerator.nextNodeId( randoms, id ); Group group = groups.groupOf( id ); visitor.id( nodeId, group ); randomProperties( randoms, uniqueId( group, nodeId ), visitor ); visitor.labels( randoms.selection( TOKENS, 0, TOKENS.length, true ) ); }, 0 ); }
private InputIterable relationships( final long randomSeed, final long count, int batchSize, final InputIdGenerator idGenerator, final IdGroupDistribution groups ) { return () -> new GeneratingInputIterator<>( count, batchSize, new RandomsStates( randomSeed ), ( randoms, visitor, id ) -> { randomProperties( randoms, "Name " + id, visitor ); ExistingId startNodeExistingId = idGenerator.randomExisting( randoms ); Group startNodeGroup = groups.groupOf( startNodeExistingId.nodeIndex ); ExistingId endNodeExistingId = idGenerator.randomExisting( randoms ); Group endNodeGroup = groups.groupOf( endNodeExistingId.nodeIndex ); // miss some Object startNode = idGenerator.miss( randoms, startNodeExistingId.id, 0.001f ); Object endNode = idGenerator.miss( randoms, endNodeExistingId.id, 0.001f ); visitor.startId( startNode, startNodeGroup ); visitor.endId( endNode, endNodeGroup ); String type = idGenerator.randomType( randoms ); if ( randoms.nextFloat() < 0.00005 ) { // Let there be a small chance of introducing a one-off relationship // with a type that no, or at least very few, other relationships have. type += "_odd"; } visitor.type( type ); }, 0 ); }