Dbms.memory.heap.max_size issue

Hi team,

I am getting this issue when i try to get all end nodes
using query

match p=(n:ASSET {uniqueID:"some id"})-[m*]-() return p

please help me write a query where i get only those nodes that are either forward node or backward node
but not the sibling nodes
means query should return only forward and backward nodes only, not forward nodes of backward nodes
NOTE THIS DATA CAN HAVE N NUMBER OF STEPS

please check the case i want to describe
https://community.neo4j.com/t5/neo4j-graph-platform/query-to-get-desired-result/td-p/63289


@mohit_geeky wrote:

match p=(n:ASSET {uniqueID:"some id"})-[m*]-() return p


You are getting the whole graph because you want to traverse the graph without any direction. So, it traverses that way across the graph.

You can fix it by changing it to

match p=()-->(n:ASSET {uniqueID:"some id"})-->() return p

This will honor the directions and you should get the data you want.

This seems to be a duplicate issue to the one you referenced. Is the some difference you want help with.

yes both are same issue
in reference I just created some data to explain my issue