graph - Neo4j/Gremlin/Cypher: how to get all nodes until i reach a certain distance (depth) in a map-like setup? -
graph - Neo4j/Gremlin/Cypher: how to get all nodes until i reach a certain distance (depth) in a map-like setup? - i have simple graph fields - each fields has 4 neighbours (north-east-south-west): @nodeentity public class field { @graphid long id; field north; field east; field south; field west; //.. other stuff } i graph db (neo4j) set these nice , connected (like grid). want nodes - starting node - i.e. 5 hops away. with classic traverses works fine , looks this: public collection<field> getfieldswithdepth(field startfield, final int depth) { node fieldnode = this.getgraphdb().getnodebyid(startfield.getid()); traverser traverser = fieldnode.traverse(traverser.order.breadth_first, // check direct relations first, go deeper new stopevaluator() { @override public boolean isstopnode(traversalposition pos) { if (pos.depth()==depth) ...