find all paths between two vertex using both ,how can I get the edges too?

38 views
Skip to first unread message

דניאלה אסף

unread,
Mar 25, 2015, 9:49:53 PM3/25/15
to gremli...@googlegroups.com
:the following query returns all paths between two vertexs (1 and 3) and it's edges

g.v(1).as('x').outE.inV.loop('x'){it.loops <= 10  }{it.object != null}.has('uid','3').path{it.map()}{it.label}

  but I would like to get all paths in all directions using both, but when I use bothE.bothV instead of outE.inV

.I get outofmemory exception 




Daniel Kuppitz

unread,
Mar 25, 2015, 10:01:28 PM3/25/15
to gremli...@googlegroups.com
The query will run forever (well, until you run out of memory) if you simply use .both(). You need to get rid of circular paths. Try this:

g.v(1).as('x').bothE().bothV().simplePath().loop('x') {it.loops <= 10} {it.object.uid == 3}.path {it.map()} {it.label}

Cheers,
Daniel


--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/055bec84-023f-4691-89ca-85971ef427b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages