title: Neo4j Java Traversal - Find Outgoing/Incoming Nodes
body: <p>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: </p>
  
  <pre><code>    ArrayList&lt;Node&gt; outputList = new ArrayList&lt;&gt;();
  
      for (Node connectedNode: nodeTraversal.relationships()
                                            .evaluator(Evaluators.toDepth(1))
                                            .traverse(this.inputNode)
                                            .nodes()) {
          outputList.add(connectedNode) ;
      }
  </code></pre>
  
  <p>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 ? </p>