Documentation states there should be a mid-traversal .E() step?
Just wondering if I'm missing something, or if the docs are mistaken. It's possible to do a mid-traversal
.V()
step. But it seems like a possible copy paste error is in the Tinkerpop docs asserting a similar power exists for an .E()
step?
https://tinkerpop.apache.org/docs/current/reference/#e-step
Trying to execute a mid-traversal E() step, at least against JanusGraph from gDotV appears to not register as a valid step, on the off chance that's meaningful context.
Looking around I found an old post from 2020 from I believe @spmallette seems to confirm a mid-traversal E() step is not intended to exist despite the docs implying the contrary which got me thinking the docs may have been unintentionally copy pasted from the V() documentation.
https://groups.google.com/g/gremlin-users/c/xVzQRLcgQk4/m/L_5uSjSCAgAJ
I was hoping to leverage one in order to have a mid-traversal change to a different edge amongst a batch and leverage a composite index over edges that, at least for the first edge, starts off with g.E().has('edge_label', 'edge_property', 'edge_value').where(outV().has(...
and then later go a pivot to a later .E()
step like you can do with a .V()
.
Doing g.V().has('out_v_label', 'out_v_property', 'out_v_property_value').outE('edge_label).has('edge_property', 'edge_value')
in comparison is significantly slower. Local testing seems to be 6ms for the g.E()...
traversal compared to 121ms for the g.V()...
pathway.
The vertex in question has about 21k edges coming off it, so it's not surprising going from the vertex (which out_v_property
is also indexed) and checking for a match among the properties of 21k edges is significantly slower than instead of just "starting" on the matching edge based on a property that's indexed directly.Solution:Jump to solution
Mid-traversal E() has been added to TinkerPop in version 3.7.0. JanusGraph v1.0 is based on TP 3.7.0, so have to support it.
2 Replies
Solution
Mid-traversal E() has been added to TinkerPop in version 3.7.0. JanusGraph v1.0 is based on TP 3.7.0, so have to support it.
D'oh. 🤦♂️ Thank you! I didn't realize how recently this was added. There is a "Since" field on the backing JavaDoc that I now realized I overlooked.
For anyone else that runs into this:
Changelog for 3.7.0 mentions it:
https://github.com/apache/tinkerpop/blob/master/CHANGELOG.asciidoc#tinkerpop-370-release-date-july-31-2023
And the underlying jira:
https://issues.apache.org/jira/plugins/servlet/mobile#issue/TINKERPOP-2798
GitHub
tinkerpop/CHANGELOG.asciidoc at master · apache/tinkerpop
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.