function prune(node, root) {
var clipped = root.copy();
var nodecopy = clipped.descendants().filter(d => d.data === node.data)[0];
var path = clipped.path(nodecopy);
path.forEach( (d,i) => {
if( path[i+1] ) {
d.children = [path[i+1]];
if(path[i+1].hasOwnProperty("children")) {
delete path[i+1].children;
}
}
});
return clipped;
}