I have the below tree structure where 1,2,3,4,5,6 are some ids and in bracket we have the values.
----------- 1(20)
|
------- 3(50)<------
| |
6 (30) <--- 5(15) <---- ----------- 2 (10)
|
------ 4(10)
I want to get the cumulative sum of all child nodes plus the value of root node at the root level. In this example, my output should be 6(root) => 135 (sum of all nodes). Any idea how do I implement this in Spark Graphx or Graphframe?