How to stop traversing after edge class?
The graph for the query TRAVERSE bothE(), bothV() FROM ( SELECT FROM Title WHERE title_id IN [12] )
looks like this:
If I wrote (for blue graph):
TRAVERSE bothE("E14", "E5", "E6"), bothV() FROM ( SELECT FROM Title WHERE title_id IN [12] )
it don't gave me V 970
.
How to construct a query that will return the part I need? I would like the whole graph to be returned if there exists an orange route.
I tested: TRAVERSE inE(..), outE(...), bothE()
and WHILE $parent.$current.@class != "E13"
bit it don't works.
I've seen https://stackoverflow.com/a/43776591/1194525, but if I understand correctly, MATCH can be used at a well known well.
I have an idea how to do it in 2 queries, but could use improvement, eg .: Doing this in 1 query.
step 1: Traverse graph by all "right" edges.
TRAVERSE bothE("Prequel", "Sequel"), bothV() FROM (
SELECT FROM Title WHERE title_id IN [12] )
step 2: Get all Vertex rid
from response (in client)
step 3: Query by "stop" edges for all Vertex rid
from previous query.
TRAVERSE bothE("Character"), bothV() FROM (
SELECT FROM Title WHERE title_id IN [12, 431, 432, 433, ...] )
MAXDEPTH 2
step 4: Merge responses (Vertex + Edges) in client.