1
votes

I am new to Neo4j. I have csv file containing data in the format:

"from","to","amount","count"  
"Lenin","George","10000","1"  
"Mike","Suriya","4000","3"  
"Mike","Norman","10000","1"  
"George","Lenin","4000","1"  

Now, I would like to import this csv with relationship so that I can get graph with circular redirection like incase of Lenin and George. How would I do that?

1

1 Answers

0
votes

You could use

LOAD CSV WITH HEADERS FROM "file:///csv.csv" as row
MERGE (n:Person{name:row.from})
MERGE (m:Person{name:row.to})
MERGE (n)-[r:RELATIONSHIP]->(m)
ON CREATE SET r.amount = row.amount,
              r.count = row.count

check https://neo4j.com/developer/guide-import-csv/ for more information