Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dkuppitz/f76a7699ff78af20a0147b35a8c4041f to your computer and use it in GitHub Desktop.
Save dkuppitz/f76a7699ff78af20a0147b35a8c4041f to your computer and use it in GitHub Desktop.
Don't implement path as a step
gremlin> g.V().repeat(out()).emit().path()
==>[v[1],v[3]]
==>[v[1],v[2]]
==>[v[1],v[4]]
==>[v[1],v[4],v[5]]
==>[v[1],v[4],v[3]]
==>[v[4],v[5]]
==>[v[4],v[3]]
==>[v[6],v[3]]
gremlin> g.withSack {[]} {it.clone()} V().sack(addAll).by(fold()).repeat(out().sack(addAll).by(fold())).emit().sack()
==>[v[1],v[3]]
==>[v[1],v[2]]
==>[v[1],v[4]]
==>[v[1],v[4],v[5]]
==>[v[1],v[4],v[3]]
==>[v[4],v[5]]
==>[v[4],v[3]]
==>[v[6],v[3]]
@dkuppitz
Copy link
Author

dkuppitz commented May 4, 2019

gremlin> g.V().repeat(out()).emit().path().by("name").bytecode
==>[V(), sack("#path", add), by(name), repeat([[], [out(), sack("#path", add), by(name)]]), emit(), sack("#path")]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment