function beforeLink(nodeData) {
            nodeData.wrapMethod('getItemModel', function (model, idx) {
                var node = tree.getNodeByDataIndex(idx);
                var leavesModel = node.getLeavesModel();
                if (!node.children.length || !node.isExpand) {
                    model.parentModel = leavesModel;
                }
                return model;
            });
        }
Initialize all computational message for following algorithm.

@param  {module:echarts/data/Tree~TreeNode} root   The virtual root of the tree.