Closed omidb closed 9 years ago
can you provide a sample graph please? in a way that let's me explore it.
What do you mean by recursively? if you just do g.v(1).outE("friend")
that gives you the edges you describe..
I want to find all path available with "friend" edge: g.v(1).outE("friend").outE("friend")..... so the result will be all paths from v(1) which can be connected by this edge.
So you want to find all paths like v1->e(friend)->v2, v1->e(friend)->v3, v1->e(friend)->e(friend)->v4
?
You can do that with a combination of jump (former loop) and path.
Similar to http://gremlindocs.com/#recipes/shortest-path (which is Gremlin 2.x).
So the thing that I want is like this (it's gremlin way and I don't know the Tinkerpop3 way, in Tinkerpop3 loop has replaced by jump):
g = TinkerGraphFactory.createTinkerGraph() ==>tinkergraph[vertices:6 edges:6] gremlin> g.v(1).as('x').out('knows').loop('x'){it.loops<3}{true} ==>v[2] ==>v[4] gremlin> g.v(1).out.loop(1){it.object.id != "5" && it.loops < 6}.path
How would be the Scala gremlin way to write it? (a jump example would be very helpful as well)
Interestingly I just prepared a similar example. Here's how it works at the moment, however one lesson from this is that I'll rename a few methods in GremlinScala, so stay tuned..
Cool, it would be great if we have very general kind of big example graph and try to implement different methods on it in example project.
It's not a Gremlin Scala specific question, I want to know what would be the simplest way to recursively find all path from node v1 that has out edge labeled of "friend". Basically exploring the whole graph from v1.
thanks