Is there a way in Neo4j using either cypher or gremlin to return a list of nodes that have a common set of nodes between them?
An example would be
Person1-[KNOWS]->Friend1 Person1-[KNOWS]->Friend2 Person1-[KNOWS]->Friend3 Person2-[HATES]->Friend2 Person2-[HATES]->Friend3
I want to start with Person1 and say, “Find me people who hate all the people I know” who should return Person2 , since Person1 knows Friend2,Friend3 and Person2 hates Friend2,Friend3 ,
I started by looking for a connection,
START person=node(1) MATCH person-[KNOWS]->friend<-[HATES]-enemy RETURN enemy
but I can’t find a way to express it in such a way that Man should hate ALL friends.
Can this be done in Cypher?
source share