New in Neo4j Database

How to write a query to traverse a path (node 1 to node n)

Hi chetanjadhav3288,

welcome the Neo4j community!

I think you need to be more specific with your question for us to really help you. But maybe as a start:

There are several path finding algorithms that you can use: https://neo4j.com/docs/graph-data-science/current/algorithms/pathfinding/

But you can also look for it (less efficiently) without using algorithms by e.g.:
MATCH path = (a:Node {id: 1})-[:RELATIONSHIP_TYPE*]->(b:Node {id: 20}) RETURN path

Regards,
Elena

1 Like