Path between Nodes

I want to retrieve nodes based on the hop count.
I'll give the start node and end node and also the hop count
So, give me those nodes who matches the hop in the database

Hi @gaminbot3813

With the below dataset
Merge(a:N{name:'A'})-[:Related_TO]->(b:N{name:'B'})-[:Related_TO]-(c:N{name:'C'})-[:Related_TO]->(d:N{name:'D'})
Merge(a:N{name:'A'})-[:Related_TO]->(b:N{name:'B'})-[:Related_TO]->(d:N{name:'D'})

Query Used
Match p=(a:N{name:$startNode})--(b:N{name:$endNode}) with a as a, nodes(p) as nodesInPath where $hopCount =size(nodesInPath) -2 return a,nodesInPath

:param hopCount=>1
:param startNode=>'A'
:param endNode=>'D'