GitHub user okram opened a pull request:
https://github.com/apache/tinkerpop/pull/549
TINKERPOP-1617: Create a SingleIterationStrategy which will do its best to
rewrite OLAP traversals to not message pass.
https://issues.apache.org/jira/browse/TINKERPOP-1617
There are various traversals that can be rewritten using `local()` that
will enable the `GraphComputer` to avoid a message pass and thus, can
accomplish the computation in a single scan of the graph. Benefiting traversal
examples include:
```
g.V().out().id() --> g.V().local(out().id())
g.V().out().id().count() --> g.V().local(out().id()).count()
g.V().out().id().dedup().count()
g.V().inE().values("weight") // realize that in-edges are hosted by the
out-vertex
g.V().inE().values("weight").sum()
g.V().both().count()
g.V().inE().count()
g.V().as("a").outE().inV().as("b").id().dedup("a", "b").by(T.id).count()
```
Finally, the traversal that sparked this PR:
```
g.V().in().id().select("articleNumber").dedup().count() // requires one
message pass
==translatesTo==>
g.V().local(in().id().select("articleNumber")).dedup().count() // requires
no message passing
```
`SingleIterationStrategy` plays well with `SparkSingleIterationStrategy`
which determines whether it is necessary to `cache()` and/or `partition()` the
graph. If the traversal can be accomplished without a message pass (i.e. a
single iteration), then performance is greatly improved as RDD partitions can
be dropped as they are processed sequentially.
VOTE +1.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1617
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/549.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #549
----
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---