How can I get the list of nodes N
-hops away from a given node (where N
is a parameter)? Here, N
-hops means we need to traverse (minimum) N
edges (outward) from the source node to reach the destination node.
For 1
-hop, the query can be
g.V().hasLabel(source_node).outE().otherV().to_list()
What is an optimal query to generalise this to N
-hop?