Function to add values of children to respective parent nodes
function valuesFromChildren ( parent , values ) { let valuesChildren = new Array ( parent . length ) ; for ( let i = 0 ; i < parent . length ; i ++ ) { valuesChildren [ i ] = 0 ; } for ( let i = 0 ; i < parent . length ; i ++ ) {