cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

making relationship of two node in same row in csv

yonguks
Node Link

Hello, I'm new to Neo4j and trying to make a simple relationship graph

from | to

a | b

a | c

b | d

b | e

In this csv file, what I'm trying to make is a->b, a->c, b->d, b-> e relationship

i tried

"""

LOAD CSV WITH HEADERS FROM "file:///lg4neo.csv" AS f
MATCH (e1:Event {id: f.frompan}), (e2:Event {id: f.toPan})
return (e1)-[:DF_mat]->(e2)
"""
 
but didn't worked. 
If someone could help me, it would be very appreciated.
Thanks

 

1 ACCEPTED SOLUTION

Try this:

LOAD CSV WITH HEADERS FROM "file:///lg4neo.csv" AS row
merge (e1:Event {id: row.fromPan})
merge (e2:Event {id: row.toPan})
merge (e1)-[:DF_mat]->(e2)

Screen Shot 2022-07-26 at 9.47.38 AM.png 

Screen Shot 2022-07-26 at 9.47.45 AM.png

View solution in original post

3 REPLIES 3

Try this:

LOAD CSV WITH HEADERS FROM "file:///lg4neo.csv" AS row
merge (e1:Event {id: row.fromPan})
merge (e2:Event {id: row.toPan})
merge (e1)-[:DF_mat]->(e2)

Screen Shot 2022-07-26 at 9.47.38 AM.png 

Screen Shot 2022-07-26 at 9.47.45 AM.png

thank you, this really helped me!!

really appreciated:)

yonguks
Node Link

thank you, this really helped me!

really appreciated:)