> I am still a noob in Gremlin, playing with an Octree-Graph structure with additional geometric "left-of" "above-of"... links between the nodes.
>
> Currently I am searching for an example on how to use the "RandomFilterPipe" to populate my Octree with random data to finally test a pattern-search algorithm in it.
> I understood the functionality of pipes and filters but I struggle with the syntax on how to use the RandomFilterPipe. Is it already a predefined step or do I have to instantiate it before I can use it?
Gremlin 1.2 does NOT provide reference to RandomFilterPipe. Gremlin 1.3-SNAPSHOT does via random(double).
RandomFilterPipe is like any other FilterPipe in that it will either allow or not allow an object to pass through it. It uses a "biased coin" (the double you provide is the bias where 0.0 is always filter and 1.0 is always allow) that is "flipped" for each object passing. If the coin lands "heads", the object is allowed. If "tails," it is filtered. My initial application for RandomFilterPipe (and 'random'-step) is for sampling your walks. For example, you may have 1000 path emanating/branching from a source. You can use RandomFilterPipe to randomly sample only so many of those branches... A traversal pruning mechanism of sorts.
As I said, its NOT provided direct reference in Gremlin 1.2, but is in 1.3-SNAPSHOT. To make it available to Gremlin 1.2, you can simply define a step as such:
gremlin> Gremlin.defineStep('rand', [Pipe, Vertex], { final double bias -> new RandomFilterPipe(bias)});
==>null
gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.v(1).out.rand(0.5)
gremlin> g.v(1).out.rand(0.5)
==>v[2]
==>v[4]
gremlin> g.v(1).out.rand(0.5)
==>v[4]
gremlin> g.v(1).out.rand(0.5)
==>v[4]
gremlin> g.v(1).out.rand(0.5)
gremlin> g.v(1).out.rand(0.5)
==>v[4]
Finally, note that the Gremlin wiki is always up to date with the latest SNAPSHOT of Gremlin, not the last stable release. This is for the convenience of the developers -- unfortunately. The documentation for Gremlin 1.2 comes distributed with Gremlin 1.2 as textile files in doc/wiki.
Good luck and welcome to TinkerPop,
Marko.