I used Jupyter notebook to insert the following vertices and edges into Neptune database.
%%gremlin
g.addV('my').property(T.id, '1').next()
g.addV('my').property(T.id, '2').next()
g.addV('my').property(T.id, '3').next()
g.addV('my').property(T.id, '4').next()
g.addV('my').property(T.id, '5').next()
g.addV('my').property(T.id, '6').next()
g.addV('my').property(T.id, '7').next()
g.addV('my').property(T.id, '8').next()
g.V('1').addE('parent').to(g.V('2')).next()
g.V('2').addE('parent').to(g.V('3')).next()
g.V('3').addE('parent').to(g.V('4')).next()
g.V('4').addE('parent').to(g.V('5')).next()
g.V('1').addE('parent').to(g.V('6')).next()
g.V('6').addE('parent').to(g.V('7')).next()
g.V('7').addE('parent').to(g.V('8')).next()
Then I used the follow query to find all ancestors for node "1". However, It only return node "5" and note "8", and highest level of ancestors.
How can I modify the query to get all the in-and-between ancestors like "2", "3", "4", "5", "6", "8"
%%gremlin -p v,oute,inv
g.V('1').repeat(out('parent')).until(outE('parent').count().is(0)).toList()