aws / amazon-neptune-gremlin-java-sigv4

A Gremlin client for Amazon Neptune that includes AWS Signature Version 4 signing.
Apache License 2.0
27 stars 12 forks source link

Fetch all the incoming and outgoing nodes and edges of a particular node #10

Closed shukla200 closed 4 years ago

shukla200 commented 5 years ago

I want to fetch all the incoming nodes and edges of a particular node with its data from the Amazon neptune GraphDB. I wrote some gremlin queries- 1) To fetch all the outgoing nodes and edges of the given nodeId--

g.V(nodeId).outE().as('outgoingEdges').inV().as('outgoingNodes').simplePath().select('outgoingEdges','outgoingNodes').by(__.valueMap(true)).toList();

It gives good performance result.

2) To fetch all the incoming nodes and edges of the given nodeId--

g.V(nodeId).inE().as('incomingEdges').outV().as('incomingNodes').simplePath().select('incomingEdges','incomingNodes').by(__.valueMap(true)).toList();

But it gives a very poor performance, instead, it is same as outgoing fetch query.

So, do I have any other way to fetch all the incoming nodes and edges of the particularly given node?

krlawrence commented 5 years ago

Hi @shukla200 - In general for questions like this feel free to post to the Neptune forum at [1]. It is likely that more people will notice questions there. Could you say a but more about the size of your graph and the number of incoming and outgoing edges there are on average. In general retrieving outgoing edges will be somewhat faster than retrieving incoming edges but it would be useful to understand the shape of your data a bit more. It would also be useful if you could share the .profile() results for each query. Cheers. Kelvin

[1] https://forums.aws.amazon.com/forum.jspa?forumID=253&start=0