Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-24-2020 10:14 AM
Given the movies data set as an example:
MATCH path=shortestPath((p1:Person)-[*0..15]-(p2:Person))
WHERE toLower(p1.name) = toLower('Tom Hanks') AND toLower(p2.name) = toLower('Halle Berry')
return relationships(path) AS relationships, nodes(path) AS nodes
I'm trying to sort the roles array for each step of the path. When I've needed to do this on nodes, I've used the UNWIND keyword, but that doesn't seem to work on paths.
11-24-2020 12:53 PM
This is not a complete answer.
You can sort just inside the role as follows.
MATCH path=shortestPath((p1:Person)-[*0..15]-(p2:Person))
WHERE toLower(p1.name) = toLower('Tom Hanks')
AND toLower(p2.name) = toLower('Halle Berry')
WITH relationships(path) AS relationships
UNWIND relationships AS relationship
RETURN apoc.coll.sort(relationship.roles) AS roles
All the sessions of the conference are now available online