0

My gremlin query looks like this:

g.V.has('someProp','A').as('x').in.loop('x'){it.loops<100}{true}.path()

the result:

==>[v[768], v[1792]]
==>[v[768], v[1536]]
==>[v[768], v[1792], v[2048]]
==>[v[768], v[1792], v[2048], v[2304]]

But I don't want the intermediary paths in the result. I need just two complete paths: eg.:

==>[v[768], v[1536]]
==>[v[768], v[1792], v[2048], v[2304]]

Any ideas?

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
BadChanneler
  • 1,450
  • 1
  • 12
  • 20

1 Answers1

3

Already answered on the Gremlin users mailing list, but here it is again:

The {true} tells the loop step to emit all vertices, hence you'll see each and every path. This should work:

g.V().has('someProp','A').as('x').in()
   .loop('x') {it.loops<100} {!it.object.inE().hasNext()}.path()

Now loop() only emits those vertices that don't have an in-edge.

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
Daniel Kuppitz
  • 10,846
  • 1
  • 25
  • 34