Is there an approach where an Accum can be attached to an edge?

Here is the gist of what I’m trying to do, for obvious reasons following query returns an error on Line 4. “Error: Accumulators cannot be attached to the edge variable ‘e’. Thus, reading and writing edge accumulators are not supported.”

I know we can’t attach an accumulator to the edge but is there any alternate approach I can try to get similar results?

CREATE QUERY Temp(SET<VERTEX<User>> users, INT a, INT b) FOR GRAPH social { 
    	1. SumAccum<INT> @testCount;
    	2. USER_SET = {users};
    	3. X = SELECT t FROM USER_SET:s -(User_SENT_MESSAGE_TO_User:e)-> :t
        4.                         ACCUM e.@testCount += e.countsByMonths.get(a) + e.countsByMonths.get(b);

        5. Y = SELECT s FROM USER_SET:s -(User_SENT_MESSAGE_TO_User:e)-> :t
	    6.                         WHERE t IN users AND e.@testCount > 0 ACCUM ...;

1 Like

How about a vertex attached accumulator which includes the target vertex, and the edge count?

Something like this:

MapAccum<VERTEX, INT> @testCount;

ACCUM s.@testCount += (t -> e.countsByMonths.get(a) + e.countsByMonths.get(b));

1 Like

Thank you for the quick response!

That was my initial instinct but I need to iterate through those edges multiple times. Would this be a best approach in that case?

Suppose I wanted to implement Louvain
where Person is User, Coworker is User_SENT_MESSAGE_TO_User and e.weight is e.@testCount here.

How does MapAccum<VERTEX, INT> affect the complexity and performance of Louvian Parallel query?

1 Like