I am trying to get all the incoming and outgoing nodes for a specific node in Neo4j using the traverser. My code looks like this:
ArrayList<Node> outputList = new ArrayList<>();
for (Node connectedNode: nodeTraversal.relationships()
.evaluator(Evaluators.toDepth(1))
.traverse(this.inputNode)
.nodes()) {
outputList.add(connectedNode) ;
}
the relationships() functions needs a relationship name as an argument but I would like to get all outgoing nodes regardless of the relationships the node is connected to. What is the most time efficient way to achieve this ?