Search code examples
neo4jcypher

path traversal termination based on customized functions


I have a graph

  Y1 Y11     Y2 Y22
   \/         \/
   X1         X2
   |          |
A->B->..->C.->B->E

I want to find the path from A to E. However, whether this path is valid depends on the properties on Y1, Y2, and C. But I can check the properties of Y1, Y2, and C independently using some customized function.

I know using UDF with java is one way to achieve this, but if I am not using Java, what is the best way to achieve this? I guess I can still write a UDF in java and use query to call the UDF?


Solution

  • When you don't want to use java, there's also still apoc to create your own functions and procedures. See https://neo4j.com/labs/apoc/4.1/overview/apoc.custom/