1
votes

I have a Node (Me).

(Me) has a name="john smith" attribute and is a 'Person' label

This node has many relationships with other nodes of different 'labels'. And those nodes have relationships with other nodes. etc.. stretching out into the whole graph.

Somewhere out there are some nodes of type (p:Product). I don't know at what 'depth' they are away from the starting node: some will be near it and others will be further away.

I want to get all these (p:Product) nodes which have ultimate relations with the (Me) node.

Is this possible?

1

1 Answers

2
votes

You can get a node in a specified depth using cypher:

start me = node(your me node)
match (me)-[*..100]-(p:Product) return p

This will find the closest Product node with a maximum relation depth set to 100.

You can find more on documentation website