I am new to Cypher and Neo4j. I am trying to detect paths that start and end at the same node. But I have observed that the same pattern is getting detected multiple times. Below is my cypher query
PROFILE MATCH path=(t1:person)-[:Knows*4]->(t2:person)
WHERE t1.name=t2.name //(name is unique in my case)
The problem with this query if A-->B-->C-->D-->A is a pattern, it also returns
My graph is huge and since the pattern is getting repeated I am facing a memory out error. Please let me know how do I avoid this repetition.