I have a bunch of nodes with
unique_patients property as a list. I want to connect any two nodes through a relationship based on the non-empty intersection of this property. So far, my attempt in getting the number of intersections is as follows -
MATCH (a:Gene) MATCH (b:Gene) RETURN apoc.coll.intersection(a.unique_patients ,b.unique_patients) AS intersection;
However, this gives both empty and non-empty intersections. My questions are as follows:
- How to obtain non-empty intersections?
- How to make a relationship based on this non-intersection?
- How to make a relationship based on a minimum number of intersections, say at least 2 elements?
- How to set other properties of this relationship based on the properties of the nodes (like one of the properties could be the patients exclusive to each of the nodes)?
Thanks in advance.