I have the following graph, describing co-occurrence of car brands in documents:
CREATE
(`0` :Car {value:"Ford"})
, (`1` :Car {value:"Subaru"})
, (`2` :Car {value:"VW"})
, (`0`)-[:`DOCUMENT` {value:"DOC-1"}]->(`1`)
, (`0`)-[:`DOCUMENT` {value:"DOC-2"}]->(`1`)
, (`1`)-[:`DOCUMENT` {value:"DOC-3"}]->(`2`);
If there are many relationships between two nodes - for the purpose of visualization - I want to replace it with a single one and calculate the weight:
VW ---1--- Subaru ---2--- Ford
How can this be achieved?
I tried the following query:
MATCH (n1)-[r1:DOCUMENT]-(n2)
RETURN n1, n2, apoc.create.vRelationship(n1, 'WEIGHT', {weight:count(r1)}, n2);
but this is not the expected result: