/**
  * returns a traverser for all nodes that have a hero relationship and are connected to the hero
  * collection node
  *
  * @return
  */
 private Traverser getHeroesByCollectionNodeViaRest() {
   TraversalDescription td =
       RestTraversal.description()
           .maxDepth(10)
           .breadthFirst()
           .relationships(RelTypes.HERO, Direction.OUTGOING);
   return td.traverse(this.restmdg.getHeroesCollectionNode());
 }
 /**
  * returns a traverser for all nodes that have an outgoing relationship of the type KNOWS
  *
  * @param person the startnode
  * @return the Traverser
  */
 private static Traverser getFriends(final Node person) {
   TraversalDescription td =
       RestTraversal.description()
           .maxDepth(10)
           .breadthFirst()
           .relationships(RelTypes.KNOWS, Direction.OUTGOING)
           .filter(Traversal.returnAllButStartNode());
   return td.traverse(person);
 }
 @Test
 public void testTraverseToNeighbour() {
   final Relationship rel = relationship();
   final TraversalDescription traversalDescription =
       RestTraversal.description().maxDepth(1).breadthFirst();
   System.out.println("traversalDescription = " + traversalDescription);
   final Traverser traverser = traversalDescription.traverse(rel.getStartNode());
   final Iterable<Node> nodes = traverser.nodes();
   Assert.assertEquals(rel.getEndNode(), nodes.iterator().next());
 }
 /**
  * returns a traverser for all nodes that have an outgoing relationship of the type HERO an are 3
  * positions down in the path
  *
  * @return the Traverser
  */
 private Traverser getHeroesViaRest() {
   TraversalDescription td =
       RestTraversal.description()
           .maxDepth(3)
           .breadthFirst()
           .relationships(RelTypes.PERSONS_REFERENCE, Direction.OUTGOING)
           .relationships(RelTypes.HEROES_REFERENCE, Direction.OUTGOING)
           .relationships(RelTypes.HERO, Direction.OUTGOING)
           .filter(ScriptLanguage.JAVASCRIPT, "position.length() == 3;");
   return td.traverse(this.restmdg.getGraphDatabase().getReferenceNode());
 }