USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM "file:///ewqrwqsa.csv" AS line
MERGE (n:A {number : line.Node1})
WITH line, n
MERGE (m:B {ID : line.Node2})
WITH line, m, n
MERGE (l:W {weight : toInteger(line.Weight)})
WITH l,m,n
MERGE (n)-[:Related(l)]->(m);
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM "file:///ewqrwqsa.csv" AS line
MERGE (n:A {number : line.Node1})
MERGE (m:B {ID : line.Node2})
MERGE (n)-[r:Related]->(m)
SET r.weight = toInteger(line.Weight);