finding Mutual Friend in Gremlin

325 views
Skip to first unread message

Aashis Khanal

unread,
Jul 3, 2015, 6:42:24 AM7/3/15
to gremli...@googlegroups.com
Hello everyone, I am new to titan and gremlin. I need a query to find mutual friends between two users(vertices). Please someone help me??
Thank you in advance.

Daniel Kuppitz

unread,
Jul 3, 2015, 6:59:20 AM7/3/15
to gremli...@googlegroups.com
Hi Aashis,

since you are new to Titan, I assume that you also started with the latest version (0.9) which uses TP3:

friend1 = ...;
friend2 = ...;
g.V(friend1).both("friend").where(both("knows").is(eq(friend2))) // mutual friends of friend1 and friend2

Cheers,
Daniel


On Fri, Jul 3, 2015 at 5:52 AM, Aashis Khanal <aashis...@tektak.com> wrote:
Hello everyone, I am new to titan and gremlin. I need a query to find mutual friends between two users(vertices). Please someone help me??
Thank you in advance.

--
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/a0c48d95-3ec1-43e2-844c-a9ec0b416b0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Kuppitz

unread,
Jul 3, 2015, 7:00:11 AM7/3/15
to gremli...@googlegroups.com
Dah, typo. Correction:

g.V(friend1).both("friend").where(both("friend").is(eq(friend2)))

Cheers,
Daniel
Reply all
Reply to author
Forward
0 new messages