I am new to neo4j and cypher, please let me know if I need to improve my question and I will try to make it more meaningful.
I have a dataset in .csv format conating 1000 rows. I have imported that dataset using cypher in neo4j local host. http://localhost:7474/browser/. Here is the sample dataset image
Columns fromacc and toacc contains repeated values. I want to plot the connected graph having timestamp and amount in the edges and nodes showing fromacc and toacc.
I have attached the image of graph:
The query which I have written is:
LOAD CSV WITH HEADERS FROM "file:///datanew.csv"As row CREATE (demo:demo
{blockid:toInteger(row.id),blockhas:row.hash,txnid:row.txs,
frmacc:row.frmacc,toacc:row.toacc,amount:toInteger(row.amount)})
Create (p:demo{frm:demo.frmacc})-[r:transferred]- >
(q:demo{toa:demo.toacc}) return r
But I am getting only one node connected to another node with repetitions.
Can anyone help me to get the desired graph in image above. Thanks in advance.
Data:
id hash time_stamp txs from to amount
0 hash1 1231006505 1 685031 97258 65536
1 hash2 1231469665 1 761055 97260 65536
2 hash3 1231469744 1 2039922 97261 1000000
3 hash4 1231470173 1 2271509 584573 3000000
4 hash5 1231470988 1 2271510 584574 3000000
5 hash6 1231471428 1 2271511 584577 3000000
6 hash7 1231471448 2 685031 16785 1000000
7 hash8 1231471478 1 685031 97258 677888
8 hash9 1231471498 2 97258 685031 567890
9 hash0 1231471444 1 97258 584577 100000
Here "from" and "to" represents nodes "A,B" in the the graph I plotted and attached
In the vertices amount,timestamp should be mentioned
fromandtocolumns, but where do you create nodes that have some property related to those values so you can look them up later? The standard approach for data import is 1. Create the nodes you need, including with ids or properties corresponding with the relationship creation csv you'll import later. Then 2. Load the relationship import CSV, which has the properties of fields to MATCH to the nodes you previously imported, then you MERGE the relationship between. I think you really need to reread the documentation, including for MERGE and LOAD CSV. - InverseFalcon