Using vertex set accum as target set

I’m using 2.6.1. In the docs I see the following: https://docs.tigergraph.com/v/2.6/dev/gsql-ref/querying/select-statement#edge-set-and-target-vertex-set-options

This indicates that I can use a vertex set accum like this:

	SetAccum<Vertex> @@target;
	SetAccum<Vertex> @@source;
	
	source (Any) = @@source;
	
	frontier = SELECT u
	  FROM source:u-(shareholder_of:e)->(@@target):v;

So basically I’m looking for edges between two sets. However, this gives me the following error:

(9, 38) Error: @@target is not string or set of string expression

This seems to indicate that only a set of strings is supported, even though the docs claim a set of vertices is supported:

a global SetAcum accumulator containing a set of edges or vertices
("@@"accumName)

Any idea what’s wrong here?

It’s a doc bug. I have filed a ticket internally.

In syntax V2, 3.0 we support this feature.
https://docs.tigergraph.com/start/gsql-102/multiple-hop-and-accumulation

You might try this for your goal.

	SetAccum<Vertex> @@target;
	SetAccum<Vertex> @@source;
	
	source (Any) = @@source;
	
	frontier = SELECT u
	               FROM source:u - (shareholder_of:e) -> :v
                       WHERE v in @@target
                       ACCUM xx;
1 Like

This was really interesting, as it demonstrates an enhancement in 2.6 that I missed, but it really makes some things much more elegant.

You can apply a vertex set as the target now. If you use the global accumulator as-is, then it assumes it is a list of strings defining a set of types (which was an enhancement so we could parameterise the types for our standard algorithms).

But, if you convert the accumulator to a vertex set using the curly-bracket syntax, then you can use it directly. This fragment is legal syntax:

SetAccum<Vertex> @@target;
SetAccum<Vertex> @@source;
	
source_vset = {@@source};
target_vset = {@@target};

frontier = SELECT u
FROM source_vset:u-()-target_vset:t;
1 Like