I am having the scenario where I have multiple labels(Hashtags) and I need to get the exact mutual nodes(contributors) which are contributing on all the selected labels(Hashtags).
The Query I am using is
"WITH ["#Hashtag1","#Hashtag2","#Hashtag3"] as ids MATCH (n1:Hashtag),(n2:Hashtag) WHERE n1.id in ids and n2.id in ids and n1.id<>n2.id MATCH p = ((n1)-[*..2]-(n2)) RETURN p limit 2000"
In my use case I have 2 labels with the name (hashtag, contributor) and the relationship between them is "contributed_on".
What I want is to get all the mutual nodes of above three selected hashtags (labeled green in attached picture) in WITH clause, but from above query I am getting the data of hastag1 mutual to hashtag2 mutual, but I want only the mutual contributors(labeled pink within circle) as I highlighted in attached picture.
P.S : We may have any number of hashtags as input so I want the query to be dynamic also.