I am working on a CSV file that has a structure similar to:
aId, Amount, bId
int, float, int
Here aId, and bId have constraints on Node A, and B respectively. On loading the Nodes, and relationships initially,
LOAD CSV with headers FROM 'file:///abc.csv' as row
MERGE (a: A {aid: toInteger(row.aID)})
MERGE (b: B {bid: toInteger(row.bID)})
CREATE (a)-[:HAS_SENT {amt: toFloat(row.Amount)}]->(b)
There are 1490 labels and 1299 relationships.
Now I wish to use different Graph Data Science Libraries to perform various computations on the file. To project a graph for this, I estimated the same using CALL gds.graph.create.estimate(['A'],['HAS_SENT'])
that returned 851 Nodes, and 1299 relationships.
However, when I tried to create the graph, CALL gds.graph.create('mySampleGraph',['A'],['HAS_SENT'])
, it returned the same number of nodes, but with 0 relationship.
What did I miss out, and how is it possible for me to get mappings correct?
Judging by your import query, your relationships only exists between nodes A and B. There are no relationships between nodes labeled A. In general, only relationships that have both the source node and the target node described in the Node Projection part are loaded. In your case, there are no relationships that have both the source and the target node with a label A. If you load both labels A and B, then the GDS should load all the relationships.
CALL gds.graph.create('mySampleGraph',['A', 'B'],['HAS_SENT'])
Btw... is there any specific reason to have two labels instead of one?