@tkrol Here is a simple example. I didn’t name everything the same and you need to add the where condition.
CREATE QUERY findAll(/* Parameters here */) FOR GRAPH myGraph {
ListAccum<EDGE> @@edgeList;
OrAccum @visited;
reachableVertices = {}; # empty vertex set
visitedVertices (v_type) = {v_type.*}; # set that can contain ANY type of vertex
WHILE visitedVertices.size() !=0 DO # loop terminates when all neighbors are visited
visitedVertices = SELECT s # s is all neighbors of visitedVertices which have not been visited
FROM visitedVertices-(:e)->:s
WHERE s.@visited == false
ACCUM @@edgeList += e
POST-ACCUM s.@visited = true;
reachableVertices = reachableVertices UNION visitedVertices;
END;
PRINT reachableVertices, @@edgeList;
}