I have a graph containing many nodes. Each node in the graph has the same properties with different values. I loaded the graph efficiently using:
CALL apoc.periodic.iterate('LOAD CSV FROM $url AS data FIELDTERMINATOR "," return data',
'CREATE (:G {x: data[0],y: data[1]})'
,{batchSize:1000, iterateList:true, parallel:trueparams:{url:"file:///file.csv"}});
I indexed the nodes based on properties.
I wanted to link nodes based on similar property value. I used:
MATCH (a:G )
MATCH (b:G)
WHERE a.x= b.y
MERGE (a)-[:similar]->(b)
RETURN *
However, this solution is very slow, is there any hints about other way to do this? Also is it possible to create the relationships during the data loading inside the CALL apoc.periodic.iterate
block ?