I am trying to create tree structure in Neo4j with Cypher Query.
I am loading data from CSV to graph.
Data structure is. Its having two Column that is Parent and Child
P1,C1
P1,C2
P1,C3
C1,SC1
C1,SC2
C2,SC3
C3,SC4
SC1,SSC1
SC2,SSC2
And so on....
Here P is 1st level(Parent, parent 1) and C is Child, SC is Sub-Child and SSC is Sub-Sub-Child, I want to Load the data and create tree structure from top-to bottom
I have used this Query but not getting the tree structure.
LOAD CSV FROM 'file:C:/Users/ykumarx077781/Desktop/parent.csv' AS line
CREATE (Parent:Parent { Parent: line[0]} )
CREATE (Child:Child { Child: line[1]} )
CREATE (Parent)-[R:Parent_off]->(Child)
return R;
Please help me out to create the structure..
Also used MERGE but did not get
LOAD CSV FROM 'file:C:/Users/ykumarx077781/Desktop/parent.csv' AS line
MERGE (Parent:Parent { Parent: line[0]} )
MERGE (Child:Child { Child: line[1]} )
CREATE (Parent)-[R:Parent_off]->(Child)
return R;