code: function _normalizeVertexTree(vertex) {
    var children = vertex.get('children');
  
    if(children) {
      children = children.filter(function (child) {
        _normalizeVertexTree(child);
        return child.get('type') !== 'vertex' || child.get('treeParent') === vertex;
      });
  
      vertex._setChildren(children);
    }
  
    return vertex;
  }
docs: Part of step 1
  To remove recurring vertices in the tree
  @param vertex {Object} root vertex