I have a graph with a structure like this:
I need to return all the return all :Treasure which was not :FOUND_BY more than 1 :User, either directly (red path), or via their :Group (blue path).
My cypher
MATCH (t:Treasure)
// WHERE with other conditions
WITH t, SIZE((t)-[:FOUND_BY|MEMBER_OF*1..2]-(:User))) as finders
WHERE finders < 2
RETURN t
returns the nodes I'm looking for, but spends horrendous time on expanding that variable path. How could I optimise this cypher, get rid of the variable path, but keep the same results?
