How to all get parent and child of particular node from thousand of data in NEo4j

I have this data and I want only parent and child of Node2.

Hi Andrew, thank you for your post is very useful. I have been testing your queries because I want to get "n" parents and children but I'm not able to get it, could you help me please? "n" could be 2, 5 etc

Hi @lky17

match p=(b:children)<--(n:node)<--(c:Parent)

RETURN

CASE

WHEN count(b)=count(c) THEN p

END AS result limit (2*n)

try this and change the '=' in the when condition depending on the requirement

Hi @saisannihith741, thank you for your answer, I'm going to test it asap :-).

Regards