Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-15-2019 01:27 PM
Given the following graph:
I want to get a list of all distinct paths which terminate in the leaf nodes, in string form:
Mobile phone instagram users -> instagram -> facebook -> Company
Mobile phone instagram users -> social network -> Activity
Mobile phone instagram users -> mobile phone -> television and mobile device -> traditional and digital -> Device
Mobile phone instagram users -> mobile phone -> mobile device -> digital -> Device
Solved! Go to Solution.
10-15-2019 01:30 PM
You've likely already matched to your starting node. In that case you're looking for variable-length paths of outgoing relationships ending at a leaf node, and the thing that defines a leaf node is that it doesn't have outgoing relationships. So something like this, of course substituting the labels and properties that are actually in your graph
MATCH path = (:Node {name:'Mobile phone instagram users'})-[*]->(leaf)
WHERE NOT (leaf)-->()
RETURN path
10-15-2019 01:30 PM
You've likely already matched to your starting node. In that case you're looking for variable-length paths of outgoing relationships ending at a leaf node, and the thing that defines a leaf node is that it doesn't have outgoing relationships. So something like this, of course substituting the labels and properties that are actually in your graph
MATCH path = (:Node {name:'Mobile phone instagram users'})-[*]->(leaf)
WHERE NOT (leaf)-->()
RETURN path
All the sessions of the conference are now available online