improve the d3.js tree logic to allow weights to be modifyed