Hello, how are you guys?
I'm trying to calculate the weight of the relation between nodes, I know how to do using a script like in node or python language, but I think there is a better way using some algo or cypher language.
Use case:
CREATE (p:SystemType {name: 'A'});
CREATE (p:SystemType {name: 'B'});
CREATE (P:SystemType {name: 'C'});
CREATE (p:SystemType {name: 'D'});
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'A' AND b.name = 'B' CREATE (a)-[r:RELTYPE {description: 'x'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'B' AND b.name = 'C' CREATE (a)-[r:RELTYPE {description: 'rt'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'D' AND b.name = 'A' CREATE (a)-[r:RELTYPE {description: 'y'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'A' AND b.name = 'B' CREATE (a)-[r:RELTYPE {description: 'tt'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'D' AND b.name = 'B' CREATE (a)-[r:RELTYPE {description: 'bbb'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'B' AND b.name = 'D' CREATE (a)-[r:RELTYPE {description: 'wer'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'B' AND b.name = 'C' CREATE (a)-[r:RELTYPE {description: 'mm'}]->(b) RETURN type(r);
MATCH (a:SystemType), (b:SystemType) WHERE a.name = 'B' AND b.name = 'C' CREATE (a)-[r:RELTYPE {description: 'rtrrtnc'}]->(b) RETURN type(r);
Expect result:
B<>D = relation with weight 2
D<>A = relation with weight 1
A<>B= relation with weight 2
B<>C= relation with weight 3
Basic I don't care if the relation is in one direction or other, I just want see the number of connections between 2 nodes, create a new relation with a weight property.
Any idea?