Hi
I have a graph:
There is a list of node-pairs in a csv file:
input.csv
case, from, to
c1,AAA,BBB
c1,EEE,FFF
c2,AAA,EEE
Task: The distance between two nodes should be calculated and put in a csv like:
ouput.csv
case, from, to, distance
c1,AAA,CCC,2
c1,EEE,FFF,1
c2,AAA,EEE,0
Could you please give me some istructions or code, how to do it ?
Tanks in advance,
Michel
here the script creating the graph:
CREATE (a:City {DS: 'AAA'})
CREATE (b:City {DS: 'BBB'})
CREATE (c:City {DS: 'CCC'})
CREATE (d:City {DS: 'DDD'})
CREATE (e:City {DS: 'EEE'})
CREATE (f:City {DS: 'FFF'})
CREATE (g:City {DS: 'GGG'})
MATCH (p1:City {DS: 'AAA'}), (p2:City {DS: 'BBB'})
CREATE (p1)-[:NB {route: '66'}]->(p2)
MATCH (p1:City {DS: 'BBB'}), (p2:City {DS: 'CCC'})
CREATE (p1)-[:NB {route: '66'}]->(p2)
MATCH (p1:City {DS: 'CCC'}), (p2:City {DS: 'DDD'})
CREATE (p1)-[:NB {route: '66'}]->(p2)
MATCH (p1:City {DS: 'EEE'}), (p2:City {DS: 'FFF'})
CREATE (p1)-[:NB {route: '77'}]->(p2)
MATCH (p1:City {DS: 'FFF'}), (p2:City {DS: 'GGG'})
CREATE (p1)-[:NB {route: '77'}]->(p2)