TinkerPop3 - Finding a same edge between two vertices?

657 views
Skip to first unread message

Gema Wardian

unread,
Feb 9, 2016, 11:58:39 PM2/9/16
to Gremlin-users
Hello,

Is there anyway to find the same edge between two vertices?

I noticed most of the tutorial are for TinkerPop2 and below.

http://gremlindocs.spmallette.documentup.com/#finding-edges-between-vertices
http://www.tinkerpop.com/docs/wikidocs/gremlin/2.1.0/Finding-All-Paths-Between-2-Vertices.html

Is there anyway to do this on Tinkerpop3?

Daniel Kuppitz

unread,
Feb 10, 2016, 12:01:42 AM2/10/16
to gremli...@googlegroups.com
What do you mean by "same edge"? The two links show different things; the first one shows how to find edges between 2 vertices, the second show how to find paths between to vertices.
Everything is possible in TP3, I'm just not sure what you're looking for.

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/c04e2996-b967-4c0a-b3ea-c08aba95650b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gema Wardian

unread,
Feb 10, 2016, 12:19:24 AM2/10/16
to Gremlin-users
Sorry, wrong example.

I meant to find use this code

g.v(1).bothE.as('x').bothV.retain([g.v(3)]).back('x')

But that code isn't worked in TinkerPop3.
Also I wanted to filter the result that had same edge name that was defined by me.

Daniel Kuppitz

unread,
Feb 10, 2016, 12:35:02 AM2/10/16
to gremli...@googlegroups.com
g.V(1).bothE(yourEdgeLabel).filter(otherV().hasId(3))

Sorry for the formatting, writing the answer with my phone, hence no Courier font :)

If it fails, start the traversal with g.withPaths()... That shouldn't be needed, but I'm not sure if it was already fixed.

Cheers,
Daniel

From: Gema Wardian
Sent: ‎2/‎10/‎2016 6:19
To: Gremlin-users
Subject: Re: [TinkerPop] TinkerPop3 - Finding a same edge between twovertices?

Gema Wardian

unread,
Feb 10, 2016, 1:33:58 AM2/10/16
to Gremlin-users
Oh man,That code worked correctly.

Thanks a bunch for your time.

Pheonix Basic

unread,
Feb 10, 2016, 7:44:30 AM2/10/16
to Gremlin-users
Is there anyway to loop the process to inserting the hasID from a set of ID?

Daniel Kuppitz

unread,
Feb 10, 2016, 7:46:14 AM2/10/16
to gremli...@googlegroups.com
For a set of ids you can replace .hasId(3) with .has(id, within(setOfIds)).

Cheers,
Daniel


Gema Wardian

unread,
Feb 11, 2016, 2:34:12 AM2/11/16
to Gremlin-users
Hi Daniel,

I'm using your query right now from 2 vertices.
g.V().has('name', within('A', 'B')).bothE('AtoB').filter(otherV().hasId(10))

Is there anyway to automatically filter the result that had the same otherV() ID without specifying it?

using equal or not equal some of function perhaps? I'm coming new to this graph thing, all I do is SQL.

Thanks.

Daniel Kuppitz

unread,
Feb 11, 2016, 8:50:59 AM2/11/16
to gremli...@googlegroups.com
Hmm, somehow I don't get what you mean by "the same otherV() ID". Can you please try to clarify.

Perhaps show a SQL query, I think that might help :).

Cheers,
Daniel


Reply all
Reply to author
Forward
0 new messages