I was trying to run a gremlin query to find k distance vertices from a given vertex v and omit directly connected vertices to v.
I am using Gremlin 3.2.6.
So, something like this, for a k-distance(friend of friend) isn't working properly
g.V(v).both().as(“x”).repeat(both()).times(k).where(neq("x")).dedup()
The above should omit the vertices in "x" but it is not. My graph is directed and there may be edges in both directions between a pair of vertices.
Also, how do I make this general for given distances less than some k using loops(having a hard time with it) and is there some way to print the distance along with the vertex list. Thanks.