How do you return all distinct full paths?

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

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
1 Like