1

I need to build all possible routes from point "A" to point "E" with the condition that the end point is a point "B"

Task example:

From : A, To: B

Example result:

A -> E

A -> B -> E

A -> C -> D -> E

A -> B -> C -> D -> E

So far I was able to do so:

FOR v, e, p IN 1..10 OUTBOUND "city/907499" GRAPH 'CityToCity' 
  FILTER p.edges[*].user ALL == "6609844"
  FILTER p.vertices[4]._id == "city/1012911"
RETURN p

But in this example, you must explicitly indicate at what level the endpoint should be located. How to make it simple from A to E without specifying level 4 in this filter "p.vertices [4] ._ id" ???

1 Answers1

0

As the AQL documentation says:

// access last array element
u.friends[-1]

So in your example, specify the constraint on p.vertices[-1]._id

Also specify a very large number for MAX. Unfortunately, currently AQL requires that a specific value be given, but a ridiculously large value can be specified.

peak
  • 105,803
  • 17
  • 152
  • 177
  • Thank you very much! That was it! Can you help with one more problem? [Here is the task.](https://stackoverflow.com/questions/48657397/how-to-use-witnin-with-2-geo-indexes-in-one-collection) – Ilya Rumyancev Feb 07 '18 at 06:34