I have created graph using MERGE
to avoid repetition, following is the query
LOAD CSV WITH HEADERS
FROM "file:///C:/Users/username/Desktop/file.csv"
AS network
MERGE (sourceNode {id:network.node1})
MERGE (destNode {id:network.node2})
WITH sourceNode,
destNode,
network
It doesn't assign labels to nodes but I need labels to query graph. Is there any way to assign labels to nodes? Thanks in advance.
You seemed to miss the variables which are supposed to be assigned to a node before the labels.This way your nodes will be assigned labels and you can use their respective variables for operations on them. I've modified the query. Hope this helps!
LOAD CSV WITH HEADERS
FROM "file:///C:/Users/username/Desktop/file.csv"
AS network
MERGE (n:sourceNode {id:network.node1})
MERGE (m:destNode {id:network.node2})
WITH n,m,network