code: function (nodes, options) {
      /*
       * In collapse operation there is no fisheye view to be applied so there is no animation to be destroyed here. We can do this 
       * in a batch.
       */ 
      cy.startBatch();
      this.simpleCollapseGivenNodes(nodes, options);
      cy.endBatch();
  
      nodes.trigger("position"); // position not triggered by default when collapseNode is called
      this.endOperation(options.layoutBy);
  
      // Update the style
      cy.style().update();
  
      /*
       * return the nodes to undo the operation
       */
      return nodes;
    }
docs: collapse the given nodes then perform end operation