Traverse in two different edges and and perform divide on their attributes

Hello there I am new in TigerGraph, can anybody here who can help me in this basic query
I have Segment Vertex which is directly connected to the Calender Vertex
and Calender vertex is connected to the visit group vertex with an edge of calendar_visitgroup And the same Calender Vertex is also connected with spend_group vertex with an edge of calendar_spendgroup

So I have as a attribute of total_visit on the calendar_visitgroup edge
and I have as a attribute of total_spend on the calendar_spendgroup edge

I want to divide total_spend / total_visit
and result require segment_list: { “Australia”: total_spend / total_visit,
“Bhutan”: " total_spend / total_visit }

Hi @PrinceDella !

Hope this is helpful! If total_visit and total_spend are the number of times the edges are traversed, it sounds like global sum accumulators could work better instead of using attributes for total_visit or total_spend. For example, one can be added to the accumulators every time an edge is traversed or some condition is met. This sum can be stored globally or locally on a vertex or edge. As far as I know, attributes can’t be changed during a query.

Here is the documentation on accumulators: Accumulators :: Docs

Also, if some information about segment_list if you want to format it as a map: System & Language Basics :: Docs

1 Like