Showing results for 
Search instead for 
Did you mean: 

How to update the tree nodes after update property in one of the nodes?

Node Link

Hello everyone!
I've already read a topic about the triggers and how to use them, but I have algorithm problem, and don't know how to implement this using neo4j syntax.

The problem:
I have a tree of groups with license amount. For instance 200 total amount of license

If group is limited = false, then it has amount of license of first limited group minus amount from child groups that limited is true.
If I change amount in one of the limited group I have to recalculate amount of unlimited groups
The result should looks like this
How can I traverse from the root node and select all the nodes which are (limited = false) and if found group during traversal which is limited = true how can I skip its child?
I was thinking about DFS but I cannot understand how to work with it by using Cypher syntax.
Maybe someone has an idea how to implement traversal with skip points?

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.