vinayaksangarJune 24, 2017 at 11:57 pm #8020
Hello Tom !!!!
It is a really great work dude….Extremely thankful if you help.
Presently i am using the tree structure to calculate scores at each level of the tree.Lets suppose i have a parent P with two children C1 and C2 . If score of C1 is is 20 and C2 is 30. I dont want score of
P = (20+30).
I too have weights associated with each parent child edge .
Let P->C1 edge had weight w1 and P->C2 edge had weight w2. I want score of
P to be ( (w1*20) + (w2*30) )
. Is it possible till now.
I am able to fetch data from my MYSQL database and present the tree (after converting data to json). At each node score is coming as sum of its child nodes.What i am planning . I have planned that i will add few more columns to each row of the data. Thus if I have 4 level tree i will add three more columns representing weights on those 3 edges coming on each such root to leaf path(as each row in data correspond to root to leaf path). As on each root to leaf path in a 4 level graph we will encounter 3 edges so i will add their corresponding weights in each row.
Now how to use aggregate function to calculate weighted sum of children score at parent nodes?vizulyJune 26, 2017 at 7:45 am #8021
You will notice in the test file there is this function being called to prep the data.
The last parameter that is being passed in is the “calculation” used to aggregate the child nodes. You can pass in your own custom calculation.
I suggest looking at the source code of this function so you can use it as you see fit.
You must be logged in to reply to this topic.