Hey guys, I’m a newbie to graph databases. Currently, I am learning GSQL by trying simple applications like finding 2-hop friends for each person in a graph. However, after reading some GSQL examples, I still don’t know how to iterate over all the vertexes so that I can pass each of them as a parameter to the query khop (which is provided by the tigergraph benchmark on Github). I come up with a very naive and stupid way to do this(which is slow):
create query fof(STRING filepath) for graph social{
SetAccum<vertex<person>> @@allperson, @@result;
FILE f1 (filepath);
all = {person.*};
all = select s from all:s accum @@allperson += s;
foreach p in @@allperson do
@@result = khop(p, 2);
f1.println(p, @@result);
end;
}
Is there a more direct way?