Conditional Query to Get full graph

For your case I believe that Recurse Query is ideal. We have nothing to do logical (conditional in this case) verification in the query. Unless you make a var block scheme (“waterfall” blocks). Or maybe use the logic found in math operations some how.

The most recommended would be you to expand your structure using @Recurse, hence in your application you control the logic of conditions.

https://docs.dgraph.io/query-language#recurse-query