Duplicate nodes merges everything

Hie,

I am having a csv like (a sample created to state my data)


so on loading it into neo4j i got

Here just becasue the 4th node(or by image id 12) is same for both the paths they've merged into one. Can I avoid this, since nodes connected from 4th node are unique to thier paths.

Thanks in advance.

Post the MERGE cypher you're using to create this.

A common slight error with merge is that it merges the full unique pattern. So if you're merging longer paths, you can end up with duplicates if sub-paths (like 12 to 7 here) occur in multiple different longer paths.

A solution is to break down your load into a set of pairwise relationships; think about always merging (a)-[:r]->(b) and don't write merges like (:a)-[:r]->(b)-[:r]->(c) because it could duplicate the a-b relationship

The Cypher query i used


As I was dealing with dynamic relationship I had to go with apoc for creating the relationship.

Using create instead of merge helped me solve the issue, but now i have unique nodes for all like


Since the path is same except for the last node can I merge them?