Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-30-2022 12:09 AM
I'm representing AND/OR trees in Neo4j as in the figure below (with AND and OR nodes and corresponding relationships). The tree's leaves are properties representing boolean values (green = true, red = false).
Now, I'm looking for an algorithm (or cypher query) to traverse each tree to know whether there is at least a valid path (a set of leaves that satisfies the AND/OR conditions) from the leaves or not to the tree's root. For example, in the figure there is such a path, thus the algorithm should return true (and perhaps also the nodes part of the path).
03-30-2022 07:07 AM
This problem is ideal for a custom procedure. If you want to go in this direction, I would be glad to help get you started or even develop something. I have developed procedures for my application that iterate over a tree to calculate metrics. This is the same, just a different metric.
Maybe one of the APOC experts has an alternative solution, so you don’t need to develop something.
All the sessions of the conference are now available online