Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-14-2020 11:48 AM
Hello everyone,
I'm using apoc.algo.dijkstra
to compute shortest paths and then create new relationships with some computed properties. Here is my query:
Call apoc.periodic.iterate(
"Match (h:Hub:Airport),(a:Arrival)
where h.code<>a.code
Call apoc.algo.dijkstra(h,a,'2017-10>|BOARD_AT|CONNECT_TO>', 'duration_min') yield path, weight as dur
WITH h,a,Nodes(path) as nps, dur, size(nodes(path)[2..-1]) / 2 as nbrE,
size([node in nodes(path)[2..-1] WHERE node:Hub]) / 2 as wei,
apoc.coll.sum([rel in relationships(path) | coalesce(rel.distance, 0)]) as distance,
apoc.coll.sum([rel in relationships(path) | coalesce(rel.revenue_min, 0)]) as revenue,
apoc.coll.min([rel in relationships(path) WHERE exists(rel.frequency) | rel.frequency]) as frequency,
apoc.coll.min([rel in relationships(path) WHERE exists(rel.capacity) | rel.capacity]) as capacity
unwind nps as np
return h,a,collect (distinct np.code) as path,wei,nbrE,distance,revenue,frequency,(dur-(120*nbrE)) as duration,capacity",
"match (aa:Airport)<-[:ALIGHT_AT
]-(a)
call apoc.merge.relationship(h,"CONTRACT",{},{duration_min:duration, distance:distance,revenue_min:revenue,frequency:frequency,capacity:capacity,nbrHub:wei,nbrEscale:nbrE,chemin:path},aa,{}) YIELD rel as rc",{batchSize:1000, iteratelist:true});
My problem that it takes a lot of time without creating my relationships. Here is the plan of my query (100000 estimates rows to merge, which is not huge):
My heap size is 10240m
All the sessions of the conference are now available online