arc_rider
arc_rider
ATApache TinkerPop
Created by arc_rider on 4/7/2023 in #questions
Using a SeedStrategy in javascript to control shuffle.
On my project we are trying to select random vertices from the graph and use a seed to keep the results predictable. The docs mention passing in a SeedStrategy like so:
seedStrategy = new SeedStrategy(999998L)
g.withStrategies(seedStrategy).V().values('name').fold().order(local).by(shuffle)
seedStrategy = new SeedStrategy(999998L)
g.withStrategies(seedStrategy).V().values('name').fold().order(local).by(shuffle)
However we are unable to figure out the import for the SeedStrategy class. We have tried on Gremlin version 3.4.6 and 3.6.2 and both seem to be missing SeedStrategy. Are there any know issues with strategies in javascript or alternate ways of seeding randomness in Gremlin? We have currently tried exploring the properties of the gremlin.process. Importing it off of the process object. We can get a generic "traversalStrategy" however that doesn't seem to have the one we are looking for. const foo = gremlin.process.TraversalStrategy // valid const foo = gremlin.process.SeedStrategy // invalid We are using the following packages: Typescript types: https://www.npmjs.com/package/@types/gremlin Gremlin NPM package: https://www.npmjs.com/package/gremlin
8 replies