MATCH p = (ra:Substance)-[:PRODUCT_OF|REAGENT_OF|REACTANT_OF * ..search_depth] ->(pr:Substance {inchikey:'target_inchikey'}) WHERE pr.inchikey <> ra.inchikey RETURN p Considering that Neo4j is a proprietary database, the exact implementation and choice of path finding algorithm when executing the Cypher queries remains elusive. However, there are known algorithms to solve the path finding problem, like the breadth first search (BFS) . BFS has with time complexity of O(b d ) where b is the branching factor and d is the depth of the search . According to Neo4j documentation, the database engine has an automated mechanism to select the appropriate method for the Cypher query at hand .