I have the following graph:
I'd like to write an AQL query that returns all vertices which are neighbor's INBOUND vertices colored in RED from the start vertex colored in GREEN.
I tried the following AQL to retrieve red vertices from the green vertex.
WITH collection_A, collection_W
LET A_Neighbors = (FOR t IN collection_edges
FILTER t._to == 'collection_W/W'
RETURN t._from)
let all_w = []
for item in A_Neighbors
let sub_w = (for v1 in collection_edges
FILTER v1._to == item
return v1 )
return APPEND(all_w, sub_w)
Is there any good solution other than this? Because I'm not sure this gives the correct values for start vertex collection_W/W
.
My collection_edges
contains following two kind of documents.
{
_from: collection_W/w,
_to: collection_A/a,
label: INBOUND
}
and
{
_from: collection_A/a,
_to: collection_W/w,
label: OUTBOUND
}