So I am reading up on getvid and found this example
CREATE QUERY getvid_ex () FOR GRAPH socialNet {
MinAccum @cc_id = 0; //each vertex’s tentative component id
Start = {person.*};
Initialize: Label each vertex with its own internal ID
S = SELECT x FROM Start:x
POST-ACCUM
x.@cc_id = getvid(x);
Community detection steps omitted
PRINT Start.@cc_id;
}
But this example is initializing @cc_id to 0, and its a MinAccum. so any positive values will be ignored, am I missing something?
Thanks for pointing that out, Mark.
You’re right. We should not initialize the MinAccum to any explicit value; the default initial value is the built-in constant GSQL_INT_MAX, the maximum possible integer, which is what we want.
P.S. It’s not clear from this example why we’re using a MinAccum, though the comment about “community detection” hints at it. This code snippet was taken from from an algorithm that will selectively group vertices together. We want a unique ID for each group. The scheme we use is CommunityID = min(ID of each member). We could just as well say CommunityID = max(ID of each member). We only care that it is unique.
It’s been fixed, thanks for the notice.
Thanks Victor for the fix and the detailed response