I am using Gremlin-Scala and I have the following code:
val paths = w.as("a").out("next").jump(
to = "a",
jumpPredicate = { t: Traverser[Vertex] =>
t.loops < 5
}
).path.toList
I don't know when my loop will finish, so I have no access to the size and if I put wrong number for x in t.loops > x then I will have problem. I changed my code in following and it works well. it has two problems (1- it's ugly 2- I have to call get() which I think is not efficient) Is there better way to do this?
val paths = w.as("a").out("next").jump(
to = "a",
jumpPredicate = { t: Traverser[Vertex] =>
t.get().out("next").size > 0
}
).path.toList