Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning InV step in gremlin terminology?

Tags:

gremlin

in particular following the tutorial here: https://kelvinlawrence.net/book/Gremlin-Graph-Guide.html#walk (3.3.2)

I do not understand this statement outE().inV()

Taken from g.V().has('airport','code','LCY').outE().inV().path()

The explanation is:

"Start at the LCY vertex, find all outgoing edges and also find all of the vertices that are on the other ends of those edges". The inV step gives us the vertex at the other end of the outgoing edge.

and then in 3.3. Starting to walk the graph we find in Table 1 the following definition:

outV Outgoing vertex.

inV Incoming vertex.

How on earth Incoming vertex = the vertex at the other end of the outgoing edge

If anything, i would think that the vertex at the other end of the outgoing edge if the OutV and not InV.

Hence can someone clarify the meaning of both inV and outV ?

Are we saying that if i have a directed Edge A -> B, the incoming vertex of that Edge, is B, and the Outgoing Vertex of that Edge is A ? Not sure, but if so, how the basis of that terminology, it sounds counter intuitive as it sees to be the opposite when working with Vertex.

like image 566
MaatDeamon Avatar asked Jul 01 '20 11:07

MaatDeamon


1 Answers

It's all depends on the point of view.

From a direct edge point of view, the edge is going out from a vertex and getting into another, so the starting point will be the outV and the endpoint will be the inV .

For the vertex point of view it will be the opposite, the outgoing vertices will be the one that connected from me to them. for that case, you can use the out step that goes directly to the outgoing vertex (equivalent to outE().inV()).

I understand your confusion I was struggling with that also at the beginning.

like image 51
noam621 Avatar answered Dec 19 '22 21:12

noam621