0

In the graph database, I want to know from which route I traverse

e.g.

Path-1. a-1-2-3-4-5-b

Path-2. a-1-2-7-4-5-b

In both the above examples, it traverses from point a to point b through different routes. Here I want to identify from which route I reach to point b.

  • If you are using Gremlin can you please provide the query you have so far and if possible a little sample data. That will make it easier to give you an answer. – Kelvin Lawrence Apr 14 '20 at 17:21

1 Answers1

0

You can use the NODES function to list the nodes in a path. There is also a RELATIONSHIPS function for listing the relationships.

For example, if this query finds the 2 paths in your question, it will return the nodes in each path:

MATCH path = (a:A)-[*]->(b:B)
RETURN NODES(path) AS nodesInPath
cybersam
  • 63,203
  • 6
  • 53
  • 76